[EMAIL PROTECTED] wrote:
Im trying to run this code: (im getting this error message):
Can't use string ("From") as a HASH ref while "strict refs" in use at /
usr/lib/perl5/site_perl/5.8.8/Mail/Mailer.pm line 320.
The code:
use strict;
use warnings;
use Mail::Mailer;
my @lines = ();
open (INFO, "/var/log/messages") or die "$!";
while (my $line = <INFO>) {
if ($line =~ /IDS/) {
push @lines,$line;
}
}
close INFO;
if (@lines) {
my $mailer = Mail::Mailer->new("smtp", "10.83.27.71");
$mailer->open( 'From' => 'Syslog <[EMAIL PROTECTED]>',
'To' => 'gabriela pinado
<[EMAIL PROTECTED]>',
'Subject' => 'PiX Detected Attack ' );
print $mailer @lines;
$mailer->close or die "can't close mailer: $!";
}
Any ideas where is the problem?
Yes. As stated in the docs for Mail::Mailer, the open() method expects a
hash reference as its argument.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/