You're trying to assign to a method, which isn't going to work without some deep magic (and even then that's probably not what you want to do). You really want the subref to either be passed as a parameter to the constructor ($parser_name->new( getDBH => \&getDBH )) and/or stored in an attribute ($self->{ 'getDBH_sub' } = \&getDBH) and then the parser instances use that to call the proper routine that way.
Update: So to elaborate, basically each parser class' getDBH routine would look something like this:
sub getDBH { my $self = shift; my $getDBH_ref = $self->{ 'getDBH_sub' }; $getDBH_ref->( ); }
The cake is a lie.
The cake is a lie.
The cake is a lie.
In reply to Re: sub by reference - assigning to an object?
by Fletch
in thread sub by reference - assigning to an object?
by ethrbunny
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |