开发者

Perl module that works like Data::Dumper but allow data manipulation

Is there a popular Perl module that works like Data::Dumper but allows user to write hook to manipulate the data inside complex structure or object.

There are a few modules showing up in google such as Data::Visitor or Data::Structure::Util that might do the jo开发者_StackOverflow社区b, but I'm not sure if they are the popular ones .


I've written Data::Dmap to do this, but as mentioned, Data::Rmap, Data::Transformer and Data::Visitor are also relevant.

The basic idea of Data::Dmap is that it allows you to transform anything in a nested data structure and still tries to behave like the built in map function.


I am not sure it is what you mean, but Data::Dump supports hooks to filter dumped data. Similar hooks are also possible in Data::Printer.

Edit: If you need editing, I would look at Data::Rmap or Data::Transformer. Also, if your structure is simple (say only scalars, hashes and arrays), you can make simple recursive traversal yourself.


YAML is a nice serialization format, easy to edit string values and such. It might not handle all your objects, but it's worth a try, and it both serializes and reloads things easily.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