I'm trying to place a subroutine in a perl module and although I have the syntax correct (nothing in the error log) the routine doesn't seem to be getting called.
The key items from the main script are as follows;
obviously the call is within the code lower down. The routine is getting called, as there is another local one after it that is running correctly.
My module code is in the same directory as my script and is called filelog.pm. It's contents are as follows;
Is there any reason why this wouldn't be getting called?
Thanks
The key items from the main script are as follows;
Code:
use filelog;
update_log2("Filename", "Name");
My module code is in the same directory as my script and is called filelog.pm. It's contents are as follows;
Code:
sub update_log {
$filename = $_[0];
$track = $_[1];
# Read the log and determine the next ID value
$filelog = "/var/[URL unfurl="true"]www/cgi-bin/files.log";[/URL]
$fileCount = "";
$temp = "";
$line2 = "";
$line3 = "";
open (FILES, $filelog) || die "Could not open file";
while ($temp = <FILES>) {
$fileCount = $temp;
$line2 = <FILES>;
$line3 = <FILES>;
}
close(FILES);
$fileCount++;
# Append the file
open (FILES, ">>" . $filelog) || die "Could not open file for append";
print FILES "$fileCount\n";
print FILES "$filename\n";
print FILES "$track\n";
close(FILES);
return;
}
1;
Thanks