A frequent pattern when writing database-backed applications with the DBI is to connect to the database and cache the database handle somewhere. A simplified example: package MyApp::DB; use DBI; use strict; my $DBH = DBI->connect('DBI:SQLite:dbname=myapp.db', '', '', { PrintError => 0, RaiseError => 1, AutoCommit => 1, sqlite_unicode => 1, }); sub dbh { $DBH } Just load MyApp::DB anywhere in your
{{#tags}}- {{label}}
{{/tags}}