Perl Line Numbers 
Author Message
 Perl Line Numbers

Hi all!

I'm looking for a way to add to an error subroutine the ability
to print the line number that an error occured at.  For example,
if I run an external program like `prog`, and then check the
return code variable $?, I'd like to exit if there was an
error and also print to a log file the line number of the Perl
script where the error occured.  The script we use have quite a
number of external program calls, and we'd like to know where it
blows up.

Any suggestions would be appreciated, and thanks in advance.

Mark Griffith
Mosby MIS

--
Mark



Tue, 22 Apr 1997 23:38:18 GMT  
 Perl Line Numbers

:Hi all!
:
:I'm looking for a way to add to an error subroutine the ability
:to print the line number that an error occured at.  For example,
:if I run an external program like `prog`, and then check the
:return code variable $?, I'd like to exit if there was an
:error and also print to a log file the line number of the Perl
:script where the error occured.  The script we use have quite a
:number of external program calls, and we'd like to know where it
:blows up.
:
:Any suggestions would be appreciated, and thanks in advance.

look at the docs on

    __LINE__
    __FILE__
    caller
    die
    warn
    (In the Carp module) carp, croak, confess

--tom

--

    "That's okay.  Anyone whose opinion he cares about already knows that
    he doesn't care about their opinion."
        --Larry Wall



Thu, 24 Apr 1997 11:20:57 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Perl line numbers vs Apache error_log reported numbers?

2. Randomly selecting lines by line number

3. displaying lines with a specific number of lines on each page

4. Searching a WORD 6 DOC by line line number

5. getting line number from perl interpreter?

6. Perl bug? Wrong line number given in $@

7. perl script to number lines in files

8. line number directives in perl?

9. line number indication in Perl

10. perl 5.002 warning message prints wrong line number?

11. AutoSplit gets line numbers wrong?

12. Line number in XML::Parser

 

 
Powered by phpBB® Forum Software