Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

To be honest I shy away from anything that relies on Filter::*.

I don't see it as particularly necessary here either, as to me, the greatest annoyance has always seemed to be the fact that named variable output requires passing two parallel arrays — rather than, as would seem more natural, hash-like named parameters. Something like this would suffice for me:

warn Data::Dumper->Dump( foo => $foo, this => \%this, array => \@array, that => \%that, );

This also makes the subtle typo you demonstrated much less likely.

(Assume that you are allowed to say '$foo' => $foo where you need the control.)

I am guessing this is all because whoever wrote Data::Dumper wanted the Dump() function to more-or-less DWIM, so that you wouldn't have to remember to call different functions for named or anonymous output. That could easily be achieved as well — Dump() could expect exactly one array- or hash-ref for anonymous or named output, respectively. This gives

warn Dump { foo => $foo, this => \%this, array => \@array, that => \%that, }; #vs warn Dump [ $foo, \%this, \@array, \%that ];

The price is, of course, that you have to use the appropriate set of delimiters.

Another thing that bugs me about Data::Dumper is the OO interface. The constructor takes no options, you have to set them all with one mutator call each. I'd much prefer the former:

my $dumper = Data::Dumper->new( purity => 1, terse => 1, deepcopy => 1 + ); warn $dumper->Dump( [ $foo, \%this, \@array, \%that ] );

Or something along these lines. There are numerous problems with my propositions here; I've never entirely thought this all through. All I'm really saying is that Data::Dumper really has a pretty awful interface, and that it should be possible to sanitize it and keep it DWIMmish without resorting to filters.

Makeshifts last the longest.


In reply to Re: RFC: Data::Dumper::Simple by Aristotle
in thread RFC: Data::Dumper::Simple by Ovid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others taking refuge in the Monastery: (6)
    As of 2021-04-22 23:59 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found

      Notices?