in reply to Passing a reference to a subroutine in a constructor
You actually pass the CODEREF into the constuctor, instead of using a soft reference.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 18:48 UTC | |
by dragonchild (Archbishop) on Aug 22, 2003 at 20:11 UTC | |
by DrSax (Sexton) on Aug 22, 2003 at 20:24 UTC |