summaryrefslogtreecommitdiff
path: root/ext/Data/Dumper/Dumper.pm
diff options
context:
space:
mode:
authorSam Tregar <sam@tregar.com>2004-12-19 09:40:25 -0500
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-12-23 15:21:58 +0000
commitc5f7c514bb4668f1a5a19abd36ab87f001002ea4 (patch)
tree9fe63befa8e8416cb64624b328b5ad6a0adbb4c3 /ext/Data/Dumper/Dumper.pm
parentc597ea9d1c1012b41c344b95f9168d25caff8204 (diff)
downloadperl-c5f7c514bb4668f1a5a19abd36ab87f001002ea4.tar.gz
Data::Dumper Freezer fixes
Message-ID: <Pine.LNX.4.61.0412191434490.7660@hillmont.dreamhost.com> and bump Data::Dumper's VERSION p4raw-id: //depot/perl@23671
Diffstat (limited to 'ext/Data/Dumper/Dumper.pm')
-rw-r--r--ext/Data/Dumper/Dumper.pm16
1 files changed, 12 insertions, 4 deletions
diff --git a/ext/Data/Dumper/Dumper.pm b/ext/Data/Dumper/Dumper.pm
index a9acf752eb..a0611f5733 100644
--- a/ext/Data/Dumper/Dumper.pm
+++ b/ext/Data/Dumper/Dumper.pm
@@ -9,7 +9,7 @@
package Data::Dumper;
-$VERSION = '2.121_02';
+$VERSION = '2.121_03';
#$| = 1;
@@ -231,9 +231,13 @@ sub _dump {
if ($type) {
- # prep it, if it looks like an object
- if (my $freezer = $s->{freezer}) {
- $val->$freezer() if UNIVERSAL::can($val, $freezer);
+ # Call the freezer method if it's specified and the object has the
+ # method. Trap errors and warn() instead of die()ing, like the XS
+ # implementation.
+ my $freezer = $s->{freezer};
+ if ($freezer and UNIVERSAL::can($val, $freezer)) {
+ eval { $val->$freezer() };
+ warn "WARNING(Freezer method call failed): $@" if $@;
}
($realpack, $realtype, $id) =
@@ -887,6 +891,10 @@ method can be called via the object, and that the object ends up containing
only perl data types after the method has been called. Defaults to an empty
string.
+If an object does not support the method specified (determined using
+UNIVERSAL::can()) then the call will be skipped. If the method dies a
+warning will be generated.
+
=item *
$Data::Dumper::Toaster I<or> $I<OBJ>->Toaster(I<[NEWVAL]>)