our @EXPORT_OK = qw(GenerateMonitoredFiles FilePositions);
-#
-## Function for fileposition initialization.
-#
-## This function is used to get the cursor position of the end of file (EOF) of
-## a specified file.
-#
-## In order to prevent from permanently read and keep files opened, or dealing
-## with huge logfiles, at initialization time of the worker processes, the file will
-## be opened once and the cursor position of the end of file (EOF) get stored.
-#
-sub InitFileposition ($) {
- my $file = $_[0];
-
- # Open the file.
- open(FILE, $file) or die "Could not open $file. $!";
-
- # Just seek to the end of the file (EOF).
- seek(FILE, 0, 2);
-
- # Get and store the position.
- my $position = tell(FILE),
-
- # Close the file again.
- close(FILE);
-
- # Return the position.
- return $position;
-}
-
#
## Function to generate a hash of monitored files and their file positions.
#
$new_file_positions{$file} = $current_file_positions{$file};
} else {
# Call function to obtain the file position.
- my $position = &InitFileposition($file);
+ my $position = &_initFileposition($file);
# Add filename and position to the temporary hash.
$new_file_positions{$file} = $position;
return %new_file_positions;
}
+#
+## Function for fileposition initialization.
+#
+## This function is used to get the cursor position of the end of file (EOF) of
+## a specified file.
+#
+## In order to prevent from permanently read and keep files opened, or dealing
+## with huge logfiles, at initialization time of the worker processes, the file will
+## be opened once and the cursor position of the end of file (EOF) get stored.
+#
+sub _initFileposition ($) {
+ my $file = $_[0];
+
+ # Open the file.
+ open(FILE, $file) or die "Could not open $file. $!";
+
+ # Just seek to the end of the file (EOF).
+ seek(FILE, 0, 2);
+
+ # Get and store the position.
+ my $position = tell(FILE),
+
+ # Close the file again.
+ close(FILE);
+
+ # Return the position.
+ return $position;
+}
+
1;