Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

  (email not shown publicly)
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Thursday May 19, 2005
05:33 PM

Getting what you wish for (in Data::Dumper::Simple)

[ #24779 ]

On the Portland Perl Monger's mailing list, a few people asked why parentheses were required on the Dumper function. Tom Phoenix specifically asked why I couldn't just parse a comma separate list of variables and use that as the arguments? (DDS is a source filter). I replied, half in jest, that the following didn't seem worth the trouble:

my $COMMA = qr/(?:,|=>)/;
my $SIGIL = qr/$@%*&/;
my $ATOM  = qr/[[:word:]]+/;
my $SEP   = qr/::/;
my $VAR   = qr/$SIGIL$SEP?$ATOM(?:$SEP$ATOM)*/;

my $WITH_PARENS = qr/$DUMPER_FUNCTION\s*\(([^)]+)\)/;
my $VAR_LIST    = qr/$VAR\s*(?:$COMMA\s*$VAR)*/;


I also said "patches welcome." So he sent me one, complete with tests. When I have more time to play around with this, I'll integrate it, make sure it works and upload it. I think this should make people happy to be able to write this:

print Dumper $foo, @bar, %baz;

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.