This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #78082] Carp.pm: Avoid autovivification of CORE::GLOBAL::caller
[perl5.git] / lib / getopt.pl
index be393c4..1d4008a 100644 (file)
@@ -1,3 +1,5 @@
+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";
+
 ;# $RCSfile: getopt.pl,v $$Revision: 4.1 $$Date: 92/08/07 18:23:58 $
 #
 # This library is no longer being maintained, and is included for backward
 #
 # Suggested alternatives: Getopt::Long or Getopt::Std
 
-warn( "The 'getopt.pl' legacy library is deprecated and will be"
-      . " removed in the next major release of perl. Please use the"
-      . " Getopt::Long or Getopt::Std modules instead." );
-
 ;# Process single-character switches with switch clustering.  Pass one argument
 ;# which is a string containing all switches that take an argument.  For each
 ;# switch found, sets $opt_x (where x is the switch name) to the value of the
@@ -26,11 +24,10 @@ warn( "The 'getopt.pl' legacy library is deprecated and will be"
 sub Getopt {
     local($argumentative) = @_;
     local($_,$first,$rest);
-    local($[) = 0;
 
     while (@ARGV && ($_ = $ARGV[0]) =~ /^-(.)(.*)/) {
        ($first,$rest) = ($1,$2);
-       if (index($argumentative,$first) >= $[) {
+       if (index($argumentative,$first) >= 0) {
            if ($rest ne '') {
                shift(@ARGV);
            }