Hie Monks!!
Now that I am a bit more than a novice in perl ,
I think I can change the way I </>CODE!!
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
my $log=MODLOG::LogIt->new(file name,process ID);
$log->add("Header");
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.
--------Part2---------
Thanks for you replies, actually my intention was to get some starting idea on writing templates in perl.I thought an example would help others to rewrite it a template.Anything input on writing a simple template and using it would be highly appreciated
update:added Part2
The world is so big for any individual to conquer
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.