in reply to enabling OO and non-OO access to the same module using a hash reference
sub method { my $self = $_[0]; # leave it alone for obj/hashref unless( ref( $self ) || !$#_ ) { # else is immed. hash or # list of pairs my %opt = @_; $self = \%opt; } # now $self can be processed as a hashref whichever # of the four calling styles was used }
-M
Free your mind
|
|---|