in reply to Best Practice: How do I pass option parameters to functions?
Just set and read $My_Config::verbose
{ my $verbose; my $script; sub processDir { my $dir = shift @_; my $ret = qx($script $dir); chomp($ret); print qq(Output:"$ret"\n) if $verbose; } }
nothing outside the outer block's scope can access them anymore.
When needed you can also put getter() and setters() subs within this scope to change them dynamically.
But be aware that class attributes are only protected by convention, to make them really private one needs again closures... ;-) (update see also this reply)
HTH! =)
Cheers Rolf
( addicted to the Perl Programming Language)
|
|---|