Emmanuel Quevillon wrote on 2009-08-21:
> sub connection {
>
> my ($self, @rest) = @_;
> $self->next::method(@rest);
>
> $self->driver_name($self->handler()->{Driver}->{Name});
>
> }
> # You can replace this text with custom content, and it will be
> preserved on regeneration
>
> 1;
>
Hey Emmanuel,
connection() must return the schema object (which will be returned by
$self->next::method(@rest)). In this case it will actually return the driver
name string instead, which explains why the interpreter chokes when it tries to
call the resultset() method on a string, as in your error below.
> my $schema =
> Schema::MyAppDB->connect('dib:Pg:dbname=test','test','pass'); my $a =
> $schema->resultset("Public"); ....
>
>
> I get the following error
>
> Can't locate object method "resultset" via package "Pg" (perhaps you
> forgot to load "Pg"?) at ./test.pl line 7.
The Catalyst cookbook section is incorrect - it would be great for you to
supply a doc patch to the catalyst list so other people don't run into this as
well.
Byron
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]