Carp::Source - Warn of errors with stack backtrace and source context
version 1.101420
use Carp::Source 'source_cluck'; source_cluck 'some error'; source_cluck 'some error', lines => 5, number => 0, color => 'yellow on_blue';
This module exports one function, source_cluck(), which prints stack traces with source code extracts to make it obvious what has been called from where.
source_cluck()
It does not work for one-liners because there is no file from which to load source code.
source_cluck 'some error'; source_cluck 'some error', lines => 5, number => 0, color => 'yellow on_blue';
Like Carp's cluck(), but it also displays the source code context of all call frames, with three lines before and after each call being shown, and the call being highlighted.
cluck()
It takes as arguments a string (the error message) and a hash of options. The following options are recognized:
lines
Number of lines to display before and after the line reported in the stack trace. Defaults to 3.
number
Boolean value to indicate whether line numbers should be printed at the beginning of the context source code lines. Defaults to yes.
color
The color in which to print the source code line reported in the stack trace. It has to be a string that Term::ANSIColor understands. Defaults to black on_yellow.
black on_yellow
This is just a quick hack - not all of Carp's or even just cluck()'s features are present. The code borrows heavily from Carp.
Carp
FIXME
See perlmodinstall for information and options on installing Perl modules.
No bugs have been reported.
Please report any bugs or feature requests through the web interface at http://rt.cpan.org/Public/Dist/Display.html?Name=Carp-Source.
The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit http://www.perl.com/CPAN/ to find a CPAN site near you, or see http://search.cpan.org/dist/Carp-Source/.
The development version lives at http://github.com/hanekomu/Carp-Source/. Instead of sending patches, please fork this project using the standard git and github infrastructure.
Marcel Gruenauer <marcel@cpan.org>
This software is copyright (c) 2007 by Marcel Gruenauer.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Carp::Source, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Carp::Source
CPAN shell
perl -MCPAN -e shell install Carp::Source
For more information on module installation, please visit the detailed CPAN module installation guide.