NAME
Nile::Serializer - Data structures Serializer
SYNOPSIS
$data = {fname=>"ahmed", lname=>"elsheshtawy", phone=>{mobile=>"012222333", home=>"02222444"}};
$encoded = $app->freeze->json($data);
$encoded = $app->freeze->yaml($data);
$encoded = $app->freeze->storable($data);
$encoded = $app->freeze->dumper($data);
$encoded = $app->freeze->xml($data);
# also serialize method is an alias for freeze
$encoded = $app->serialize->json($data);
DESCRIPTION
Nile::Serializer - Data structures Serializer
json()
$data = {fname=>"ahmed", lname=>"elsheshtawy", phone=>{mobile=>"012222333", home=>"02222444"}};
$encoded = $app->freeze->json($data);
# returns:
# {"lname":"elsheshtawy","fname":"ahmed","phone":{"home":"02222444","mobile":"012222333"}}
Serialize a data structure to a JSON structure.
yaml()
$data = {fname=>"ahmed", lname=>"elsheshtawy", phone=>{mobile=>"012222333", home=>"02222444"}};
$encoded = $app->freeze->yaml($data);
# returns:
# ---
# fname: ahmed
# lname: elsheshtawy
# phone:
# home: 02222444
# mobile: 012222333
Serialize a data structure to a YAML structure.
storable()
$data = {fname=>"ahmed", lname=>"elsheshtawy", phone=>{mobile=>"012222333", home=>"02222444"}};
$encoded = $app->freeze->storable($data);
# returns: binary data
Serialize a data structure to a Storable structure.
dumper()
$data = {fname=>"ahmed", lname=>"elsheshtawy", phone=>{mobile=>"012222333", home=>"02222444"}};
$encoded = $app->freeze->dumper($data);
# returns:
# $M = {'lname' => 'elsheshtawy','fname' => 'ahmed','phone' => {'home' => '02222444','mobile' => '012222333'}};
Serialize a data structure to a Data::Dumper structure.
xml()
$data = {fname=>"ahmed", lname=>"elsheshtawy", phone=>{mobile=>"012222333", home=>"02222444"}};
$encoded = $app->freeze->xml($data);
# returns:
# <?xml version="1.0" encoding="UTF-8" ?>
# <fname>ahmed</fname>
# <lname>elsheshtawy</lname>
# <phone>
# <home>02222444</home>
# <mobile>012222333</mobile>
# </phone>
Serialize a data structure to a XML structure.
sereal()
$data = {fname=>"ahmed", lname=>"elsheshtawy", phone=>{mobile=>"012222333", home=>"02222444"}};
$encoded = $app->freeze->sereal($data);
# returns: binary data
Serialize a data structure to a binary data using Sereal::Encoder.
Bugs
This project is available on github at https://github.com/mewsoft/Nile.
HOMEPAGE
Please visit the project's homepage at https://metacpan.org/release/Nile.
SOURCE
Source repository is at https://github.com/mewsoft/Nile.
SEE ALSO
See Nile for details about the complete framework.
AUTHOR
Ahmed Amin Elsheshtawy, احمد امين الششتاوى <mewsoft@cpan.org> Website: http://www.mewsoft.com
COPYRIGHT AND LICENSE
Copyright (C) 2014-2015 by Dr. Ahmed Amin Elsheshtawy احمد امين الششتاوى mewsoft@cpan.org, support@mewsoft.com, https://github.com/mewsoft/Nile, http://www.mewsoft.com
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.