diff --git a/myapp.conf.example b/myapp.conf.example new file mode 100644 index 0000000..cfe9b86 --- /dev/null +++ b/myapp.conf.example @@ -0,0 +1,6 @@ +{ + foo => 'bar', + banana => 'monkey', +# Database connection details + dsn => "dbi:SQLite:dbname=foodloop.db", +}; diff --git a/senddatatodb.pl b/senddatatodb.pl index fe880d1..1d24b6d 100644 --- a/senddatatodb.pl +++ b/senddatatodb.pl @@ -5,7 +5,11 @@ use Data::UUID; # connect to database use DBI; -my $dbh = DBI->connect("dbi:SQLite:dbname=foodloop.db") or die "Could not connect"; +my $config = plugin Config => {file => 'myapp.conf'}; + +use Devel::Dwarn; Dwarn $config; + +my $dbh = DBI->connect($config->{dsn}) or die "Could not connect"; # shortcut for use in template helper db => sub { $dbh };