[Catalyst] Stand-alone Scripts

Will Crawford billcrawford1970 at gmail.com
Fri Apr 27 13:35:45 GMT 2012

On 27 April 2012 14:25, Glen Diener <gdiener at excelii.com> wrote:
> I'm new to Catalyst and have nearly completed the development of my first Catalyst web site. I'm needing to implement scripts to do some off-line database processing and would like to use the DBIx model created and implemented for the Catalyst site. I'm sure this must be possible, but, I've not been successful.

Just a suggestion, but we do it like this:

[ your favourite invocation of FindBin or use of $0 or whatever ]
    use Config::JFDI;
    my $config = Config::JFDI->open( name => 'MyApp', path => dirname ($Bin) );
    use MyApp::Schema;
    my $schema = MyApp::Schema->connect(
$config->{'Model::DB'}->{connect_info} );

It's also possible (likely?) that you just can't connect to the
desired DB due to not having the right juju in pg_hba.conf, do check
that you have the right permissions for the user you're logged in as.

More information about the Catalyst mailing list