in reply to Getopt::Long Validation

This wouldn't satisfy many people's dependancy dependancy, but it does me :).

#! perl -slw use strict; use vars qw[ $F $FILE $IP $I $H $HELP ]; $IP ||= $I; $FILE ||= $F; $HELP ||= $H; die <<"USAGE" Usage: $0 [-I[P]=n.n.n.n-n.n.n.n] [[-F[ILE]=]file] USAGE if defined $H or not ( $FILE xor $IP or $FILE=shift() ); $IP = do{ local( *ARGV, $/ ) = [$FILE]; <> } unless $IP; print $IP; __END__ P:\test>junk Usage: P:\test\junk.pl8 [-I[P]=n.n.n.n-n.n.n.n] [[-F[ILE]=]fil +e] P:\test>junk -H Usage: P:\test\junk.pl8 [-I[P]=n.n.n.n-n.n.n.n] [[-F[ILE]=]fil +e] P:\test>junk -HELP Usage: P:\test\junk.pl8 [-I[P]=n.n.n.n-n.n.n.n] [[-F[ILE]=]fil +e] P:\test>junk junk.cfg 10.1.1.1-10.1.1.254 P:\test>junk -FILE=junk.cfg 10.1.1.1-10.1.1.254 P:\test>junk -F=junk.cfg 10.1.1.1-10.1.1.254 P:\test>junk -I=10.1.1.1-10.1.1.254 10.1.1.1-10.1.1.254 P:\test>junk -IP=10.1.1.1-10.1.1.254 10.1.1.1-10.1.1.254 P:\test>junk -IP=10.1.1.1-10.1.1.254 -F=junk.cfg Usage: P:\test\junk.pl8 [-I[P]=n.n.n.n-n.n.n.n] [[-F[ILE]=]fil +e]

And no, I'm not seriously suggesting anyone else should use this, but it does all I need.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
Hooray!