`
standalone
  • 浏览: 609713 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Serialize/Deserialize Perl Class Objects

    博客分类:
  • perl
阅读更多
Today in a small project I need to serialize a perl class object to string in order to cache it. And when getting back the value from the cache I need to deserialize it to original class objects.

There are good articles on the solutions:

http://www.ohmpie.com/serialization/

http://www.onperl.net/Serializing-and-Deserializing-using-Data-Serializer-pm

http://www.perlmonks.org/?node_id=8070

http://my.safaribooksonline.com/book/programming/perl/0596004567/objects-databases-and-applications/advperl2-chp-4-sect-2


First, I tried Data::Dumper which is quite simple. But if you class object has nested reference, when deserializing you will get 'undef' for the reference. E.g., if a part of the dumped sting is like this:

                      bless( {
                               'id' => '1',
                               'date' => '20130618',
                               'date_range' => $VAR1->{'logs'}[0]{'date_range'},
                             }, 'SiteLog::Entity::Log' ),


the data_range you get will be undef.


Finally I tried FreezeThaw, it works fine!
分享到:
评论

相关推荐

    Serialize and Deserialize Java 示例程序

    Serialize and Deserialize Java 示例程序。简单来讲,它的数据格式与json类似,但是在存储时对数字、多字节字符、数组等都做了很多优化,减少了无用的字符,二进制格式,也保证不用字符化带来额外的存储空间的增加...

    藏经阁-MaxCompute 的NewSQL演进之路.pdf

    MaxCompute 2.0支持非结构、半结构和结构化数据,用户可以提供Serialize/Deserialize函数动态进行非结构到结构化转换,支持用户自定义类型,用户自定义分区从而能够有效连接上下流。 强大的DAG执行图表示 ...

    C#序列化与反序列化(Serialize,Deserialize)实例详解

    本文实例讲述了C#序列化与反序列化(Serialize,Deserialize)实现方法。分享给大家供大家参考。具体分析如下: 如果要保存运行程序过程的数据要么保存到数据库中,要么新建一个普通的文件,然后把数据保存进去.但是这...

    Android代码-Lyra

    Lyra supports automatic save/restore, base coders to serialize/deserialize values in Bundle, caching and retrieval of fields. Lyra includes a flexible API that allows developers to customize any ...

    Android代码-binaryprefs

    Binary Preferences Rapidly fast and lightweight re-...Small memory footprint while serialize/deserialize data Zero copy in-memory cache Persists only binary data. Not XML or JSON Out of box data

    java.lang.NoClassDefFoundError org.apache.xml.serializer.TreeWalker.doc

    在jsp运行过程中,报错 java.lang.NoClassDefFoundError org.apache.xml.serializer.TreeWalker时的处理方法。

    MaxCompute的NewSQL演进之路.pdf

    用户可以提供Serialize/Deserialize函数,实现非结构化数据到结构化数据的动态转换,支持用户自定义类型,并允许用户定义分区,以便能够有效地连接数据流的上游和下游。此外,MaxCompute2.0通过DAG(有向无环图)...

    快速序列化/反序列化:这些函数可以将大多数 MATLAB 数据结构序列化为字节向量,反之亦然。-matlab开发

    这是 Tim Hutt 的 Serialize/Deserialize 函数的优化重写(它在神秘的数据结构上快了 10 倍)并支持一些额外的数据类型。 已知限制: * Java 对象不能被序列化* 超过 255 个维度的数组的最后一个维度被限制* 嵌套/...

    Android代码-yamlbeans

    YamlBeans makes it easy to serialize and deserialize Java object graphs to and from YAML, a human-friendly data format. Replace XML and properties files with YAML for more expressive power (lists, ...

    c语言-leetcode题解之0297-serialize-and-deserialize-binary-tree

    c c语言_leetcode题解之0297_serialize_and_deserialize_binary_tree

    PHPSerializer.java

    php的serialize/unserialize,方便把一个数组序列化和反序列化,但是要和java交互,就比较麻烦了。通过这个工具类可实现很好的php与java的交互。 博客地址:...

    Serialize/Deseriali​ze:将几乎任何 matlab 变量编码和解码为字节序列。-matlab开发

    这对函数可以将几乎任何 matlab 对象序列化和反序列化(即编码和解码)成字节序列。 这对于将对象保存到磁盘、通过网络发送它们或发送到其他程序非常有用。 支持结构、单元格和矩阵的任何组合。...

    TIA博途-序列化指令Serialize的具体使用方法示例.docx

    同时,`Deserialize`指令提供了反序列化功能,可以从BYTE数组中恢复原始的UDT或STRUCT数据,这样可以实现数据的完整生命周期管理,从创建、传输到解析。 为了更好地掌握这个功能,建议动手实践,尝试创建自己的UDT...

    serialization-example:使用瞬态示例进行序列化和反序列化

    序列化http://localhost:8081/rest/serialize使用用户JSON的POST请求,例如{"name": "Sam", "dept", "Operation", "salary": 12000}反序列化http://localhost:8081/rest/deserialize -GET请求,该请求返回用户JSON,...

    .net Newtonsoft.Json 4.0 release

    you don't have a class to serialize or deserialize to, or the JSON is radically different from your class and you need to manually read and write from your objects. LINQ to JSON allows you to easily ...

    Json.NET 6.0 R3 For.NET(2.0-4.5)

    Json.NET Json.NET is a popular ... you don't have a class to serialize or deserialize to, or the JSON is radically different from your class and you need to manually read and write from your objects.

    matlab-json-master.zip_The Master_json matlab_matlab java class_

    This package contains Matlab class to serialize/decode matlab object in json format. The software uses org.json java package to convert json to java object and then translates it into Matlab object.

    数字视频信号的长线传输.pdf

    首先,信号的并行到串行转换(Serialize/Deserialize)是降低传输需求的关键。并行传输在处理大量数据时可能导致信号干扰和复杂度增加,而串行传输则能减少所需线路数量,通过提高单线数据速率来弥补总数据量。例如...

Global site tag (gtag.js) - Google Analytics