#!/usr/bin/perl BEGIN { # Instead of using a messy wrapper to set the necessary variables, we use the script itself to set the variables and restart itself unless ($ENV{BEGIN_BLOCK} or $^C) { $ENV{LD_LIBRARY_PATH} = '/app/datapower/tools/LogReader/expat/lib/'; $ENV{BEGIN_BLOCK} = 1; print "BEGIN_BLOCK executed. ENV:". $ENV{BEGIN_BLOCK} ."\n"; exec 'env',$0,@ARGV; } print "BEGIN executed. \n"; unshift @INC, ("/app/caapm/epagent/epaplugins/lib/perl/", "/app/caapm/tools/lib/","/app/caapm/datapower/tools/LogReader/", "/app/caapm/datapower/tools/LogReader/expat","/app/caapm/datapower/tools/LogReader/XML/Parser/Expat/", "/app/caapm/datapower/tools/localperl/lib/site_perl/5.18.2/sun4-solaris-thread-multi-64", "/app/caapm/datapower/tools/localperl/lib/site_perl/5.18.2", "/app/caapm/datapower/tools/localperl/lib/5.18.2/sun4-solaris-thread-multi-64", "/app/caapm/datapower/tools/localperl/lib/5.18.2"); print "INC executed. ". @INC ."\n"; print "\n From within BEGIN: LD_LIBRARY_PATH = " . $ENV{LD_LIBRARY_PATH} . "\n"; #delete($ENV{BEGIN_BLOCK}); #delete ($ENV{LD_LIBRARY_PATH}); print "============== ENV =======================\n"; print `env`; print "\n Command being executed: $0 \n"; } INIT { print "\n From within INIT: LD_LIBRARY_PATH = " . $ENV{LD_LIBRARY_PATH} . "\n"; } $^W =0; use strict; no warnings; use File::Tail; use XML::Simple; use XML::Parser; use threads; use threads::shared; use Config; use DateTime::Format::Strptime; use URI::URL; use strict; use warnings; use Data::Dump qw(dump); # Not in use as it doesnt allow you to use more the 3 levels for the metric names.. use Wily::PrintMetric; use Ecetera::Utils qw( logit Generate_conf Read_Config :const ); use File::Basename qw( dirname ); use File::Basename; use Cwd qw( abs_path ); print "Executed till the end - WOW!\n";