in reply to
Retrieving Error Messages
The document says that, the error function, if it is used in a scalar context, which is the case you have now, it returns the latest error, if it is
set
. So it can return undef.
Just do this:
print "Message is $msg\n" if $msg;
[download]
Comment on
Re: Retrieving Error Messages
Download
Code
Replies are listed 'Best First'.
Re: Re: Retrieving Error Messages
by
pg
(Canon)
on Nov 18, 2002 at 18:54 UTC
Add one point, it should be a universal principle to check undef
ALL
the time, if you want robust code, not just for this Simran::Log::Log thing.
[reply]
In Section
Seekers of Perl Wisdom