Yes ++
updated: minidb dumper, thx marioroy
From a bundle I use a lot:
use strict;
use warnings;
package My::Bundle {
use Data::Dumper::AutoEncode ();
use Data::Rmap 'rmap_ref';
use Import::Into;
use parent 'Exporter';
our @EXPORT = 'Dumper';
sub import {
shift->export_to_level(1);
strict ->import::into(1);
warnings ->import::into(1);
strictures ->import::into(1, 2 => 1);
feature ->import::into(1, 'say', 'state');
utf8 ->import::into(1);
autodie ->import::into(1);
Encode->import::into(1);
List::Util->import::into(1, qw/ any all first max maxstr min m
+instr sum sum0 pairkeys pairvalues pairgrep pairmap shuffle uniq /);
Method::Signatures->import::into(1);
Path::Tiny->import::into(1);
Time::Piece->import::into(1);
Time::Seconds->import::into(1);
Try::Tiny->import::into(1);
}
# These are global vars; localize them unless
# you want *everything* to be changed
$Data::Dumper::Deepcopy = 1;
$Data::Dumper::Indent = 1;
$Data::Dumper::Purity = 1;
$Data::Dumper::Quotekeys = 0;
$Data::Dumper::Sortkeys = 1;
$Data::Dumper::Terse = 1;
sub Dumper {
rmap_ref {
if ( my $class = ref($_) ) {
$class = $_->blessed if $class eq 'MCE::Shared::Object
+';
if ( $class->isa('MCE::Shared::Array') ) {
$_ = [ $_->can('export') ? @{ $_->export } : $_->v
+alues ];
}
elsif ( $class->isa('MCE::Shared::Hash') ) {
$_ = { $_->can('export') ? %{ $_->export } : $_->p
+airs };
}
elsif ( $class->isa('MCE::Shared::Minidb') ) {
my $db = $_;
$_ = $db->lkeys ? [ { $db->hpairs }, { $db->lpairs
+ } ] : [ { $db->hpairs } ];
}
elsif ( $class->isa('MCE::Shared::Ordhash') ) {
$_ = $_->clone;
}
elsif ( $class->isa('MCE::Shared::Scalar') ) {
$_ = $_->get;
}
}
} @_;
return Data::Dumper::AutoEncode::eDumper(@_);
}
};
1; # return true
Hope this helps!
The way forward always starts with a minimal test.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|