OK.. so I have this Class::DBIx schema that I've assembled using dbicdump and one of the tables I dumped is called "planet" in the database itself.

If I look in the result set directory I find all the tables represented there including planet.

use MooseX::MarkAsMethods autoclean => 1; extends 'DBIx::Class::Core'; __PACKAGE__->load_components("Schema::Versioned"); __PACKAGE__->table("planet"); __PACKAGE__->add_columns( "planet_id", { data_type => "integer", extra => { unsigned => 1 }, is_auto_increment => 1, is_nullable => 0, }, "starport", { data_type => "integer", default_value => 1, is_nullable => 0 }, "diameter", { data_type => "integer", default_value => 0, is_nullable => 0 }, "atmosphere", { data_type => "integer", default_value => 0, is_nullable => 0 }, "population", { data_type => "integer", default_value => 0, is_nullable => 0 }, "government", { data_type => "integer", default_value => 0, is_nullable => 0 }, "lawlevel", { data_type => "integer", default_value => 0, is_nullable => 0 }, "starorbit", { data_type => "integer", extra => { unsigned => 1 }, is_foreign_key => 1, is_nullable => 0, }, ); __PACKAGE__->belongs_to( "starorbit", "RPG::Traveller::DBIx::Starmap::Schema::Result::Starorbit", { starorbit_id => "starorbit" }, { is_deferrable => 1, on_delete => "RESTRICT", on_update => "RESTRIC +T" }, ); __PACKAGE__->set_primary_key("planet_id"); __PACKAGE__->meta->make_immutable;
(I excised out the embedded POD)

So.. why when I run a test against this (or write code against it it can't be found in the schema?

For those curious here's my test (very simple):

use Test::More tests => 1; { use RPG::Traveller::DBIx::Schema; my $db = RPG::Traveller::DBIx::Schema->connect( 'dbi:mysql:hostname=localhost:database=starmapper', 'starmapper', 'secretsquirrel' ); # not the real creds above... $db->resultset('Planet'); }

Test bombs with:

t/10-planet.t ............. Can't find source for Planet at /usr/lib/p +erl5/site_perl/5.14/DBIx/Class/Schema.pm line 1101. DBIx::Class::Schema::throw_exception('RPG::Traveller::DBIx::Sc +hema=HASH(0x2006c030)', 'Can\'t find source for Planet') called at /u +sr/lib/perl5/site_perl/5.14/DBIx/Class/Schema.pm line 599 DBIx::Class::Schema::source('RPG::Traveller::DBIx::Schema=HASH +(0x2006c030)', 'Planet') called at /usr/lib/perl5/site_perl/5.14/DBIx +/Class/Schema.pm line 550 DBIx::Class::Schema::resultset('RPG::Traveller::DBIx::Schema=H +ASH(0x2006c030)', 'Planet') called at t/10-planet.t line 8


Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg

In reply to Class::DBIx is driving me to drink! by blue_cowdawg

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.