"Fossies" - the Fresh Open Source Software Archive

Member "metadot/metadot/Metadot/Serialization/AbstractSerializer.pm" (1 Jul 2005, 2497 Bytes) of package /linux/www/old/Metadot6.4.5.4.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "AbstractSerializer.pm" see the Fossies "Dox" file reference documentation.

    1 ###########################################################################
    2 # <LICENSEINFO>
    3 # Copyright (C) Daniel Guermeur - 1999-2001
    4 # Copyright (C) Metadot Corporation - 2001-2005
    5 #
    6 # This file is part of Metadot Portal Server software $Name: Release_6_4_5_4 $
    7 #
    8 # Metadot Portal Server software is free software; you can
    9 # redistribute it and/or modify it under the terms of the GNU General Public
   10 # License as published by the Free Software Foundation; either version 2 of
   11 # the License, or (at your option) any later version.
   12 #
   13 # Metadot Portal Server software is distributed in the hope that it
   14 # will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
   15 # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
   16 # Public License for more details.
   17 #
   18 # You should have received a copy of the GNU General Public License along with
   19 # Metadot Portal Server; if not, write to the Free Software
   20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   21 #
   22 # For more information, please contact info@metadot.com.
   23 #</LICENSEINFO>
   24 ############################################################################
   25 
   26 package Metadot::Serialization::AbstractSerializer;
   27 
   28 =head1 NAME
   29 
   30 Metadot::Serialization::AbstractSerializer
   31 
   32 =head1 VERSION
   33 
   34 Version $Revision: 1.1.2.4 $
   35 
   36 =head1 SYNOPSIS
   37 
   38 my $serializer = Metadot::Serialization::SerializerFactory->get_instance();
   39 my $serialized = $serializer->serialize($object);
   40 my $object     = $serializer->deserialize($serialized)
   41 
   42 =head1 DESCRIPTION
   43 
   44 AbstractSerializer defines an interface for serializing and deserializing
   45 objects.
   46 
   47 =head1 METHODS
   48 
   49 =cut
   50 
   51 
   52 use strict;
   53 
   54 
   55 =item C<new>
   56 
   57 Constructor. You should use the factory method instead.
   58 
   59 Metadot::Serialization::SerializerFactory->get_instance()
   60 
   61 =cut
   62 sub new
   63 {
   64     my $proto = shift;
   65     my $class = ref($proto) || $proto;
   66     my $self  = {};
   67     bless $self, $class;
   68 
   69     return $self;
   70 }
   71 
   72 
   73 =item C<serialize>
   74 
   75   my $data = $serializer->serialize($object);
   76 
   77 Convert an object into a portable datum. (abstract)
   78 
   79 =cut
   80 sub serialize
   81 {
   82     my $self   = shift;
   83     my $object = shift || return undef;
   84     ref($object) || die('Must send an object reference');
   85 
   86     die('Abstract method');
   87 }
   88 
   89 
   90 =item C<deserialize>
   91 
   92 Restore an object that was previously serialized. (abstract)
   93 
   94   my $object = $serializer->deserialize($data);
   95 
   96 =cut
   97 sub deserialize
   98 {
   99     my $self = shift;
  100     my $data = shift || return undef;
  101 
  102     die('Abstract method');
  103 }
  104 
  105 
  106 
  107 
  108 
  109 
  110 
  111 
  112 
  113 
  114 
  115 1;
  116 
  117 
  118 
  119