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