[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 package DBI::Gofer::Serializer::Base; 2 3 # $Id: Base.pm 9949 2007-09-18 09:38:15Z timbo $ 4 # 5 # Copyright (c) 2007, Tim Bunce, Ireland 6 # 7 # You may distribute under the terms of either the GNU General Public 8 # License or the Artistic License, as specified in the Perl README file. 9 10 =head1 NAME 11 12 DBI::Gofer::Serializer::Base - base class for Gofer serialization 13 14 =head1 SYNOPSIS 15 16 $serializer = $serializer_class->new(); 17 18 $string = $serializer->serialize( $data ); 19 ($string, $deserializer_class) = $serializer->serialize( $data ); 20 21 $data = $serializer->deserialize( $string ); 22 23 =head1 DESCRIPTION 24 25 DBI::Gofer::Serializer::* classes implement a very minimal subset of the L<Data::Serializer> API. 26 27 Gofer serializers are expected to be very fast and are not required to deal 28 with anything other than non-blessed references to arrays and hashes, and plain scalars. 29 30 =cut 31 32 33 use strict; 34 use warnings; 35 36 use Carp qw(croak); 37 38 our $VERSION = sprintf("0.%06d", q$Revision: 9949 $ =~ /(\d+)/o); 39 40 41 sub new { 42 my $class = shift; 43 my $deserializer_class = $class->deserializer_class; 44 return bless { deserializer_class => $deserializer_class } => $class; 45 } 46 47 sub deserializer_class { 48 my $self = shift; 49 my $class = ref($self) || $self; 50 $class =~ s/^DBI::Gofer::Serializer:://; 51 return $class; 52 } 53 54 sub serialize { 55 my $self = shift; 56 croak ref($self)." has not implemented the serialize method"; 57 } 58 59 sub deserialize { 60 my $self = shift; 61 croak ref($self)." has not implemented the deserialize method"; 62 } 63 64 1;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Mar 17 22:47:18 2015 | Cross-referenced by PHPXref 0.7.1 |