Acme-Dump-And-Dumper

 view release on metacpan or  search on metacpan

META.yml  view on Meta::CPAN

license: perl
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: '1.4'
name: Acme-Dump-And-Dumper
provides:
  Acme::Dump::And::Dumper:
    file: lib/Acme/Dump/And/Dumper.pm
    version: '1.001005'
requires:
  Data::Dumper: '0'
  Data::Rmap: '0'
  Exporter: '0'
  Scalar::Util: '0'
  Storable: '0'
  perl: '5.006'
  strict: '0'
  warnings: '0'
resources:
  bugtracker: https://github.com/zoffixznet/acme-dump-and-dumper/issues
  homepage: http://metacpan.org/release/Acme-Dump-And-Dumper

Makefile.PL  view on Meta::CPAN

  "AUTHOR" => "Zoffix Znet <cpan\@zoffix.com>",
  "CONFIGURE_REQUIRES" => {
    "ExtUtils::MakeMaker" => 0
  },
  "DISTNAME" => "Acme-Dump-And-Dumper",
  "EXE_FILES" => [],
  "LICENSE" => "perl",
  "MIN_PERL_VERSION" => "5.006",
  "NAME" => "Acme::Dump::And::Dumper",
  "PREREQ_PM" => {
    "Data::Dumper" => 0,
    "Data::Rmap" => 0,
    "Exporter" => 0,
    "Scalar::Util" => 0,
    "Storable" => 0,
    "strict" => 0,
    "warnings" => 0
  },
  "TEST_REQUIRES" => {
    "File::Spec" => 0,
    "IO::Handle" => 0,

Makefile.PL  view on Meta::CPAN

    "Test::More" => 0
  },
  "VERSION" => "1.001005",
  "test" => {
    "TESTS" => "t/*.t"
  }
);


