Quick question,
I could not get the following sub to work until
I had to move $emailLog inside the sub to get this
to work on the server.
What did I miss or not understand?
Thanks
Dave
## not seen by the sub,
$emailLog = 'logs/email_log';
# Send E-Mail
&send_mail;
# Append email log
&addEmail;
sub addEmail{
$emailLog = 'logs/email_log'; ##after moving it inside, now it works....
open(EL,"$emailLog") || &errorLog( "Read in, Could not find $emailLog, $!");
my @lines = <EL>;
close(EL);
open(EL,">$emailLog.tmp") || &errorLog( "Write file, could not find $emailLog, $!");
my %seen;
@lines = sort @lines;
foreach(@lines){
next if /test/;
$_ =~ s/^\s+(.*)\s+$/\1,/;
print EL unless $seen{$_}++;
}
# print EL "$Config{'email'} $Config{'name'},\n";
close(EL);
rename("$emailLog", "$emailLog.old");
rename("$emailLog.tmp", "$emailLog");
}
sub errorLog{
open(ER,'>>logs/error_log') || die "could not find error_log, $!";
$errorMssg = shift;
print ER "$errorMssg\n";
close(ER);
}
--------------------------------------------
Looking for Web Talent, You found it!
portfolio: www.coraconnection.com/web/
email: [EMAIL PROTECTED]
tel/fax: (860) 231-9988
--------------------------------------------