X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=examples%2FSchema%2Finsertdb.pl;h=c57460e73607453a402425fbfbcff5b80d704fcc;hb=db57071fd969d9357a96a9b07f7ae65f5cce51e5;hp=67a432f05f42deefb2c58f08f1adc77dbc88389d;hpb=3d9632fd77404b25649fcda4d09999ca1778db87;p=dbsrgits%2FDBIx-Class.git diff --git a/examples/Schema/insertdb.pl b/examples/Schema/insertdb.pl old mode 100644 new mode 100755 index 67a432f..c57460e --- a/examples/Schema/insertdb.pl +++ b/examples/Schema/insertdb.pl @@ -1,13 +1,14 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl -use MyDatabase::Main; use strict; +use warnings; -my $schema = MyDatabase::Main->connect('dbi:SQLite:db/example.db'); +use MyApp::Schema; -# here's some of the sql that is going to be generated by the schema -# INSERT INTO artist VALUES (NULL,'Michael Jackson'); -# INSERT INTO artist VALUES (NULL,'Eminem'); +use Path::Class 'file'; +my $db_fn = file($INC{'MyApp/Schema.pm'})->dir->parent->file('db/example.db'); + +my $schema = MyApp::Schema->connect("dbi:SQLite:$db_fn"); my @artists = (['Michael Jackson'], ['Eminem']); $schema->populate('Artist', [