On 10/25/19 12:19 PM, Morse, Richard E.,MGH wrote:
On Oct 25, 2019, at 12:14 PM, Uri Guttman <u...@stemsystems.com> wrote:

On 10/25/19 12:03 PM, Morse, Richard E.,MGH via Boston-pm wrote:
I haven’t tried this, but according to the documentation for $.
($INPUT_LINE_NUMBER), you should be able to assign a value to this which
Perl will use for reporting:
another idea:

__LINE__ is a compiler generated value of the current line. so you could
do something like this:

print $@, 'error at line: ', __LINE__ ;

i recall something can be done with # comments to also set a line number
but i can't find it in the docs. the __LINE__ thing should be enough.
Maybe I misunderstood — I thought Greg was looking to change the reported
line number of the file he read the code from, not the line number of the
program running the slurped code. __LINE__ would be the right answer for
that, although I don’t know when it was introduced — I have a vague
recollection that it’s more recent…

my understanding (to be corrected by greg) is that an error in evaled perl code reports the line number in that code. he wants the line number of the eval call itself. he can use __LINE__ to get that when he checks the eval for any errors in the slurped in code.

uri

_______________________________________________
Boston-pm mailing list
Boston-pm@pm.org
https://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to