R
Richard
Why does isn't my function executed in this context:
# does not work
my $doc = XMLin($configfile) or die Notifier::Info("ERROR: Can't open
$configfile");
# works if I change the above line in my perl script
Notifier::Info("blablub");
my $doc = XMLin($configfile)
So if I just call Notifier::Info() it works, but if I call my func to
handle the error :
or die Notifier::Info("ERROR: Couldn't open $configfile");
or this way
or Notifier::Info("ERROR: Couldn't open $configfile");
it doesn't work.
Does anybody know the reason for this?
Thanks in advance , Richard
#content of Notifier.pm
package Notifier;
sub Info{
my ($msg) = @_;
open(LOG, ">>/tmp/log.txt") or die "Couldn't open /tmp/log.txt \n";
$logentry = "\nINFO:" . $msg ;
print LOG $logentry;
close LOG;
}
# does not work
my $doc = XMLin($configfile) or die Notifier::Info("ERROR: Can't open
$configfile");
# works if I change the above line in my perl script
Notifier::Info("blablub");
my $doc = XMLin($configfile)
So if I just call Notifier::Info() it works, but if I call my func to
handle the error :
or die Notifier::Info("ERROR: Couldn't open $configfile");
or this way
or Notifier::Info("ERROR: Couldn't open $configfile");
it doesn't work.
Does anybody know the reason for this?
Thanks in advance , Richard
#content of Notifier.pm
package Notifier;
sub Info{
my ($msg) = @_;
open(LOG, ">>/tmp/log.txt") or die "Couldn't open /tmp/log.txt \n";
$logentry = "\nINFO:" . $msg ;
print LOG $logentry;
close LOG;
}