The suggested patch for [perl #22201] "patch: perl 5.8.0
[p5sagit/p5-mst-13.2.git] / ext / Storable / Storable.pm
index 4fba6b1..e1a72f6 100644 (file)
@@ -21,7 +21,7 @@ package Storable; @ISA = qw(Exporter DynaLoader);
 use AutoLoader;
 use vars qw($canonical $forgive_me $VERSION);
 
-$VERSION = '2.05';
+$VERSION = '2.07';
 *AUTOLOAD = \&AutoLoader::AUTOLOAD;            # Grrr...
 
 #
@@ -361,6 +361,9 @@ sub thaw {
        return $self;
 }
 
+1;
+__END__
+
 =head1 NAME
 
 Storable - persistence for Perl data structures
@@ -521,6 +524,10 @@ to a subroutine reference which would be used instead of C<eval>. See
 below for an example using a L<Safe> compartment for deserialization
 of CODE references.
 
+If C<$Storable::Deparse> and/or C<$Storable::Eval> are set to false
+values, then the value of C<$Storable::forgive_me> (see below) is
+respected while serializing and deserializing.
+
 =head1 FORWARD COMPATIBILITY
 
 This release of Storable can be used on a newer version of Perl to
@@ -799,17 +806,24 @@ which prints (on my machine):
 Serialization of CODE references and deserialization in a safe
 compartment:
 
+=for example begin
+
        use Storable qw(freeze thaw);
        use Safe;
        use strict;
        my $safe = new Safe;
-       # permitting the "require" opcode is necessary when using "use strict"
+        # because of opcodes used in "use strict":
        $safe->permit(qw(:default require));
        local $Storable::Deparse = 1;
        local $Storable::Eval = sub { $safe->reval($_[0]) };
-       my $serialized = freeze(sub { print "42\n" });
+       my $serialized = freeze(sub { 42 });
        my $code = thaw($serialized);
-       $code->(); # prints 42
+       $code->() == 42;
+
+=for example end
+
+=for example_testing
+        is( $code->(), 42 );
 
 =head1 WARNING
 
@@ -839,9 +853,9 @@ your data.  There is no slowdown on retrieval.
 
 =head1 BUGS
 
-You can't store GLOB, CODE, FORMLINE, etc.... If you can define
-semantics for those operations, feel free to enhance Storable so that
-it can deal with them.
+You can't store GLOB, FORMLINE, etc.... If you can define semantics
+for those operations, feel free to enhance Storable so that it can
+deal with them.
 
 The store functions will C<croak> if they run into such references
 unless you set C<$Storable::forgive_me> to some C<TRUE> value. In that