develooper Front page | perl.perl5.porters | Postings from August 2001

Re: [ID 20010829.008] Erroneous line numbers reported with '#line' in 'eval'

Thread Previous | Thread Next
From:
Ronald J Kimball
Date:
August 29, 2001 18:19
Subject:
Re: [ID 20010829.008] Erroneous line numbers reported with '#line' in 'eval'
Message ID:
20010829211918.A111766@linguist.thayer.dartmouth.edu
On Thu, Aug 30, 2001 at 12:18:57AM -0000, mjd@plover.com wrote:

>         perl -le 'eval "#line 12 xyz\n1/0;"; print $@'
>         Illegal division by zero at xyz line 12.
> 
> This is correct.
> 
>         perl -le 'eval "#line 12 xyz\n1/0"; print $@'
>         Illegal division by zero at xyz line 13.
> 
> This  wrong. It should report the error at line 12, not at
> line 13.
> 

This issue is independent of eval:

perl -le '#line 12 xyz' -e '1/0' -e '' -e '' -e '' -e ''
Illegal division by zero at xyz line 16.

Apparently perl reports the error occuring on the line where the statement
ends.

(Tested with 5.005_03.)

Ronald


Thread Previous | 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