Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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