Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: (jeffa) Re: vandale.pl (with Getopt::Declare)

by danger (Priest)
on Mar 30, 2002 at 21:51 UTC ( [id://155503]=note: print w/replies, xml ) Need Help??


in reply to (jeffa) Re: vandale.pl (with Getopt::Declare)
in thread vandale.pl

In the interest of tmtowtdi, here's an alternate Getopt::Declare scenario that sets up the $all and @words variables in action blocks. Here I decided to make the search words required (but without option description), and just allow for -a as an abbrev. of -all (instead of using the --all version):

#!/usr/bin/perl -w use strict; use LWP::UserAgent; use Getopt::Declare; use vars qw/$all @words/; my $opts = Getopt::Declare->new(<<'EOS'); -a[ll] List all matches {$all = 1} <terms:s>... [required] {@words = @terms} EOS for my $word (@words) { # insert fetch code ... # ... last unless $all; } __END__

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://155503]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (8)
As of 2024-04-25 11:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found