in reply to Passing a reference to a subroutine in a constructor
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}; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Passing a reference to a subroutine in a constructor
by DrSax (Sexton) on Aug 22, 2003 at 19:04 UTC | |
by bobn (Chaplain) on Aug 23, 2003 at 02:38 UTC |