SPUG: Data::Dumper for an entire package?
Jason Simpson
jason at xio.com
Wed Jul 11 19:06:52 CDT 2001
I'd like to dump (and restore later) the state of all the variables in a
particular package. Is there a way to do this?
I tried a few things along the lines of
#!/usr/bin/perl -w
use Data::Dumper;
package otherpackage;
$a = 1;
@a = ('a', 'b');
$b = 2;
%b = ('key', 'value');
$c = 3;
package main;
open DATA, ">otherpackage.data";
$data = Dumper (\%otherpackage::);
print $data;
print DATA $data;
close DATA;
but from looking at the output file (otherpackage.data), that didn't do
what I was hoping.
Thanks.
-jrs
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest
Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
More information about the spug-list
mailing list