File: StorableMarshaller.pm

package info (click to toggle)
libio-async-perl 0.29-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 684 kB
  • ctags: 239
  • sloc: perl: 6,439; makefile: 2
file content (55 lines) | stat: -rw-r--r-- 888 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#  You may distribute under the terms of either the GNU General Public License
#  or the Artistic License (the same terms as Perl itself)
#
#  (C) Paul Evans, 2007 -- leonerd@leonerd.org.uk

package # hide from CPAN
  IO::Async::DetachedCode::StorableMarshaller;

use strict;
use warnings;

use Storable qw( freeze thaw );

use Carp;

sub new
{
   my $class = shift;
   return bless {}, $class;
}

sub marshall_args
{
   my ( $self ) = shift;
   my ( $id, $args ) = @_;

   return freeze( $args );
}

sub unmarshall_args
{
   my ( $self ) = shift;
   my ( $id, $record ) = @_;

   return thaw( $record );
}

sub marshall_ret
{
   my $self = shift;
   my ( $id, $ret ) = @_;

   return $self->marshall_args( $id, $ret );
}

sub unmarshall_ret
{
   my $self = shift;
   my ( $id, $record ) = @_;

   return $self->unmarshall_args( $id, $record );
}

# Keep perl happy; keep Britain tidy
1;