[Pdx-pm] DBIC "Can't find source" error

Robert Buels rmb32 at cornell.edu
Wed Apr 21 17:11:10 PDT 2010


I don't get that error using that code.

Are all your modules in different files?  load_namespaces is actually 
based on .pm files on disk, not just package names.

Rob

Joshua Keroes wrote:
> I'm trying to put last week's DBIC lecture to use and have most of the 
> obvious stuff done. I'm getting hung up by the error message: 
> "DBIx::Class::Schema::resultset(): Can't find source for Interface at 
> ...". For the record, dbicadmin will generate the same error message 
> (but still generate SQL.)
> 
> There are two tables: ECCKT and interface. An ECCKT is a circuit ID. 
> Each ECCKT can have many interfaces.
> 
> I'm not finding much about fixing this particular error and the DBIC 
> source code is a little dry for me to see how it relates.
> 
> Ideas?
> 
> Thanks,
> Joshua
> 
> Source code from one script and three modules:
> 
> ---------
> 
> # This is the program that uses the DBIC schema:
> 
> use Integra::UBI::Schema;
> 
> my $schema = Integra::UBI::Schema->connect( ...redacted...);
> my $row = $schema->resultset('ECCKT')->create({
>    'ecckt'        => 'ABCD0123456ABCDEF',
>    'customer'     => 'John Johnsonson',
>    'end'          => 1269644794,
>    'interface'    => 'GigabitEthernet10/1',
>    'last_updated' => 1269644794,
>    'router'       => 'ar11.slkcutxd.example.com 
> <http://ar11.slkcutxd.example.com>',
>    'speed'        => 1000000000,
>    'start'        => 1265958902,
>    'state'        => 'active',
> });
> $row->update;
> 
> ---------
> 
> package Integra::UBI::Schema;
> use base qw/DBIx::Class::Schema/;
> 
> our $VERSION = '0.01';
> 
> __PACKAGE__->load_namespaces();
> __PACKAGE__->load_components(qw/Schema::Versioned/);
> 
> ---------
> 
> package Integra::UBI::Schema::Result::ECCKT;
> use base qw/DBIx::Class::Core/;
> 
> __PACKAGE__->table('ecckt');
> __PACKAGE__->add_columns(
>      ecckt_id => {
>         data_type         => 'integer',
>         size              => 8,
>         is_nullable       => 0,
>         is_auto_increment => 1,
>     },
>     ecckt => {
>         data_type         => 'varchar',
>         size              => 64,
>         is_nullable       => 0,
>     },
>     if_id => {
>         data_type         => 'integer',
>         size              => 8,
>         is_nullable       => 0,
>         is_foreign_key    => 1,
>     }
> );
> __PACKAGE__->set_primary_key('ecckt_id');
> __PACKAGE__->has_many('interfaces', 
> 'Integra::UBI::Schema::Result::Interface', 'if_id');
> 
> ---------
> 
> package Integra::UBI::Schema::Result::Interface;
> use base qw/DBIx::Class::Core/;
> 
> __PACKAGE__->table('interface');
> __PACKAGE__->add_columns( 
>      if_id => {
>         data_type         => 'integer',
>         is_nullable       => 0,
>         is_auto_increment => 1,
>     },
>     customer => {
>         data_type         => 'varchar',
>         size              => 256,
>         is_nullable       => 1,
>         default_value     => '',
>     },
>     state => {
>         data_type         => 'varchar',
>         size              => 12,
>         is_nullable       => 1,
>     },
>     router => {
>         data_type         => 'varchar',
>         size              => 128,
>     },
>     interface => {
>         data_type         => 'varchar',
>         size              => 128,
>     },
>     speed => {
>         data_type         => 'integer',
>         is_nullable       => 1,
>     },
>     start => {
>         data_type         => 'integer',
>         is_nullable       => 1,
>     },
>     end => {
>         data_type         => 'integer',
>         is_nullable       => 1,
>     },
>     last_updated => {
>         data_type         => 'integer',
>         is_nullable       => 1,
>     },
>     valid_router => {
>         data_type         => 'tinyint',
>         is_nullable       => 1,
>     },
>     valid_it => {
>         data_type         => 'tinyint',
>         is_nullable       => 1,
>     },
>     ecckt_id => {
>         data_type         => 'integer',
>         is_nullable       => 0,
>         is_foreign_key    => 1,
>     },
> );
> __PACKAGE__->set_primary_key('if_id');
> __PACKAGE__->belongs_to('ecckt', 'Integra::UBI::Schema::Result::ECCKT', 
> 'ecckt_id');
> 
> __END__
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Pdx-pm-list mailing list
> Pdx-pm-list at pm.org
> http://mail.pm.org/mailman/listinfo/pdx-pm-list



More information about the Pdx-pm-list mailing list