romerun
romerun

Reputation: 2211

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 job, but I'm not sure if they are the popular ones .

Upvotes: 1

Views: 180

Answers (3)

mzedeler
mzedeler

Reputation: 4369

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.

Upvotes: 3

evil otto
evil otto

Reputation: 10582

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.

Upvotes: -1

bvr
bvr

Reputation: 9697

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.

Upvotes: 3

Related Questions