>>>>> ""Oleg" == "Oleg V Volkov" <[EMAIL PROTECTED]> writes:

"Oleg> I'm using a simple Getopt::* / Alias::attr like function to parse
"Oleg> named parameters from hash and assign them to localized variables
"Oleg> to save me some dereferencing inside heavy loops, but declaring
"Oleg> parameters two times - first as "our" variables and then once again
"Oleg> as a list for this function to check against, so it can catch
"Oleg> errors in list looks kinda ineffective to me.

I simply declare the variable and its default value directly
in GetOptions:

    GetOptions(
               "lhost=s" => \ (my $LOCALHOST = "localhost:0"),
               "rhost=s" => \ (my $REMOTEHOST = "localhost:smtp"),
               "connect=s" => \ (my $CONNECT),
               "timeout=i" => \ (my $TIMEOUT = 30),
               "quiet+" => \ (my $QUIET = 0),
               "verbose+" => \ (my $VERBOSE = 0),
               "<>" => sub { $Getopt::Long::error++; warn "Unknown arg: 
$_[0]\n" },
               ) or die "see code for usage\n";

print "Just another Perl hacker,"; # the original

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to