POE::Component::IKC::Freezer - Pure-Perl serialization method.


POE-Component-IKC documentation Contained in the POE-Component-IKC distribution.

Index


Code Index:

NAME

Top

POE::Component::IKC::Freezer - Pure-Perl serialization method.

SYNOPSIS

Top

DESCRIPTION

Top

This serializer uses Data::Dumper and eval $code to get the deed done. There is an obvious security problem here. However, it has the advantage of being pure Perl and all modules come with the core Perl distribution.

BUGS

Top

AUTHOR

Top

Philip Gwyn, <perl-ikc at pied.nu>

COPYRIGHT AND LICENSE

Top

SEE ALSO

Top

POE, POE::Component::IKC::Client.


POE-Component-IKC documentation Contained in the POE-Component-IKC distribution.

package POE::Component::IKC::Freezer;

############################################################
# $Id: Freezer.pm 494 2009-05-08 18:36:12Z fil $
# Copyright 2001-2009 Philip Gwyn.  All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the same terms as Perl itself.

use strict;
use Data::Dumper;

use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
use Carp;

require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(freeze thaw dclone);
$VERSION = '0.2200';

sub DEBUG { 0 }


############################################################
sub freeze
{
    my($data)=@_;
    local $Data::Dumper::Purity = 1;
    local $Data::Dumper::Indent = 0;
    local $Data::Dumper::Varname = __PACKAGE__."::VAR";
    return Dumper $data;
}

############################################################
sub thaw
{
    my($string)=@_;
    local $POE::Component::IKC::Freezer::VAR1;
    eval $string;
    return $POE::Component::IKC::Freezer::VAR1;
}

############################################################
sub dclone { thaw(freeze($_[0])); }


1;
__END__
# Below is the stub of documentation for your module. You better edit it!