my %FallbackPrereqs = (
  "Data::Dumper" => 0,
  "Data::Rmap" => 0,
  "Exporter" => 0,
  "ExtUtils::MakeMaker" => 0,
  "File::Spec" => 0,
  "IO::Handle" => 0,
  "IPC::Open3" => 0,
  "Scalar::Util" => 0,
  "Storable" => 0,
  "Test::More" => 0,
  "strict" => 0,

README.md  view on Meta::CPAN

    ##                 'obj' => 'obj[Foo::Bar]',
    ##                 'beer' => [
    ##                             'x',
    ##                             'y',
    ##                             'z'
    ##                           ]
    ##               },
    ##      'foo' => 'bar'
    ## };

    # All the Data::Dumper stuff is still there...
    $Data::Dumper::Useqq = 1;
    print DnD "Foo\nBar";

    # ... even the original Dumper()
    print Dumper "Foo\nBar";

# DESCRIPTION

A [Data::Dumper](https://metacpan.org/pod/Data::Dumper), with an additional sub that's like `Dumper()`
but doesn't dump the contents of object refs.

# EXPORTS

In addition to all the stuff available for export in [Data::Dumper](https://metacpan.org/pod/Data::Dumper),
this module provides `DnD()` function (pneumonic: "Dump'n'Dumper").

## `DnD`

    print DnD $data;

    # Data::Dumper's vars are still available:
    $Data::Dumper::Useqq = 1;
    print DnD "Foo\nBar";

Takes the same stuff and returns the same output as
`Data::Dumper::Dumper()`, except all of the
objects will be replaced with `obj[Foo::Bar]`, where `Foo::Bar` is
object's class. **See caveats section below**.

# CAVEATS

Whenever possible, the module will try to deep clone the structure
before messing with it and dumping it. **However**, since not everything
is deep clonable, if the deep clone fails, the module will modify the
original data structure, and method call on what **used to be** objects
will obviously fail.

# HISTORY

This module arose from my frustration of trying to get rid of object
guts in my dumped data (e.g. dumping `Foo::Bar` that is a blessed
hashref, would also dump all the contents of that hashref).
Subsequently, during a conversation on IRC, `tm604` came up with
a hack using `$Data::Dumper::Freezer`, and the following comment
from `hoelzro` made me decide to release a module I could actually
use, when I don't want to see any object guts.

    <hoelzro> Data::Dumper::And::Dumper
    * hoelzro ducks
    <hoelzro> s/Dumper/Dump/ # ruined my own awful joke

P.S.: eventually I ended up using [Data::Rmap](https://metacpan.org/pod/Data::Rmap) instead of the Freezer.

<div>
    <img src="http://zoffix.com/CPAN/Acme-Dump-and-Dumper.jpg"
        style="border: 2px solid #aaa!important; display: block!important; margin: 20px 0!important;"
        alt="Dumb and Dumber">
</div>

lib/Acme/Dump/And/Dumper.pm  view on Meta::CPAN

package Acme::Dump::And::Dumper;

use strict;
use warnings;

our $VERSION = '1.001005'; # VERSION

require Exporter;
our @ISA = qw/Exporter  Data::Dumper/;
our @EXPORT_OK = @Data::Dumper::EXPORT_OK;
our @EXPORT    = ( 'DnD', @Data::Dumper::EXPORT );

use Data::Rmap;
use Scalar::Util qw/blessed  refaddr/;
use Data::Dumper ( @Data::Dumper::EXPORT, @Data::Dumper::EXPORT_OK, );
use Storable qw/dclone/;
$Storable::Deparse = 1;

sub DnD {
    my @in = @_;

    my @out;
    for my $data ( @in ) {
        my $working_data = eval { dclone $data };
        $working_data = $data

lib/Acme/Dump/And/Dumper.pm  view on Meta::CPAN

    ##                 'obj' => 'obj[Foo::Bar]',
    ##                 'beer' => [
    ##                             'x',
    ##                             'y',
    ##                             'z'
    ##                           ]
    ##               },
    ##      'foo' => 'bar'
    ## };

    # All the Data::Dumper stuff is still there...
    $Data::Dumper::Useqq = 1;
    print DnD "Foo\nBar";

    # ... even the original Dumper()
    print Dumper "Foo\nBar";

=head1 DESCRIPTION

A L<Data::Dumper>, with an additional sub that's like C<Dumper()>
but doesn't dump the contents of object refs.

=head1 EXPORTS

In addition to all the stuff available for export in L<Data::Dumper>,
this module provides C<DnD()> function (pneumonic: "Dump'n'Dumper").

=head2 C<DnD>

    print DnD $data;

    # Data::Dumper's vars are still available:
    $Data::Dumper::Useqq = 1;
    print DnD "Foo\nBar";

Takes the same stuff and returns the same output as
C<Data::Dumper::Dumper()>, except all of the
objects will be replaced with C<obj[Foo::Bar]>, where C<Foo::Bar> is
object's class. B<See caveats section below>.

=head1 CAVEATS

Whenever possible, the module will try to deep clone the structure
before messing with it and dumping it. B<However>, since not everything
is deep clonable, if the deep clone fails, the module will modify the
original data structure, and method call on what B<used to be> objects
will obviously fail.

=head1 HISTORY

This module arose from my frustration of trying to get rid of object
guts in my dumped data (e.g. dumping C<Foo::Bar> that is a blessed
hashref, would also dump all the contents of that hashref).
Subsequently, during a conversation on IRC, C<tm604> came up with
a hack using C<$Data::Dumper::Freezer>, and the following comment
from C<hoelzro> made me decide to release a module I could actually
use, when I don't want to see any object guts.

    <hoelzro> Data::Dumper::And::Dumper
    * hoelzro ducks
    <hoelzro> s/Dumper/Dump/ # ruined my own awful joke

P.S.: eventually I ended up using L<Data::Rmap> instead of the Freezer.

=begin html

<img src="http://zoffix.com/CPAN/Acme-Dump-and-Dumper.jpg"
    style="border: 2px solid #aaa!important; display: block!important; margin: 20px 0!important;"
    alt="Dumb and Dumber">



( run in 0.508 second using v1.01-cache-2.11-cpan-4d50c553e7e )