jfrm has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: DBIx::Class::Schema::Loader prob
by jesuashok (Curate) on Aug 24, 2006 at 09:59 UTC | |
by jfrm (Monk) on Aug 24, 2006 at 13:02 UTC | |
by jfrm (Monk) on Sep 06, 2006 at 13:36 UTC | |
by jfrm (Monk) on Aug 24, 2006 at 13:10 UTC | |
by insaniac (Friar) on Aug 24, 2006 at 20:44 UTC | |
by jfrm (Monk) on Aug 24, 2006 at 10:33 UTC | |
|
Back to
Seekers of Perl Wisdom