On Fri, Jun 01, 2007 at 01:13:35PM +0200, Tobias Kremer wrote:
> After installing the latest dev release 0.07999_02 I can't modify the
> source_name attribute anymore ("cannot alter the value of 'source_name'
> on objects of class 'DBIx::Class::ResultSource'"). This breaks the
> result_source_instance trick to inject arbitrary SQL. Is this intended
> and if yes, how can I work around this?
>
> Here's what I'm doing:
>
> ----
>
> my $source = MyApp::Schema::User->result_source_instance();
> my $my_source = $source->new( $source );
>
> @MyApp::Schema::UserView::ISA = ('MyApp::Schema::User');
> $source_new->result_class( 'MyApp::Schema::UserView' );
>
> $my_source->source_name( 'UserCustomSQL' ); # BOOM!
> $my_source->name( \"($sql)" );
>
> MyApp::Schema->register_source( 'MyApp::Schema::UserCustom' => $my_source );
>
> ----
>
> For now, I just removed the ->source_name( ... ) line and everything seems
> to work just like before. Is this safe? Thanks!
No, very very not safe.
Try ->new({ %$source, source_name => 'UserCustomSQL' }) for a workaround and
we'll aim for a proper fix for 05
--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director Want a managed development or deployment platform?
Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.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/[email protected]/