PrePAN

Sign in to PrePAN

DD Alias Data::Dumper

Good

Synopsis

$ perl -MDD -e 'print D({foo => "asdf", bar => "qwer"})'
$VAR1 = {
          'bar' => 'qwer',
          'foo' => 'asdf'
        };
$ perl -MDD=pD -e 'pD({foo => "asdf", bar => "qwer"})'
$VAR1 = {
          'bar' => 'qwer',
          'foo' => 'asdf'
        };
$ perl -MDD -e '$d = DD->new([{foo => "asdf", bar => "qwer"}]); print $d->Dump'
$VAR1 = {
          'bar' => 'qwer',
          'foo' => 'asdf'
        };

Description

Hello!

There's DDS as an alias to Data::Dumper::Streamer and DDP to Data::Dumper::Printer. But I couldn't find an alias to Data::Dumper.

I think that one liners using Data::Dumper might become more readable using -MDD instead of -MData::Dumper.

As I don't want to pollute the CPAN namespace, I created DD.pm and pushed it onto github. DD.pm was coded fairly without thinking much about side effects and such (inheritance, export, ..). Hence, everything might change and actually I would be happy about any feedback.

regards, Robert

Comments

I'd love to see my favorite DD settings turned on automatically: Terse=1, Sortkeys=1.
anonymouse
Anonymous
The one issue I'd have with this is that Data::Dump is also very popular, so it would be too easy to confuse. How about a more generic approach, where you could -MMe and Me would have multiple imports and other customizations. Sort of like how Modern, common::sense, etc. do it.
How about creating a DDC module which is an alias to Data::Dumper::Concise? Data::Dumper::Concise is Data::Dumper with Terse=1 and Sortkeys=1. Data::Dumper::Concise already has a 'short' alias -- Devel::Dwarn. But DDC would be a lot shorter.
Or you could just start using DDP. Thats the best option I think. Any reason you are attached to Data::Dumper?
I'm not sure this is worth publishing on the CPAN. Data::Dumper is just legacy. Let it die. See instead DDP or XXX.

Please sign up to post a review.