The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Acme::JavaTrace - Module for using Java-like stack traces

VERSION

Version 0.03

SYNOPSIS

use Acme::JavaTrace;
warn "some kind of non-fatal exception occured";
die "some kind of fatal exception occured";

DESCRIPTION

<buzzword>This module tries to improves the Perl programmer experience by porting the Java paradigm to print stack traces, which is more professional than Perl's way. </buzzword>

This is achieved by modifying the functions warn() and die() in order to replace the standard messages by complete stack traces that precisely indicates how and where the error or warning occurred. Other than this, their use should stay unchanged, even when using die() inside eval().

For a explanation of why I wrote this module, you can read the sildes of my lightning talk Entreprise Perl, available here: http://maddingue.org/conferences/yapc-eu-2004/entreprise-perl/

EXAMPLE

Here is an example of stack trace produced by Acme::JavaTrace using a fictional Perl program:

Exception: event not implemented
        at MyEvents::generic_event_handler(workshop/events.pl:26)
        at MyEvents::__ANON__(workshop/events.pl:11)
        at MyEvents::dispatch_event(workshop/events.pl:22)
        at MyEvents::call_event(workshop/events.pl:17)
        at main::(workshop/events.pl:30)

Please note that even the professionnal indentation present in Java traces is included in the trace.

FUNCTIONS

do_warn()
do_die()

These functions respectively handle the __WARN__ and __DIE__ signals. Therefore there is no need to call these directly (and in fact, they are not expected to be called directly).

stack_trace()

This function is the one which prints the stack trace, following the Java standard format.

BLAME

Java, for its unhelpful kilometre-long stack traces.

AUTHOR

Sébastien Aperghis-Tramoni <sebastien@aperghis.net>

BUGS

Please report any bugs or feature requests to bug-acme-javatrace@rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Acme-JavaTrace. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

COPYRIGHT & LICENSE

Acme::JavaTrace is Copyright (C)2004 Sébastien Aperghis-Tramoni.

This program is free software. You can redistribute it and/or modify it under the same terms as Perl itself.