| 1 | #======================================================================== | ||
| 2 | # | ||
| 3 | # Badger::Codec::Storable | ||
| 4 | # | ||
| 5 | # DESCRIPTION | ||
| 6 | # Codec for encoding/decoding data via the Storable module. | ||
| 7 | # | ||
| 8 | # AUTHOR | ||
| 9 | # Andy Wardley <abw@wardley.org> | ||
| 10 | # | ||
| 11 | #======================================================================== | ||
| 12 | |||
| 13 | package Badger::Codec::Storable; | ||
| 14 | |||
| 15 | use Badger::Class | ||
| 16 | version => 0.01, | ||
| 17 | base => 'Badger::Codec'; | ||
| 18 | |||
| 19 | use Storable qw( freeze thaw ); | ||
| 20 | |||
| 21 | sub encode { | ||
| 22 | my $self = shift; | ||
| 23 | freeze(@_); | ||
| 24 | } | ||
| 25 | |||
| 26 | sub decode { | ||
| 27 | my $self = shift; | ||
| 28 | thaw(@_); | ||
| 29 | } | ||
| 30 | |||
| 31 | # shortcuts straight to the real encoder/decoder subs for efficient aliasing | ||
| 32 | |||
| 33 | sub encoder { | ||
| 34 | \&freeze; | ||
| 35 | } | ||
| 36 | |||
| 37 | sub decoder { | ||
| 38 | \&thaw; | ||
| 39 | } | ||
| 40 | |||
| 41 | |||
| 42 | 1; | ||
| 43 | |||
| 44 | __END__ |