Devel-StackTrace-WithLexicals

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

0.09    2011-04-20
        Remove old test that depended on broken UTF8 (reported by hanekomu)

0.08    Fri Dec  3 2010
        Pass message and indent to Frames (Tatsuhiko Miyagawa)

0.07    Fri Nov 26 2010
        Depend on Devel::StackTrace 1.25 (Stephen R. Scaffidi) [rt.cpan.org #61715]

0.06    Mon Jul 19 2010
        Depend on PadWalker 1.92 for bugfixes (rafl)

0.05    Sun Dec 13 07:09:35 2009
        Devel::StackTrace renamed _ref_as_string to _ref_to_string

0.04    Fri Dec 11 00:19:45 2009
        Respect Devel::StackTrace's no_refs for lexicals

0.03    Tue Dec 23 22:25:52 2008
        Fix SIGNATURE.

META.yml  view on Meta::CPAN

---
abstract: 'Devel::StackTrace + PadWalker'
author:
  - 'Shawn M Moore, C<sartak@gmail.com>'
build_requires:
  ExtUtils::MakeMaker: 6.59
configure_requires:
  ExtUtils::MakeMaker: 6.59
distribution_type: module
dynamic_config: 1
generated_by: 'Module::Install version 1.06'
license: perl
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: 1.4
name: Devel-StackTrace-WithLexicals
no_index:
  directory:
    - inc
    - t
requires:
  Devel::StackTrace: 2.00
  PadWalker: 1.98
  perl: 5.8.1
resources:
  homepage: https://github.com/sartak/Devel-StackTrace-WithLexicals/tree
  license: http://dev.perl.org/licenses/
  repository: git://github.com/sartak/Devel-StackTrace-WithLexicals.git
version: 2.01

Makefile.PL  view on Meta::CPAN

use inc::Module::Install;

name     'Devel-StackTrace-WithLexicals';
all_from 'lib/Devel/StackTrace/WithLexicals.pm';
githubmeta;

requires 'Devel::StackTrace' => '2.00';
requires 'PadWalker' => '1.98';

WriteAll;

lib/Devel/StackTrace/WithLexicals.pm  view on Meta::CPAN

package Devel::StackTrace::WithLexicals;
use strict;
use warnings;
use 5.008001;
use base 'Devel::StackTrace';

use Devel::StackTrace::WithLexicals::Frame;

use PadWalker 'peek_my';

our $VERSION = '2.01';

# mostly copied from Devel::StackTrace 2.00
sub _record_caller_data {
    my $self = shift;

    my $filter = $self->{filter_frames_early} && $self->_make_frame_filter();

    # We exclude this method by starting at least one frame back.
    my $x = 1 + ( $self->{skip_frames} || 0 );

    # PadWalker ignores eval block and eval string, so we have to keep
    # a different frame count for it
    my $walker = 0;
    for my $caller_count (0..$x) {
        my $sub = (caller($caller_count))[3];
        ++$walker unless $sub eq '(eval)';
    }

    while (
        my @c
        = $self->{no_args}

lib/Devel/StackTrace/WithLexicals.pm  view on Meta::CPAN

        );
}


1;

__END__

=head1 NAME

Devel::StackTrace::WithLexicals - Devel::StackTrace + PadWalker

=head1 SYNOPSIS

    use Devel::StackTrace::WithLexicals;

    sub process_user {
        my $item_count = 20;
        price_items();
        print "$item_count\n";    # prints 21
    }

lib/Devel/StackTrace/WithLexicals.pm  view on Meta::CPAN

            ${$item_count_ref}++ if ref $item_count_ref eq 'SCALAR';
        }
    }

    process_user();

=head1 DESCRIPTION

L<Devel::StackTrace> is pretty good at generating stack traces.

L<PadWalker> is pretty good at the inspection and modification of your callers'
lexical variables.

L<Devel::StackTrace::WithLexicals> is pretty good at generating stack traces
with all your callers' lexical variables.

=head1 METHODS

All the same as L<Devel::StackTrace>, except that frames (in class
L<Devel::StackTrace::WithLexicals::Frame>) also have a C<lexicals> method. This
returns the same hashref as returned by L<PadWalker>.

Unless the C<unsafe_ref_capture> option to L<Devel::StackTrace> is
used, then each reference is stringified. This can be useful to avoid
leaking memory.

Simple, really.

=head1 AUTHOR

Shawn M Moore, C<sartak@gmail.com>



( run in 0.698 second using v1.01-cache-2.11-cpan-05444aca049 )