# set up a schema class using 2 modules that I've written manually (there 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 file 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."
";
}
####
[Wed Aug 23 18:22:49 2006] mgdb.pl: Attempt to free unreferenced scalar: SV 0x1fa7a5c, Perl interpreter: 0x224234 at C:/Perl/site/lib/SQL/Abstract/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::Country" at C:/Information/mgroot/cgi-bin/mgdb.pl line 53.
at C:/Information/mgroot/cgi-bin/mgdb.pl line 53