1
2
3
4
5
6
7
8
9
10
11
use 5.006;
use strict;
use warnings;
require "$ENV{'COPRA_HOME'}\\printmethod\\common\\scripts\\functions.pl";
my $customer = "mffm";
my $ordername = "OJ";
&log_this($customer,$ordername,"test");
&getPropertyFromFile("f:\\copra-server\\common\\configuration\\configuration.properties","test");
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use PDF::API2;
use File::Basename;
my $id = "functions.pl:";
our $COPRA_HOME = $ENV{'COPRA_HOME'};
our %configValue;
our $customer;
our $ordername;
sub log_this{
my($customer,$ordername,$msg_to_print) = @_;
my $logfolder = "$ENV{'COPRA_HOME'}\\$customer\\logs";
my $logfileName = $ordername . ".log";
open(LOGFILE, ">> $logfolder\\$logfileName") or die "could not create logfile $logfolder\\$logfileName$!";
print LOGFILE &getTimestamp().":$msg_to_print\n";
close(LOGFILE);
}
sub getPropertyFromFile{
&log_this($customer,$ordername,"starting getPropertyFromFile");
my ($filename,$propertyName) = @_;
my $fileHashRef;
$fileHashRef = &readFileIntoHash($filename);
if (exists($fileHashRef -> {$propertyName})){
&log_this($customer,$ordername,"Property: $propertyName found with value: " . $fileHashRef ->{$propertyName} . " in file $filename");
return $fileHashRef ->{$propertyName};
}
else{
&log_this($customer,$ordername,"Property $propertyName does not exist in file $filename");
return;
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/perl
use 5.006;
use strict;
use warnings;
require "$ENV{'COPRA_HOME'}\\printmethod\\common\\scripts\\functions.pl";
our $customer = "mffm";
our $ordername = "OJ";
&log_this($customer,$ordername,"test");
&getPropertyFromFile("f:\\copra-server\\common\\configuration\\configuration.properties","test");
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
package functions; use strict; use watnings; use Exporter; our @ISA =qw( Exporter ); our @EXPORT=qw(log_this getPropertyFromFile $COPRA_HOME %configValue $customer $ordername); use PDF::API2; use File::Basename; my $id = __PACKAGE__; our $COPRA_HOME = $ENV{'COPRA_HOME'}; our %configValue; our $customer; our $ordername; ... 1;
1 2 3 4 5 6 7 8 9 10 11
use 5.006; use strict; use warnings; use lib "$ENV{'COPRA_HOME'}\\printmethod\\common\\scripts"; use functions; $ordername = "OJ"; $customer = "mffm"; ...