Main > Programming > Libraries >

Religion 1.04

Religion 1.04

Sponsored Links

Religion 1.04 Ranking & Summary

RankingClick at the star to rank
Ranking Level
User Review: 0 (0 times)
File size: 0.005 MB
Platform: Any Platform
License: Perl Artistic License
Price:
Downloads: 883
Date added: 2007-05-24
Publisher: Kenneth Albanowski

Religion 1.04 description

Religion is a Perl module that can generate tracebacks and create and install die() and warn() handlers.

This is a second go at a module to simplify installing die() and warn() handlers, and to make such handlers easier to write and control.

For most people, this just means that if use use Religion; then youll get noticably better error reporting from warn() and die(). This is especially useful if you are using eval().

Religion provides four classes, WarnHandler, DieHandler, WarnPreHandler, and DiePreHandler, that when you construct them return closures that can be stored in variables that in turn get invoked by $SIG{__DIE__} and $SIG{__WARN__}. Note that if Religion is in use, you should not modify $SIG{__DIE__} or $SIG{__WARN__}, unless you are careful about invoking chaining to the old handler.

Religion also provides a TraceBack function, which is used by a DieHandler after you die() to give a better handle on the current scope of your situation, and provide information about where you were, which might influence where you want to go next, either returning back to where you were, or going on to the very last. [Sorry - Ed.]

See below for usage and examples.

USAGE

DieHandler SUB

Invoke like this:

$Die::Handler = new DieHandler sub {
#...
};

where #... contains your handler code. Your handler will receive the following arguments:

$message, $full_message, $level, $eval,
$iline, $ifile, $oline, $ofile, $oscope

$message is the message provided to die(). Note that the default addition of " at FILE line LINE.n" will have been stripped off if it was present. If you want to add such a message back on, feel free to do so with $iline and $ifile.

$full_message) is the message with a scope message added on if there was no newline at the end of $message. Currently, this is not the original message that die() tacked on, but something along the lines of " at line 3 of the eval at line 4 of Foo.pln".

$eval is non-zero if the die() was invoked inside an eval.

The rest of the arguments are explained in the source for Religion::TraceBack. Yes, I need to document these, but not just now, for they are a pain to explain.
Whenever you install a DieHandler, it will automatically store the current value of $Die::Handler so it can chain to it. If you want to install a handler only temporarily, use local().

If your handler returns data using return or by falling off the end, then the items returns will be used to fill back in the argument list, and the next handler in the chain, if any, will be invoked. Dont fall off the end if you dont want to change the error message.

If your handler exits using last, then no further handlers will be invoked, and the program will die immediatly.

If your handler exits using next, then the next handler in the chain will be invoked directly, without giving you a chance to change its arguments as you could if you used return.

If your handler invokes die(), then die() will proceed as if no handlers were installed. If you are inside an eval, then it will exit to the scope enclosing the eval, otherwise it will exit the program.

WarnHandler SUB

Invoke like this:

$Warn::Handler = new WarnHandler sub {
#...
};

For the rest of its explanation, see DieHandler, and subsitute warn() for die(). Note that once the last DieHandler completes (or last is invoked) then execution will return to the code that invoked warn().

DiePreHandler SUB

Invoke like this:

$Die::PreHandler = new DiePreHandler sub {
#...
};

This works identically to $Die::Handler, except that it forms a separate chain that is invoked before the DieHandler chain. Since you can use last to abort all the handlers and die immediately, or change the messages or scope details, this can be useful for modifying data that all future handlers will see, or to dispose of some messages from further handling.

This is even more useful in $Warn::PreHandler, since you can just throw away warnings that you know arent needed.

WarnPreHandler SUB

Invoke like this:

$Warn::PreHandler = new WarnPreHandler sub {
#...
};

This works identically to $Warn::Handler, except that it forms a separate chain that is invoked before the WarnHandler chain. Since you can use last to abort all the handlers and return to the program, or change the messages or scope details, this can be useful for modifying data that all future handlers will see, or to dispose of some messages.

This is very useful, since you can just throw away warnings that you know arent needed.

Religion 1.04 Screenshot

Advertisements

Religion 1.04 Keywords

Bookmark Religion 1.04

Hyperlink code:
Link for forum:

Religion 1.04 Copyright

WareSeeker periodically updates pricing and software information of Religion 1.04 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of Religion 1.04 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed

Allok Video Splitter 2.2.0 Review:

Name (Required)
Email(Required)
Captcha
Featured Software

Want to place your software product here?
Please contact us for consideration.

Contact WareSeeker.com
Version History
Related Software
Religion::Islam::Qibla is a Perl module that calculates the Muslim Qiblah Direction, Great Circle Distance and more... Free Download
Resources is a Perl module to handle application defaults in Perl. Free Download
Klicker is a KDE/QT based metronome. Free Download
Syslog2 is an syslogds realtime parser and event handler. Free Download
REST::Application is a framework for building RESTful web-applications. Free Download
Devel::Profile is a Perl module to tell me why my perl program runs so slowly. Free Download
WebFS::FileCopy is a Perl module to get, put, move, copy, and delete files located by URIs. Free Download
VRML::VRML2 is a Perl module that contains VRML methods with the VRML 2.0/97 standard. Free Download