[Pdx-pm] Data::Dumper::Simple

Ovid publiustemp-pdxpm at yahoo.com
Tue May 17 14:18:23 PDT 2005


Hi all,

On a very minor note:  during the presentation the other night, my
module, Data::Dumper::Simple appeared to break.  It did not.  Instead,
I was trying to use it in a way that is very clearly documented not to
work.  The module, for those who are curious, let's you do things like
this:

  use Data::Dumper::Simple;
  print Dumper($foo, @bar, %baz);

And it will print out a nifty dump of the variables *with* the variable
names!  Also note that you don't even need to take a reference to the
variables.  Doing this with the normal Data::Dumper requires this ugly
mess:

  use Data::Dumper;
  print Data::Dumper->Dump(
    [$foo, \@bar, \%baz],
    [qw/*foo *bar *baz/]
  );

That's a pain to type.  My method makes debugging very easy because now
you no longer have to remember what $VAR1, $VAR2 and friends stand for.

The reason my code didn't work is becuase I was trying to do something
like this:

  print Dumper(sub_name());

My code works with a source filter (and, as such, is only recommended
for use while debugging) and it's documented that the arguments to
Dumper must be variables, not subroutines (because there's no way of
knowing how many variables you will get back or what names they should
have).

Cheers,
Ovid

-- 
If this message is a response to a question on a mailing list, please send
follow up questions to the list.

Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/


More information about the Pdx-pm-list mailing list