1Devel::StackTrace::WithULseexricCaolnst(r3i)buted Perl DDoecvuemle:n:tSattaicoknTrace::WithLexicals(3)
2
3
4

NAME

6       Devel::StackTrace::WithLexicals - Devel::StackTrace + PadWalker
7

SYNOPSIS

9           use Devel::StackTrace::WithLexicals;
10
11           sub process_user {
12               my $item_count = 20;
13               price_items();
14               print "$item_count\n";    # prints 21
15           }
16
17           sub price_items {
18               my $trace = Devel::StackTrace::WithLexicals->new(
19                   unsafe_ref_capture => 1    # warning: can cause memory leak
20               );
21               while ( my $frame = $trace->next_frame() ) {
22                   my $item_count_ref = $frame->lexical('$item_count');
23                   ${$item_count_ref}++ if ref $item_count_ref eq 'SCALAR';
24               }
25           }
26
27           process_user();
28

DESCRIPTION

30       Devel::StackTrace is pretty good at generating stack traces.
31
32       PadWalker is pretty good at the inspection and modification of your
33       callers' lexical variables.
34
35       Devel::StackTrace::WithLexicals is pretty good at generating stack
36       traces with all your callers' lexical variables.
37

METHODS

39       All the same as Devel::StackTrace, except that frames (in class
40       Devel::StackTrace::WithLexicals::Frame) also have a "lexicals" method.
41       This returns the same hashref as returned by PadWalker.
42
43       Unless the "unsafe_ref_capture" option to Devel::StackTrace is used,
44       then each reference is stringified. This can be useful to avoid leaking
45       memory.
46
47       Simple, really.
48

AUTHOR

50       Shawn M Moore, "sartak@gmail.com"
51

BUGS

53       I had to copy and paste some code from Devel::StackTrace to achieve
54       this (it's hard to subclass). There may be bugs lingering here.
55
57       Copyright 2008-2009 Shawn M Moore.
58
59       Some portions written by Dave Rolsky, they belong to him.
60
61       This program is free software; you can redistribute it and/or modify it
62       under the same terms as Perl itself.
63
64
65
66perl v5.30.1                      2020-01-29Devel::StackTrace::WithLexicals(3)
Impressum