[Catalyst] basics of getting started with DBIx

Daniel McBrearty danielmcbrearty at gmail.com
Sat Mar 18 20:53:27 CET 2006


Matt, Michelle, thanks! Won't get to try it again for a day or two, but that
should fix a few things.


On 3/18/06, Matt S Trout <dbix-class at trout.me.uk> wrote:
>
> Daniel McBrearty wrote:
> > Hi people
> >
> > Just trying to put together a test script to explore this package, but a
> > bit stuck with the basics ... I have a class Schema.pm
> > <http://Schema.pm> in my library:
> >
> > package Schema;
> > use base qw/DBIx::Class::Schema/;
> > __PACKAGE__->load_classes(qw/ Translator /);
> > 1;
> >
> > then a subdir Schema containing Translator.pm <http://Translator.pm>
> >
> > #package Translator;
>
> package Schema::Translator;
>
> > use base qw/DBIx::Class/;
>
> __PACKAGE__->load_components(qw/Core/);
>
> > __PACKAGE__->table('translators');
> > __PACKAGE__->add_columns(qw/ name autotx lastcat lang email translations
> > lastuse /);
> > __PACKAGE__->set_primary_key('name');
> > 1;
> >
> > and here's my code ...
> >
> > use Voc::DB::Schema;
> > use Voc::Config;
> > use Data::Dumper;
> >
> > my $dsn = $Config::cfg->{'sqldb'};
> > my $u = $Config::cfg->{'sqluser'};
> > my $p = $Config::cfg->{'sqlpass'};
> > my $attrs; # what should/can this be?
>
>      # Whatever you'd pass to DBI->connect - AutoCommit, RaiseError etc.
>
> > #Voc::DB::Schema->connect($dsn, $u, $p, $attrs);
>
> my $schema = Voc::DB::Schema->connect($dsn, $u, $p, $attrs);
>
> > now when I run I get :
> >
> > Can't locate object method "result_source_instance" via package
> > "Schema::Translator" (perhaps you forgot to load "Schema::Translator"?)
> > at /usr/local/share/perl/5.8.7/DBIx/Class/Schema.pm line 70.
> >
> > Seems the load isn't working? Why? Is my layout of files and modules
> > correct?
>
> Corrections inline above :)
>
> --
>       Matt S Trout       Offering custom development, consultancy and
> support
>    Technical Director    contracts for Catalyst, DBIx::Class and BAST.
> Contact
> Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more
> information
>
> + Help us build a better perl ORM:
> http://dbix-class.shadowcatsystems.co.uk/ +
>
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst
>



--
Daniel McBrearty
email : danielmcbrearty at gmail.com
www.engoi.com : the multi - language vocab trainer
BTW : 0873928131
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/catalyst/attachments/20060318/4e38e297/attachment.htm 


More information about the Catalyst mailing list