Quote:
|
Originally Posted by chipix
I left the use File::stat and used your aproach (more readble).
Thanks a lot
|
Hello,
I am reading your previous post on the linuxquestions.org regarding split large file into severel small files using perl. I got the exact same problem as you had in the post. I tried your perl script (I just modified the input and output filename). I got the perl compile error
Can't locate object method "autoflush" via package "IO::Handle" (perhaps you forgot to load "IO::Handle"?) at wbsplit.pl line 15.
Here is my script
#!/usr/bin/perl
#
use strict;
my ($line, $nr);
my $thebigfile = "/home/oracle/projects/test/wbreports.txt"; # input file location
my $logfile = "/home/oracle/projects/test/newwb"; # output files basename
my ($previousFileTimeSize, $currentFileTimeSize);
$previousFileTimeSize = 1;
print "START\n";
open(LOGFILE, ">$logfile");
LOGFILE->autoflush(1);
while (1) {
$currentFileTimeSize = (stat($thebigfile))[7]; # size
print $currentFileTimeSize;
if ($currentFileTimeSize != $previousFileTimeSize) {
print LOGFILE scalar localtime;
print LOGFILE ": sent-mail MODIFIED\n";
$previousFileTimeSize = $currentFileTimeSize;
} else {
print LOGFILE scalar localtime;
print LOGFILE ": sent-mail no modification\n";
}
sleep 30;
}
close LOGFILE;
Do you have any idea what went wrong in the code? I would appreciate your time and help.
Thanks
Michael