------------- Begin Forwarded Message -------------
Date: Mon, 10 Sep 2001 18:11:06 +0200 (MEST)
From: Jorge Goncalvez <goncal11@cabs40>
Subject: Re: Problem with open
To: [EMAIL PROTECTED]
Mime-Version: 1.0
Content-MD5: hoCpfVU18Iz7US62lINUDg==
Hi, I made a program which runs good the first time but wrong when I do a repeat
method:
My code:
sub check_syslog
{.....
if( Win32::IsWin95() )
{
open FILE, "< $SYSLOG" or die $!;
while (<FILE>)
{
if (/([0-9a-z:]+)\s*via eth0/)
{
($ethernet_address) = $1;
}
elsif (/read request for/)
{
($IP_address, $install_file_path) =
m[:\s*(\S+):.+?(/\S+):];
($client_name) = $IP_address =~ /^(\w+)/;
($boot_file) = $install_file_path =~
/([\w.]+$)/;
}
}
#close FILE;
}
elsif( Win32::IsWinNT() )
{
#use Win32::EventLog;
}
open SYSLOG,"<c:/cygwin_syslog.txt" || die "can't open: $!";
while (<SYSLOG>)
{
chomp;
open FILE, "< $SYSLOG" or die $!;
tie *FILE,'File::ReadBackwards','c:\\cygwin_syslog.txt'
or die "Can't read logfile.txt: $!";
$lastline = <FILE>;
if(defined $lastline and $lastline =~ /success$/)
{
use Test;
my $var = 0;
my $pb = $mw->ProgressBar(-bd => 3,
-relief => 'raised',
-fg => 'yellow',
-variable => \$var,
-colors => [0, 'yellow'
]
)->pack(-side =>'left',-anchor
=>'w');
$pb->cget('-from');
$pb->cget('-to');
for my $v (map(10*$_+3,1..10))
{
$var = $v;
$pb->cget('-value');
$mw->update;
sleep 2; # This line added by Sisyphus
#if ($v==100) {
#$pb->destroy();
#}
}
}
if(defined $lastline and $lastline =~ /^dhcpd/)
{ use Test;
my $var = 0;
my $pb = $mw->ProgressBar(-bd => 3,
-relief => 'raised',
-fg => 'yellow',
-variable => \$var,
-colors => [0, 'green'
]
)->pack(-side =>'left',-anchor
=>'w');
$pb->cget('-from');
$pb->cget('-to');
for my $v (map(10*$_+3,1..10))
{
$var = $v;
$pb->cget('-value');
$mw->update;
sleep 2; # This line added by Sisyphus
#if ($v==100) {
#$pb->destroy();
#}
}
}
close SYSLOG;
}
}
I do a repeat method like this:
$mw->repeat($msdelay,[\&check_syslog,$SYSLOG]);
In fact I have this problem when the repeat method is executed:
readline() on closed filehandle SYSLOG at frame7.pl line 323.
Tk::Error: Can't locate object method "OPEN" via package "File::ReadBackwards" (
perhaps you forgot to load "File::ReadBackwards"?) at frame7.pl line 297.
Thanks.
------------- End Forwarded Message -------------
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
