|Welcome to the Monastery|
Dumping variables but DRY and simpleby LanX (Bishop)
|on Mar 27, 2010 at 13:37 UTC||Need Help??|
LanX has asked for the
wisdom of the Perl Monks concerning the following question:
is there a comfortable and DRY way to dump variables?
I mean neither printing "$VAR1" nor having to repeat the name over and over again, and working with both kinds of variables?
For instance always writing: print Data::Dumper->Dump([\@fontspec],['*fontspec']); is no fun.
I made this hack, which works quite fine so far (ATM for lexicals only):
which called with
produces the same output:
But I have the uncomfortable feeling of reinventing the wheel...
UPDATE: improved code
UPDATE: hmm maybe Conway's Smart::Comments should be mentioned, but it uses code filters...