Sign in to PrePAN


User's Modules

Text::Parser Bare text parser, simplifies text parsing

Text::Parser is a bare-bones text parsing class. It is ignorant of the text format, and cannot recognize any grammars, but derived classes that inherit from it can specify this. They can do this usually by overriding just one of the methods in this class.

Future versions are expected to include progress-bar support, parsing text from sockets, or a chunk of memory. All these software features are text-format independent and can be re-used in parsing any text format. Derived classes of Text::Parser will be able to take advantage of these features.

balajirama@github 0 comments

Log::Redirect Log messages to a file by redirecting STDOUT or STDERR

A perl module that redirects output log messages into specific log files using simply the print()',printf()', and warn()' built-in Perl sub-routines. The interface allows a programmer to simply write the messages he wants to produce usingprint()', printf' orwarn', and let a different portion of the code take care of where it gets written to. This has a couple of advantages:

1. It allows the program to be independent of the names for the
logfiles, and allows the user to choose his names
2. It is very easy to make a message appear on screen as well as in a
file, without repeating the print statement - this is done using the
`verbose' option.
3. No special logging functions need to be used. The standard `print',
`printf' and `warn' functions do the job.
4. Works correctly even if used with `fork()'.


Writing logs have become exceedingly hard, when in reality it is a
rather simple task: tell the user what is going on. Most modules allow
one to write log messages with message levels and stuff. But sometimes
they are not useful, and sometimes the modules just do not cover all the
message levels that one may want. The end result is that a programmer
has to take special care to choose a good logging interface and that
takes time away from his core work - writing the algorithm.

`Log::Redirect' allows a programmer to think of the algorithm first, and
log messages later. It also allows for a very easy way to display the
log on screen and simultaneously writing to the file. `Log::Redirect'
also writes to the disk instantly and doesn't wait for the buffer to be
full before it begins writing something.



Creates a new object of this class. It requires a filename as a required
argument. In addition, it can accept an optional parameter

        my $mylog = Log::Redirect->new('mylog.log');
        my $verboselog = Log::Redirect->new('verbose.log', verbose => 1);


None by default.

balajirama@github 4 comments