moose / MooseX-Storage

A serialization framework for Moose classes
http://metacpan.org/release/MooseX-Storage/
Other
6 stars 11 forks source link

Using custom type handler for objects inside array/hash refs #10

Open ryan-lang opened 9 years ago

ryan-lang commented 9 years ago

The docs mention that arrayrefs and hashrefs will be inspected up to one level down to serialize/deserialize any objects that are found, which is great. However, it appears that rather than checking types against the main types list, all blessed objects are passed directly to the generic "object handler". This means that any custom types added with add_custom_type_handler are ignored in this scenario.

Can anyone shed some light on whether this is by-design, a potential area of improvement, or if there's a good workaround?

ryan-lang commented 9 years ago

Specifically, the code in question: https://metacpan.org/source/ETHER/MooseX-Storage-0.49/lib/MooseX/Storage/Engine.pm#L279 (MooseX::Storage::Engine, Lines 279 - 281)

karenetheridge commented 9 years ago

Ryan, is this a regression in 0.49? The logic with deep objects has recently been enhanced.

On Mon, Apr 6, 2015 at 3:46 PM, ryan-lang notifications@github.com wrote:

Specifically, the code in question:

https://metacpan.org/source/ETHER/MooseX-Storage-0.49/lib/MooseX/Storage/Engine.pm#L279 (MooseX::Storage::Engine, Lines 279 - 281)

— Reply to this email directly or view it on GitHub https://github.com/moose/MooseX-Storage/issues/10#issuecomment-90269356.

ryan-lang commented 9 years ago

No, the code in question seems to have existed in at least the last couple versions.

Comparing them now, I see that 0.49 added some new logic nearby, but didn't alter the part that sends all blessed objects to the generic handler (not checked for custom type handlers).