As to my knowledge, this should work (notice the slash - backslash difference).my $collection = Collection->new({ 'sorter' => \&Sort::mysorter }); sub new { my ($self, $options) = @_; . . . $self->{sorter} = $options->{sorter}; }
In reply to Re: Passing a reference to a subroutine in a constructor
by CombatSquirrel
in thread Passing a reference to a subroutine in a constructor
by DrSax
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |