narainhere has asked for the wisdom of the Perl Monks concerning the following question:
In my work I very often write scripts with Logging.We have a Logging module which log's the process ID and the line number in script for every log message.It goes something like
I have to write these 2 line of code and some more logging code in all the scripts.Is there a way create a template (which contains the above code) in simple way.I know require would serve this but I need to pass the file name and process ID dynamically during run time, So I am curios to know whether this can be achieved with templates.my $log=MODLOG::LogIt->new(file name,process ID); $log->add("Header");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Templatize Repeated code
by GrandFather (Saint) on Sep 17, 2007 at 10:24 UTC | |
|
Re: Templatize Repeated code
by graff (Chancellor) on Sep 17, 2007 at 12:20 UTC | |
|
Re: Templatize Repeated code
by andreas1234567 (Vicar) on Sep 17, 2007 at 12:39 UTC | |
|
Re: Templatize Repeated code
by graff (Chancellor) on Sep 22, 2007 at 16:30 UTC | |
by Anonymous Monk on Oct 18, 2007 at 18:55 UTC |