Hello learned Bretheren,

I have managed to get DBIx::Class working using mysql. Here's my code:

# set up a schema class using 2 modules that I've written manually (th +ere are more tables; this is just to make sure it works). use MG::Schema::Tables; # * use MG::Schema::Country; # * my $schema = MG::Schema->connect('DBI:mysql:mg', 'jfrm', '???'); #* # Or better, fill the class with table info automatically (using a fil +e called MG/Main.pm with content: #package MG::Main; #use base qw/DBIx::Class::Schema::Loader/; #__PACKAGE__->loader_options( # relationships => 1); #use MG::Main; #& #my $schema = MG::Main->connect('DBI:mysql:mg', 'jfrm', '????'); #& # Query for all countries and put them in an array, my @all_countries = $schema->resultset('Country')->all; # Create a result set to search for countries. foreach my $country (@all_countries) { print "! ".$country->CountryCode." = ".$country->CountryName."<Br> +"; }

So then I want to change to not have to write all the schemas out manually into modules by using the Schema::Loader module. So I comment out the 3 lines labelled #* and uncomment the 2 lines with #&. Here's the error:

[Wed Aug 23 18:22:49 2006] mgdb.pl: Attempt to free unreferenced scala +r: SV 0x1fa7a5c, Perl interpreter: 0x224234 at C:/Perl/site/lib/SQL/A +bstract/Limit.pm line 325. [Wed Aug 23 18:22:49 2006] mgdb.pl: at C:/Perl/site/lib/SQL/Abstract/ +Limit.pm line 325 Software error: Can't locate object method "CountryCode" via package "MG::Main::Countr +y" at C:/Information/mgroot/cgi-bin/mgdb.pl line 53. at C:/Information/mgroot/cgi-bin/mgdb.pl line 53

So my humble question for meditation is: Is this because I'm doing something wrong due to my very poor understanding of object methods? Or is it a bug in this Abstract::Limit module (in which case I'll do my best to put in a bug report if i can work out how)?

thanks for any advice.


In reply to DBIx::Class::Schema::Loader prob by jfrm

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.