1 warn "Legacy library @{[(caller(0))[6]]} will be removed from the Perl core distribution in the next major release. Please install it from the CPAN distribution Perl4::CoreLibs. It is being used at @{[(caller)[1]]}, line @{[(caller)[2]]}.\n";
3 ;# getopts.pl - a better getopt.pl
5 # This library is no longer being maintained, and is included for backward
6 # compatibility with Perl 4 programs which may require it.
8 # In particular, this should not be used as an example of modern Perl
9 # programming techniques.
11 # Suggested alternatives: Getopt::Long or Getopt::Std
14 ;# do Getopts('a:bc'); # -a takes arg. -b & -c not. Sets opt_* as a
18 local($argumentative) = @_;
19 local(@args,$_,$first,$rest);
22 @args = split( / */, $argumentative );
23 while(@ARGV && ($_ = $ARGV[0]) =~ /^-(.)(.*)/) {
24 ($first,$rest) = ($1,$2);
25 $pos = index($argumentative,$first);
27 if($args[$pos+1] eq ':') {
30 ++$errs unless(@ARGV);
34 push(\@opt_$first, \$rest);
35 if (!defined \$opt_$first or \$opt_$first eq '') {
36 \$opt_$first = \$rest;
39 \$opt_$first .= ' ' . \$rest;
44 eval "\$opt_$first = 1";
54 print STDERR "Unknown option: $first\n";