[Dbix-class] source_name immutable in latest dev release

Tobias Kremer list at funkreich.de
Fri Jun 1 12:13:35 GMT 2007


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!

--Tobias



More information about the Dbix-class mailing list