On Tue, Jun 09, 2009 at 11:29:53AM +1000, Toby Corkindale wrote: > Matt S Trout wrote: > >On Wed, Jun 03, 2009 at 06:14:13PM +1000, Toby Corkindale wrote: > >>Hi guys, > >>I've encountered a regression in DBIC, introduced in revision 5298. > >>It's more than likely that the way things were being done in the code > >>here were not correct and *shouldn't* have worked previously, but I > >>can't seem to work it out myself. > >> > >>There's a single changed line which triggers the problem: > >>-------------------------------------------------------- > >>diff --git a/lib/DBIx/Class/Schema.pm b/lib/DBIx/Class/Schema.pm > >>@@ -1228,7 +1229,7 @@ sub register_extra_source { > >> sub _register_source { > >> my ($self, $moniker, $source, $params) = @_; > >> > >>- %$source = %{ $source->new( { %$source, source_name => $moniker }) }; > >>+ $source = $source->new({ %$source, source_name => $moniker }); > > > >Yeah, that's a bugfix. > > > >Basically, you can't add relationships after the fact - if you can't set up > >your relationships before the source is registered with the schema then > >you'll need to re-register it afterwards. > > > >Slightly annoying side effect of the prototype inheritance style DBIC uses > >for schema and sources - I'm aware it's a tad annoying but things break > >subtly without it. > > Is the correct way to re-register it this? > > My::Schema->register_extra_source( > Users => My::Schema->class('Users')->new->result_source_instance > ); > > (That seems to work at least.. trying to do register_class/source() > again causes an error about it already existing)
ITYM warning, and since you're doing something weird you probably -do- want to overwrite. Possibly what we need is a patch to allow a "yes, I meant to do this" option to squelch the warning ... -- Matt S Trout Catalyst and DBIx::Class consultancy with a clue Technical Director and a commit bit: http://shadowcat.co.uk/catalyst/ Shadowcat Systems Limited mst (@) shadowcat.co.uk http://shadowcat.co.uk/blog/matt-s-trout/ _______________________________________________ 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/dbix-class@lists.scsys.co.uk