Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re^4: trouble parsing log file...

by perl_geoff (Acolyte)
on Nov 25, 2006 at 19:23 UTC ( #586039=note: print w/replies, xml ) Need Help??

in reply to Re^3: trouble parsing log file...
in thread trouble parsing log file...

Hey, I tried using this module, but I'm still running into the same problem as my other script...can you show me where I'm going wrong?
use strict; use warnings; my $logfile="log.txt"; my $error="DOWN"; my $warn="PROBLEM"; my $redbutton="\<img src\=\'default_files/perlredblink\.gif'>"; my $greenbutton="\<img src\=\'default_files/perlgreenblink\.gif'>"; my $yellowbutton="\<img src\=\'default_files/perlyellowblink\.gif'>"; my $button = $greenbutton; # open LOG, $logfile or die "Cannot open $logfile for read :$!"; use File::Tail; tie *LOG, 'File::Tail', (name => $logfile, tail => -1) or die("log open error: $!"); while (my $line = <LOG>) { if ($line eq $error) { $button = $redbutton; print "<!--Content-type: text/html-->\n\n"; print $button; last; } elsif ($line eq $warn) { $button = $yellowbutton; print "<!--Content-type: text/html-->\n\n"; print $button; last; } else { print "<!--Content-type: text/html-->\n\n"; print $button; last; } } close LOG;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://586039]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2017-12-17 04:34 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (462 votes). Check out past polls.