ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Compress-LZF/LZF.pm
(Generate patch)

Comparing Compress-LZF/LZF.pm (file contents):
Revision 1.2 by root, Thu Sep 27 19:51:24 2001 UTC vs.
Revision 1.12 by root, Thu Sep 5 22:02:26 2002 UTC

49=head2 $serialized = sfreeze $value (simplified freeze) 49=head2 $serialized = sfreeze $value (simplified freeze)
50 50
51Often there is the need to serialize data into a string. This function does that, by using the Storable 51Often there is the need to serialize data into a string. This function does that, by using the Storable
52module. It does the following transforms: 52module. It does the following transforms:
53 53
54 undef (the perl undefined value)
55 => a special cookie (undef'ness is being preserved)
54 IV, NV, PV (i.e. a _plain_ perl scalar): 56 IV, NV, PV (i.e. a _plain_ perl scalar):
55 => stays as is when it contains normal text/numbers 57 => stays as is when it contains normal text/numbers
56 => gets serialized into a string 58 => gets serialized into a string
57 RV, undef, other funny objects (magical ones for example): 59 RV, undef, other funny objects (magical ones for example):
58 => data structure is freeze'd into a string. 60 => data structure is freeze'd into a string.
59 61
60That is, it tries to leave "normal", human-readable data untouched but 62That is, it tries to leave "normal", human-readable data untouched but
61still serializes complex data structures into strings. 63still serializes complex data structures into strings. The idea is to keep
62 64readability as high as possible, and in cases readability can't be helped
63The idea of all these C<sfreeze> functions is to keep readability as high 65anyways, it tries to compress the string.
64as possible, and in cases readability can't be helped anyways, it tries to
65compress the string.
66 66
67The C<sfreeze> functions will enlarge the original data one byte at most 67The C<sfreeze> functions will enlarge the original data one byte at most
68and will only load the Storable method when neccessary. 68and will only load the Storable method when neccessary.
69 69
70=head2 $serialized = sfreeze_c $value (sfreeze and compress) 70=head2 $serialized = sfreeze_c $value (sfreeze and compress)
80 80
81=head2 $original_data = sthaw $serialized 81=head2 $original_data = sthaw $serialized
82 82
83Recreate the original object from it's serialized representation. This 83Recreate the original object from it's serialized representation. This
84function automatically detects all the different sfreeze formats. 84function automatically detects all the different sfreeze formats.
85
86=head2 Compress::LZF::set_serializer $package, $freeze, $thaw
87
88Set the serialize module and functions to use. The default is "Storable",
89"Storable::mstore" and "Storable::mretrieve", which should be fine for
90most purposes.
85 91
86=head1 SEE ALSO 92=head1 SEE ALSO
87 93
88Other Compress::* modules, especially Compress::LZV1 (an older, less 94Other Compress::* modules, especially Compress::LZV1 (an older, less
89speedy module that guarentees only 1 byte overhead worst case) and 95speedy module that guarentees only 1 byte overhead worst case) and
103package Compress::LZF; 109package Compress::LZF;
104 110
105require Exporter; 111require Exporter;
106require DynaLoader; 112require DynaLoader;
107 113
108$VERSION = 0.1; 114$VERSION = 0.1045;
109@ISA = qw/Exporter DynaLoader/; 115@ISA = qw/Exporter DynaLoader/;
110%EXPORT_TAGS = ( 116%EXPORT_TAGS = (
111 freeze => [qw(sfreeze sfreeze_cr sfreeze_c sthaw)], 117 freeze => [qw(sfreeze sfreeze_cr sfreeze_c sthaw)],
112 compress => [qw(compress decompress)], 118 compress => [qw(compress decompress)],
113); 119);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines