[Catalyst] Stand-alone Scripts

Glen Diener gdiener at excelii.com
Fri Apr 27 13:25:35 GMT 2012


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. 

This is what I have so far:

use strict;
use warnings;
use Data::Dumper;
use FindBin qw($Bin);
use lib "$Bin/../lib";
use DealerDemoSite::Schema::DemoDB;


my $connect_info_args = [{
        dsn => 'dbi:Pg:dbname=dib',
        user => '...',
        password => '...',
        AutoCommit => q{1},
}];

my $schema = DealerDemoSite::Schema::DemoDB->connect($connect_info_args);
print Dumper($schema);

my $demo = $schema->resultset('DemoDB::DddDemo')->find({demoid => 30024});


I'm getting the following error message:

DBIx::Class::Schema::resultset(): Can't find source for DemoDB::DddDemo at ./maint.pl line 28

Within the Catalyst application I able to use the following successfully:

my $demo = $c->model('DemoDB::ddddemo')->find($demoid);


Thanks for your help. 
- Glen



More information about the Catalyst mailing list