package secondPakage;
use strict;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
@ISA = qw(Exporter);
@EXPORT = qw( &WriteLOG );
@EXPORT_OK = qw();
%EXPORT_TAGS = ( );
our $LOGFile= "";
sub WriteLOG {
my ($msg) = @_;
my $ltime=localtime;
$ltime=~s/\s/_/g;
$ltime=~s/_+/_/g;
$ltime=~s/^_|_$//;
open my $lFD, '>>', "$LOGFile" or die "Unable to open LOG file |$LOGFile| for logging...$!";
printf $lFD "\n=== __FILE__ === $ltime -> $msg\n";
print "\n=== __FILE__ === $ltime -> $msg\n";
close($lFD);
}
1;
####
#script firstCaller.pl
use secondPackage;
our $LOGFile=$ARGV[0];
WriteLOG("...Script is started...\n";
####
package masterPakage;
use strict;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
@ISA = qw(Exporter);
@EXPORT = qw( &functions_to_be_exported );
@EXPORT_OK = qw();
%EXPORT_TAGS = ( );
blah..
blah..
WriteLOG(" i am inside masterPackage...\n";
blah..
blah..
1;