NAME
Data::Serializer::Raw - Provides unified raw interface to perl serializers
SYNOPSIS
use Data::Serializer::Raw;
$obj = Data::Serializer::Raw->new();
$obj = Data::Serializer::Raw->new(serializer => 'Storable');
$serialized = $obj->serialize({a => [1,2,3],b => 5});
$deserialized = $obj->deserialize($serialized);
print "$deserialized->{b}\n";
DESCRIPTION
Provides a unified interface to the various serializing modules currently available.
This is a straight pass through to the underlying serializer, nothing else is done. (no encoding, encryption, compression, etc)
EXAMPLES
- Please see Data::Serializer::Cookbook(3)
METHODS
- new - constructor
-
$obj = Data::Serializer::Raw->new(); $obj = Data::Serializer::Raw->new( serializer => 'Data::Dumper', options => {}, );
new is the constructor object for Data::Serializer::Raw objects.
The default serializer is
Data::Dumper
The default options is
{}
(pass nothing on to serializer)
- serialize - serialize reference
-
$serialized = $obj->serialize({a => [1,2,3],b => 5});
This is a straight pass through to the underlying serializer, nothing else is done. (no encoding, encryption, compression, etc)
- deserialize - deserialize reference
-
$deserialized = $obj->deserialize($serialized);
This is a straight pass through to the underlying serializer, nothing else is done. (no encoding, encryption, compression, etc)
- options - pass options through to underlying serializer
-
Currently is only supported by Config::General, and XML::Dumper.
my $obj = Data::Serializer::Raw->new(serializer => 'Config::General', options => { -LowerCaseNames => 1, -UseApacheInclude => 1, -MergeDuplicateBlocks => 1, -AutoTrue => 1, -InterPolateVars => 1 }, ) or die "$!\n"; or my $obj = Data::Serializer::Raw->new(serializer => 'XML::Dumper', options => { dtd => 1, } ) or die "$!\n";
AUTHOR
Neil Neely <neil@neely.cx>.
http://neil-neely.blogspot.com/
BUGS
Please report all bugs here:
http://rt.cpan.org/Public/Dist/Display.html?Name=Data-Serializer
COPYRIGHT AND LICENSE
Copyright (c) 2011 Neil Neely. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.2 or, at your option, any later version of Perl 5 you may have available.
See http://www.perl.com/language/misc/Artistic.html
ACKNOWLEDGEMENTS
Peter Makholm took the time to profile Data::Serializer(3) and pointed out the value of having a very lean implementation that minimized overhead and just used the raw underlying serializers.
SEE ALSO
perl(1), Data::Serializer(3).