-
-
06 Jan 2015 15:08:14 UTC
- Distribution: Devel-StackTrace-WithLexicals
- Module version: 2.01
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues (2)
- Testers (2492 / 4 / 0)
- Kwalitee
Bus factor: 1- 85.71% Coverage
- License: perl_5
- Perl: v5.8.1
- Activity
24 month- Tools
- Download (24.72KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- Devel::StackTrace
- PadWalker
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Devel::StackTrace::WithLexicals - Devel::StackTrace + PadWalker
SYNOPSIS
use Devel::StackTrace::WithLexicals; sub process_user { my $item_count = 20; price_items(); print "$item_count\n"; # prints 21 } sub price_items { my $trace = Devel::StackTrace::WithLexicals->new( unsafe_ref_capture => 1 # warning: can cause memory leak ); while ( my $frame = $trace->next_frame() ) { my $item_count_ref = $frame->lexical('$item_count'); ${$item_count_ref}++ if ref $item_count_ref eq 'SCALAR'; } } process_user();
DESCRIPTION
Devel::StackTrace is pretty good at generating stack traces.
PadWalker is pretty good at the inspection and modification of your callers' lexical variables.
Devel::StackTrace::WithLexicals is pretty good at generating stack traces with all your callers' lexical variables.
METHODS
All the same as Devel::StackTrace, except that frames (in class Devel::StackTrace::WithLexicals::Frame) also have a
lexicals
method. This returns the same hashref as returned by PadWalker.Unless the
unsafe_ref_capture
option to Devel::StackTrace is used, then each reference is stringified. This can be useful to avoid leaking memory.Simple, really.
AUTHOR
Shawn M Moore,
sartak@gmail.com
BUGS
I had to copy and paste some code from Devel::StackTrace to achieve this (it's hard to subclass). There may be bugs lingering here.
COPYRIGHT AND LICENSE
Copyright 2008-2009 Shawn M Moore.
Some portions written by Dave Rolsky, they belong to him.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Module Install Instructions
To install Devel::StackTrace::WithLexicals, copy and paste the appropriate command in to your terminal.
cpanm Devel::StackTrace::WithLexicals
perl -MCPAN -e shell install Devel::StackTrace::WithLexicals
For more information on module installation, please visit the detailed CPAN module installation guide.