develooper Front page | perl.perl5.porters | Postings from February 2003

perl -x and line numbers / patch

Thread Next
From:
Enache Adrian
Date:
February 27, 2003 17:33
Subject:
perl -x and line numbers / patch
Message ID:
20030228013452.GB906@ratsnest.hole
perl -x counts line numbers starting from the '#! .. perl ..' line.
This badly confuses my editor. I think Perl should use the real
line numbers.

example:
$ perl patchlevel.h
Usage: perl -x patchlevel.h comment ... at patchlevel.h line 2.

That is line 84, not line 2 of patchlevel.h.

Regards
Adi

-------------------------------------------------------------------
--- /arc/perl-current/perl.c	2003-02-24 23:13:57.000000000 +0200
+++ perl.c	2003-02-28 00:37:34.000000000 +0200
@@ -3184,9 +3184,6 @@ STATIC void
 S_find_beginning(pTHX)
 {
     register char *s, *s2;
-#ifdef MACOS_TRADITIONAL
-    int maclines = 0;
-#endif
 
     /* skip forward in input to the real script? */
 
@@ -3217,7 +3214,6 @@ S_find_beginning(pTHX)
 #endif
 	s2 = s;
 	if (*s == '#' && s[1] == '!' && ((s = instr(s,"perl")) || (s = instr(s2,"PERL")))) {
-	    PerlIO_ungetc(PL_rsfp, '\n');		/* to keep line count right */
 	    PL_doextract = FALSE;
 	    while (*s && !(isSPACE (*s) || *s == '#')) s++;
 	    s2 = s;
@@ -3229,21 +3225,8 @@ S_find_beginning(pTHX)
 		    while ((s = moreswitches(s)))
 			;
 	    }
-#ifdef MACOS_TRADITIONAL
-	    /* We are always searching for the #!perl line in MacPerl,
-	     * so if we find it, still keep the line count correct
-	     * by counting lines we already skipped over
-	     */
-	    for (; maclines > 0 ; maclines--)
-		PerlIO_ungetc(PL_rsfp, '\n');
-
-	    break;
-
-	/* gMacPerl_AlwaysExtract is false in MPW tool */
-	} else if (gMacPerl_AlwaysExtract) {
-	    ++maclines;
-#endif
 	}
+	CopLINE_inc(PL_curcop);
     }
 }
 

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About