perldoc > Data::Serializer::Raw

📛 NAME

Data::Serializer::Raw - Provides unified raw interface to perl serializers

🚀 Quick Reference

Use CaseCommandDescription
🔧 Serialize data$serialized = $obj->serialize({a => [1,2,3],b => 5});Convert reference to a serialized string
🔓 Deserialize data$deserialized = $obj->deserialize($serialized);Convert serialized string back to reference
💾 Store to file$obj->store($data, $file);Serialize and write to a file or filehandle
📂 Retrieve from filemy $data = $obj->retrieve($file);Read and deserialize from a file or filehandle
âš™ī¸ Change serializer$obj->serializer('Storable');Switch the backend serializer (e.g. Storable, JSON, YAML)
đŸŽ›ī¸ Pass serializer optionsmy $obj = Data::Serializer::Raw->new(serializer => 'Config::General', options => { -LowerCaseNames => 1 });Provide options hash to the underlying serializer

📜 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();

or

$obj = Data::Serializer::Raw->new(
    serializer => 'Data::Dumper',
    options    => {},
);

new is the constructor object for Data::Serializer::Raw objects.

đŸ“Ļ 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)

âš™ī¸ serializer - change the serializer

Currently supports the following serializers:

Default is to use Data::Dumper.

Each serializer has its own caveats about usage especially when dealing with cyclical data structures or CODE references. Please see the appropriate documentation in those modules for further information.

đŸŽ›ī¸ options - pass options through to underlying serializer

Currently is only supported by Config::General(3), and XML::Dumper(3).

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";

💾 store - serialize data and write it to a file (or file handle)

$obj->store({a => [1,2,3],b => 5},$file, [$mode, $perm]);

or

$obj->store({a => [1,2,3],b => 5},$fh);

Serializes the reference specified using the serialize method and writes it out to the specified file or filehandle.

If a file path is specified you may specify an optional mode and permission as the next two arguments. See IO::File for examples.

Trips an exception if it is unable to write to the specified file.

📂 retrieve - read data from file (or file handle) and return it after deserialization

my $ref = $obj->retrieve($file);

or

my $ref = $obj->retrieve($fh);

Reads first line of supplied file or filehandle and returns it deserialized.

👤 AUTHOR

Neil Neely <neil AT 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).

Data::Serializer::Raw
📛 NAME 🚀 Quick Reference 📜 SYNOPSIS 📖 DESCRIPTION 👨‍đŸĢ EXAMPLES đŸ› ī¸ METHODS
🆕 new - constructor đŸ“Ļ serialize - serialize reference đŸ“Ŧ deserialize - deserialize reference âš™ī¸ serializer - change the serializer đŸŽ›ī¸ options - pass options through to underlying serializer 💾 store - serialize data and write it to a file (or file handle) 📂 retrieve - read data from file (or file handle) and return it after deserialization
👤 AUTHOR 🐛 BUGS ÂŠī¸ COPYRIGHT AND LICENSE 🙏 ACKNOWLEDGEMENTS 🔗 SEE ALSO

Generated by phpman v4.9.25-4-g0d844aa · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-07 07:10 @216.73.217.93
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!
Enhanced by LLM: deepseek-v4-pro / taotoken.net / www.chedong.com - original format

^_top_^