in reply to Re: Handling errors on perl
in thread Handling errors on perl

Hi
thank you for your answer.

i was able to do the following, and worked very well:

eval { push @tbl, [ @$_ ] for $table->rows };<br> if ($@) {<br> my $error = $@; <br> warn " Custom error type 1 = no problem ";<br> }


this piece of code is inside a perl that is called from another perl so i use "my $error" cause the problem of global $@ and worked as i wanted.
Now the small problem left is the following, the message i receive when the error raise is the following:

Custom error type 1 = no problem  at perl_parse_v3.pl line 88.

i simply would like to avoid "at perl_parse_v3.pl line 88." because i not necessary cause i perfecly know that only one cause can raise the error.
how can that be done?

Replies are listed 'Best First'.
Re^3: Handling errors on perl
by LanX (Saint) on Aug 19, 2018 at 16:44 UTC
    Put a newline \n at the end of your warn text.

    It's described in the second phrase of the documentation.

    "If the last element of LIST does not end in a newline, it appends the same file/line number text as die does."

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice