Skip to content
Newer
Older
100644 41 lines (32 sloc) 822 Bytes
a23337a @rcaputo Filter::Reference test and ascilliary files
authored Jun 21, 2000
1 # A sample external freezer for POE::Filter::Reference testing.
2
3 package MyOtherFreezer;
4
747e195 @rcaputo propagate cvs version number as $VERSION
authored Jan 10, 2002
5 use strict;
6
a23337a @rcaputo Filter::Reference test and ascilliary files
authored Jun 21, 2000
7 sub new {
8 my $type = shift;
9 return bless [ ], $type;
10 }
11
12 sub freeze {
13 my $thing = shift;
14 $thing = shift if ref($thing) eq 'MyOtherFreezer';
15
16 if (ref($thing) eq 'SCALAR') {
17 return reverse(join "\0", ref($thing), $$thing);
18 }
19 elsif (ref($thing) eq 'Package') {
20 return reverse(join "\0", ref($thing), @$thing);
21 }
d814423 @rcaputo doc patch and 19_filterchange.t Storable tweak
authored Aug 15, 2000
22 die "can't freeze things of type ", ref($thing);
a23337a @rcaputo Filter::Reference test and ascilliary files
authored Jun 21, 2000
23 }
24
25 sub thaw {
26 my $thing = shift;
27 $thing = shift if ref($thing) eq 'MyOtherFreezer';
28
29 my ($type, @stuff) = split /\0/, reverse($thing);
30 if ($type eq 'SCALAR') {
31 my $scalar = $stuff[0];
32 return \$scalar;
33 }
34 elsif ($type eq 'Package') {
35 return bless \@stuff, $type;
36 }
d814423 @rcaputo doc patch and 19_filterchange.t Storable tweak
authored Aug 15, 2000
37 die "can't thaw things of type $type";
a23337a @rcaputo Filter::Reference test and ascilliary files
authored Jun 21, 2000
38 }
39
40 1;
Something went wrong with that request. Please try again.