in reply to Seeking defined() for compile time
Resurrecting hidden Log4perl Statements
Sometimes scripts need to be deployed in environments without having Log::Log4perl installed yet. On the other hand, you dont't want to live without your Log4perl statements -- they're gonna come in handy later.
So, just deploy your script with Log4perl statements commented out with the pattern "###l4p", like in
If Log::Log4perl is available, use the ":resurrect" tag to have Log4perl resurrect those burried statements before the script starts running:###l4p DEBUG "It works!"; # ... ###l4p INFO "Really!";
This will have a source filter kick in and indeed printuse Log::Log4perl qw(:resurrect :easy); ###l4p Log::Log4perl->easy_init($DEBUG); ###l4p DEBUG "It works!"; # ... ###l4p INFO "Really!";
2004/11/18 22:08:46 It works! 2004/11/18 22:08:46 Really!
|
|---|