in reply to Re: Re: Re: Allowing user to change module variables
in thread Allowing user to change module variables
If you're going to have subs to return and set values, I like to combine them:
my $oui_lookup; sub oui_lookup { my $newval = shift; # validation, if necessary if ( defined $newval ) { $oui_lookup = $newval; } $oui_lookup; }
If it's exported to your main namespace, you can use it as follows:
my $old_lookup = oui_lookup(); my $new_lookup = oui_lookup( $some_new_val );
Admittedly, having separate subs can be cleaner, so some may object to my way of doing it.
Cheers,
Ovid
Vote for paco!
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
|
|---|