This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
If /dev/null is not readable, perl -e fails with
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Thu, 13 Oct 2005 15:53:39 +0000 (15:53 +0000)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Thu, 13 Oct 2005 15:53:39 +0000 (15:53 +0000)
an obscure error message. Make it more understandable.

p4raw-id: //depot/perl@25753

perl.c

diff --git a/perl.c b/perl.c
index a1667c8..42f32fe 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -3607,8 +3607,11 @@ S_open_script(pTHX_ const 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\n",
-               CopFILE(PL_curcop), Strerror(errno));
+       if (PL_e_script)
+           Perl_croak(aTHX_ "Can't open "BIT_BUCKET": %s\n", Strerror(errno));
+       else
+           Perl_croak(aTHX_ "Can't open perl script \"%s\": %s\n",
+                   CopFILE(PL_curcop), Strerror(errno));
     }
 }