John W. Krahn wrote:
Olivier, Wim W wrote:

I get an error running this script on Win32 , but when I execute the actual
command it works 100%. Does anyone see my problem here?
The error I get is: "Error: Invalid message text."


The debugger goes through fine, but complains at the 'system()' line.


notify_jcc("user", "err", "THIS IS A TEST MESSAGE");

sub notify_jcc {

  my $sysloghost    = "sysloghost.domain.com";
  my $logger        = "C:\\Program Files\\KLOG\\klog.exe";

  ($facility, $level, $message) = @_;
  print "$sysloghost\n";
  print "$logger\n";
  print "$facility\n";
  print "$level\n";
  print "$message\n";

  system("$logger", "-h $sysloghost", "$facility", "$level", "$message");
}

system() accepts either a single string or a list so either:

system( "$logger -h $sysloghost $facility $level $message" );

Or:

system( $logger, '-h', $sysloghost, $facility, $level, $message );

It looks like the $message string will need quotes around it so either:

system( qq($logger -h $sysloghost $facility $level "$message") );

Or:

system( $logger, '-h', $sysloghost, $facility, $level, qq("$message") );



John
--
use Perl;
program
fulfillment

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to