blob: eb151a153b1df274d2b7f788b917738f9bb2f8b3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#!./perl
use Test::More;
use Storable ();
BEGIN {
eval "use Test::LeakTrace";
plan 'skip_all' => 'Test::LeakTrace required for this tests' if $@;
}
plan 'tests' => 1;
{
my $c = My::Simple->new;
my $d;
my $freezed = Storable::freeze($c);
no_leaks_ok
{
$d = Storable::thaw($freezed);
undef $d;
};
package My::Simple;
sub new {
my ($class, $arg) = @_;
bless {t=>$arg}, $class;
}
sub STORABLE_freeze {
return "abcderfgh";
}
sub STORABLE_attach {
my ($class, $c, $serialized) = @_;
return $class->new($serialized);
}
}
{ # [cpan #97316]
package TestClass;
sub new {
my $class = shift;
return bless({}, $class);
}
sub STORABLE_freeze {
die;
}
package main;
my $obj = TestClass->new;
eval { freeze($obj); };
}
|