X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FDevel-REPL.git;a=blobdiff_plain;f=examples%2Fdbic_project_profile.pl;fp=examples%2Fdbic_project_profile.pl;h=8a973483cc628a0ce6a3aaea1f068da0514e109f;hp=0000000000000000000000000000000000000000;hb=6aa584927ce35a633ee66fd372f3a6c2c23aa447;hpb=70b00e9c6830954a2dd67b6dd593701b43d2c217 diff --git a/examples/dbic_project_profile.pl b/examples/dbic_project_profile.pl new file mode 100644 index 0000000..8a97348 --- /dev/null +++ b/examples/dbic_project_profile.pl @@ -0,0 +1,16 @@ +# this might live in /path/to/checkout/.re.pl/project.rc +# see: http://chainsawblues.vox.com/library/post/develrepl-part-4---script-options-rc-files-profiles-and-packaging.html + +# load my global ~/.re.pl/repl.rc +Devel::REPL::Script->current->load_rcfile('repl.rc'); + +use lib 'lib'; # to get at the lib/Project.pm, lib/Project/* perl modules +use Project::Schema; # load the DBIC schema + +Project::Schema->connection('dbi:Pg:dbname=project_matthewt_test','matthewt',''); # connect to db +Project::Schema->stacktrace(1); # turn on stack traces for DBI errors + +sub schema { 'Project::Schema' } # shortcut so things like schema->sources works +sub rs { Project::Schema->resultset(shift); } # shortcut so rs('Foo')->find(1); works +sub cols { Project::Schema->source(shift)->columns; } # cols('Foo') returns a column list +