TStanley has asked for the wisdom of the Perl Monks concerning the following question:
This generates a “use of an unitialized value in concatenation error” at line 25, which is the last line of the script. This is the snippet from the POD for the Simran::Log::Log module.#!/opt/perl5/bin/perl -w use strict; use Simran::Log::Log; use Simran::Error::Error; my $x=5;my $y=4; my $logfile="/home/tstanley/Logfile"; my $syslogger=Simran::Log::Log->new($logfile); my $errlogger=Simran::Error::Error->new(); $errlogger->clear(); if($y<$x){ $errlogger->set("Y is smaller than X"); $syslogger->write("Y is smaller than X"); } my @ERR=$errlogger->msg(); my $ERRMSG=$errlogger->msg(); print "Error is: @ERR\n"; print "Error is: $ERRMSG\n"; my $msg=$syslogger->error(); print "Message is $msg\n";
The code for the above subroutine in the Log module is:Error Description If called in an array context, returns the complete history of err +or messages thus far. Else, returns the latest error message if set. $errmsg = $session->error(); or foreach($session->error()){ print “Error: $_\n”; }
where $error is the variable for a Simran::Error::Error object. Now the msg subroutine in the Error module is as follows:sub error { my $self = shift; return $error->msg(); }
Any suggestions as to why I’m banging my head into a wall would be welcomed. I will probably submit a patch to the author of these modules or outright ask if I can take them over (the last update was 26 April 2000, which is also the release date for both of them.)sub msg { my $self = shift; if (wantarray) { return @{$self->{"HISTORY"}}; } return $self->{"ERROR"}; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Retrieving Error Messages
by pg (Canon) on Nov 18, 2002 at 18:52 UTC | |
by pg (Canon) on Nov 18, 2002 at 18:54 UTC |