Data-Dumper-Names

 view release on metacpan or  search on metacpan

Build.PL  view on Meta::CPAN

use 5.006_001;

my $builder = Module::Build->new(
    module_name        => 'Data::Dumper::Names',
    license            => 'perl',
    dist_author        => 'Curtis <ovid@cpan.org>',
    dist_version_from  => 'lib/Data/Dumper/Names.pm',
    add_to_cleanup     => ['Data-Dumper-Names-*'],
    create_makefile_pl => 'traditional',
    requires           => {
        'PadWalker'    => 0.13,
        'Scalar::Util' => 0,
        'Test::More'   => 0,
    },
);

$builder->create_build_script();

META.yml  view on Meta::CPAN

---
name: Data-Dumper-Names
version: 0.03
author:
  - 'Curtis <ovid@cpan.org>'
abstract: Dump variables with names (no source filter)
license: perl
resources:
  license: http://dev.perl.org/licenses/
requires:
  PadWalker: 0.13
  Scalar::Util: 0
  Test::More: 0
provides:
  Data::Dumper::Names:
    file: lib/Data/Dumper/Names.pm
    version: 0.03
generated_by: Module::Build version 0.2808
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.2.html
  version: 1.2

Makefile.PL  view on Meta::CPAN

# Note: this file was auto-generated by Module::Build::Compat version 0.03
use ExtUtils::MakeMaker;
WriteMakefile
(
          'NAME' => 'Data::Dumper::Names',
          'VERSION_FROM' => 'lib/Data/Dumper/Names.pm',
          'PREREQ_PM' => {
                           'PadWalker' => '0.13',
                           'Scalar::Util' => '0',
                           'Test::More' => '0'
                         },
          'INSTALLDIRS' => 'site',
          'EXE_FILES' => [],
          'PL_FILES' => {}
        )
;

lib/Data/Dumper/Names.pm  view on Meta::CPAN

package Data::Dumper::Names;

use warnings;
use strict;

use Data::Dumper ();
use Scalar::Util 'refaddr';
use PadWalker 'peek_my';
use base 'Exporter';
our @EXPORT  = qw/Dumper/;
our $UpLevel = 1;

=head1 NAME

Data::Dumper::Names - Dump variables with names (no source filter)

=head1 VERSION

lib/Data/Dumper/Names.pm  view on Meta::CPAN

            $name = $pad_vars{ refaddr $_} and last INNER;
        }
        push @names, $name;
    }

    return Data::Dumper->Dump( \@_, \@names );
}

=head1 CAVEATS

=head2 PadWalker

This module is an alternative to L<Data::Dumper::Simple>.  Many people like
the aforementioned module but do not like the fact that it uses a source
filter.  In order to pull off the trick with this module, we use L<PadWalker>.
This introduces its own set of problems, not the least of which is that
L<PadWalker> uses undocumented features of the Perl internals and has an
annoying tendency to break.  Thus, if this module doesn't work on your
machine you may have to go back to L<Data::Dumper::Simple>.

=head2 References

Arrays and hashes, unlike in L<Data::Dumper::Simple>, must be passed by
reference.  Unfortunately, this causes a problem:

 my $foo = \@array;
 warn Dumper( $foo, \@array );



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