This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: "Too late for -T" could be more descriptive
authorJim Cromie <jcromie@cpan.org>
Wed, 21 Jul 2004 11:21:50 +0000 (05:21 -0600)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Thu, 22 Jul 2004 13:15:12 +0000 (13:15 +0000)
Message-ID: <40FEA62E.2010809@divsol.com>
(with tweaks)

p4raw-id: //depot/perl@23150

perl.c
perl.h
pod/perldebug.pod
pod/perldiag.pod
pod/perlrun.pod

diff --git a/perl.c b/perl.c
index 7eb121e..d818f50 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -3126,9 +3126,8 @@ S_open_script(pTHX_ char *scriptname, bool dosearch, SV *sv)
 #endif /* IAMSUID */
     if (!PL_rsfp) {
        /* PSz 16 Sep 03  Keep neat error message */
-       Perl_croak(aTHX_ "Can't open perl script \"%s\": %s%s\n",
-               CopFILE(PL_curcop), Strerror(errno),
-               ".\nUse -S to search $PATH for it.");
+       Perl_croak(aTHX_ "Can't open perl script \"%s\": %s\n",
+               CopFILE(PL_curcop), Strerror(errno));
     }
 }
 
diff --git a/perl.h b/perl.h
index 9303419..99449e7 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -751,7 +751,7 @@ int usleep(unsigned int);
 #  define MALLOC_CHECK_TAINT(argc,argv,env)
 #endif /* MYMALLOC */
 
-#define TOO_LATE_FOR_(ch,s)    Perl_croak(aTHX_ "Too late for \"-%c\" option%s", (char)(ch), s)
+#define TOO_LATE_FOR_(ch,s)    Perl_croak(aTHX_ "\"-%c\" is on the #! line, it must also be used on the command line", (char)(ch), s)
 #define TOO_LATE_FOR(ch)       TOO_LATE_FOR_(ch, "")
 #define MALLOC_TOO_LATE_FOR(ch)        TOO_LATE_FOR_(ch, " with $ENV{PERL_MALLOC_OPT}")
 #define MALLOC_CHECK_TAINT2(argc,argv) MALLOC_CHECK_TAINT(argc,argv,NULL)
index e44eaaf..6934652 100644 (file)
@@ -1014,6 +1014,12 @@ L<Dumpvalue>,
 and
 L<perlrun>.
 
+When debugging a script that uses #! and is thus normally found in
+$PATH, the -S option causes perl to search $PATH for it, so you don't
+have to type the path or `which $scriptname`.
+
+  $ perl -Sd foo.pl
+
 =head1 BUGS
 
 You cannot get stack frame information or in any fashion debug functions
index 2df7724..999f289 100644 (file)
@@ -934,6 +934,10 @@ for stdout.
 
 (F) The script you specified can't be opened for the indicated reason.
 
+If you're debugging a script that uses #!, and normally relies on the
+shell's $PATH search, the -S option causes perl to do that search, so
+you don't have to type the path or C<`which $scriptname`>.
+
 =item Can't read CRTL environ
 
 (S) A warning peculiar to VMS.  Perl tried to read an element of %ENV
@@ -3690,6 +3694,22 @@ before now.  Check your control flow.
 (F) Perl can't peek at the stdio buffer of filehandles when it doesn't
 know about your kind of stdio.  You'll have to use a filename instead.
 
+=item "-T" is on the #! line, it must also be used on the command line
+
+(X) The #! line (or local equivalent) in a Perl script contains the
+B<-T> option, but Perl was not invoked with B<-T> in its command line.
+This is an error because, by the time Perl discovers a B<-T> in a
+script, it's too late to properly taint everything from the environment.
+So Perl gives up.
+
+If the Perl script is being executed as a command using the #!
+mechanism (or its local equivalent), this error can usually be fixed by
+editing the #! line so that the B<-T> option is a part of Perl's first
+argument: e.g. change C<perl -n -T> to C<perl -T -n>.
+
+If the Perl script is being executed as C<perl scriptname>, then the
+B<-T> option must appear on the command line: C<perl -T scriptname>.
+
 =item Target of goto is too deeply nested
 
 (F) You tried to use C<goto> to reach a label that was too deeply nested
@@ -3783,22 +3803,6 @@ system call to call, silly dilly.
 B<-M> or B<-m> option.  This is an error because B<-M> and B<-m> options
 are not intended for use inside scripts.  Use the C<use> pragma instead.
 
-=item Too late for "B<-T>" option
-
-(X) The #! line (or local equivalent) in a Perl script contains the
-B<-T> option, but Perl was not invoked with B<-T> in its command line.
-This is an error because, by the time Perl discovers a B<-T> in a
-script, it's too late to properly taint everything from the environment.
-So Perl gives up.
-
-If the Perl script is being executed as a command using the #!
-mechanism (or its local equivalent), this error can usually be fixed by
-editing the #! line so that the B<-T> option is a part of Perl's first
-argument: e.g. change C<perl -n -T> to C<perl -T -n>.
-
-If the Perl script is being executed as C<perl scriptname>, then the
-B<-T> option must appear on the command line: C<perl -T scriptname>.
-
 =item Too late to run %s block
 
 (W void) A CHECK or INIT block is being defined during run time proper,
index d40abb8..e730530 100644 (file)
@@ -733,9 +733,12 @@ original name fails, and if the name does not already end in one
 of those suffixes.  If your Perl was compiled with DEBUGGING turned
 on, using the -Dp switch to Perl shows how the search progresses.
 
-Typically this is used to emulate #! startup on platforms that
-don't support #!.  This example works on many platforms that
-have a shell compatible with Bourne shell:
+Typically this is used to emulate #! startup on platforms that don't
+support #!.  Its also convenient when debugging a script that uses #!,
+and is thus normally found by the shell's $PATH search mechanism.
+
+This example works on many platforms that have a shell compatible with
+Bourne shell:
 
     #!/usr/bin/perl
     eval 'exec /usr/bin/perl -wS $0 ${1+"$@"}'