… | |
… | |
49 | =head2 $serialized = sfreeze $value (simplified freeze) |
49 | =head2 $serialized = sfreeze $value (simplified freeze) |
50 | |
50 | |
51 | Often there is the need to serialize data into a string. This function does that, by using the Storable |
51 | Often there is the need to serialize data into a string. This function does that, by using the Storable |
52 | module. It does the following transforms: |
52 | module. 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 | |
60 | That is, it tries to leave "normal", human-readable data untouched but |
62 | That is, it tries to leave "normal", human-readable data untouched but |
61 | still serializes complex data structures into strings. |
63 | still serializes complex data structures into strings. The idea is to keep |
62 | |
64 | readability as high as possible, and in cases readability can't be helped |
63 | The idea of all these C<sfreeze> functions is to keep readability as high |
65 | anyways, it tries to compress the string. |
64 | as possible, and in cases readability can't be helped anyways, it tries to |
|
|
65 | compress the string. |
|
|
66 | |
66 | |
67 | The C<sfreeze> functions will enlarge the original data one byte at most |
67 | The C<sfreeze> functions will enlarge the original data one byte at most |
68 | and will only load the Storable method when neccessary. |
68 | and 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) |