[Dbix-class] [DBIx::Class] problems after update of Loader to 03003

Daniel McBrearty danielmcbrearty at gmail.com
Fri Jun 30 22:35:13 CEST 2006


Thanks. That was it. It is clearly stated in the perldoc, silly me.

Maybe the class could emit a slightly better error message though?
would a bug report be amiss?

But how do I now call on_connect_do?

my $mysql = My::Schema->connect( ... );
$mysql->storage->on_connect_do(["SET NAMES 'utf8'"]);

doesn't cut it, no surprise, as I expect to tell it this before
connecting. I tried it in loader options, and as options in the
connect call itself, no avail ... ?

On 6/30/06, Matt S Trout <dbix-class at trout.me.uk> wrote:
> Daniel McBrearty wrote:
> > hi
> >
> > few probs since updating this module :
> >
> > 1. I used to use load_from_connection in Schema.pm ... now I get a
> > warning, it's deprecated. OK, so I change to the new way ... :
> >
> > my $schema = My::Schema->connect( .... );
> >
> > and I get an error:
> >
> > Can't use an undefined value as a HASH reference at
> > /usr/local/share/perl/5.8.7/DBIx/Class/Schema/Loader.pm line 154.
> >
> > doesn't mean much to me. any clues what could cause this?
> >
> > (The relevant source in Loader is:
> >
> > sub clone {
> >     my $self = shift;
> >
> >     my $clone = $self->next::method(@_);
> >
> >     $clone->_loader_args($self->_loader_args);
> >     $clone->_loader_args->{schema} = $clone;
> >     weaken($clone->_loader_args->{schema});
> >
> >     $clone;
> > }
> >
> > to save you looking ... )
> >
> > 2. if I go back to load_from_connection and ignore the warning,
> > classes load OK, as before. BUT it seems as if in my old code:
> >
> > my $schema = "My::Schema";
> > $schema->storage->on_connect_do(["SET NAMES 'utf8'"]);
> >
> > it now looks as if the "set names utf8" is not happening (I get some
> > utf8 errors later). This was definitely OK before the update.
>
> Did you set the loader options first? If you didn't that may be why
> _loader_args is undefined.
>
> --
>       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/ +
>
> _______________________________________________
> List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
> Wiki: http://dbix-class.shadowcatsystems.co.uk/
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
> Searchable Archive: http://www.mail-archive.com/dbix-class@lists.rawmode.org/
>


-- 
Daniel McBrearty
email : danielmcbrearty at gmail.com
www.engoi.com : the multi - language vocab trainer
BTW : 0873928131



More information about the Dbix-class mailing list