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


in reply to Re: Dealing with blessed scalars when using YAML::XS::Load
in thread Dealing with blessed scalars when using YAML::XS::Load

tye, Thank you for the solution. I'm sorry I did not include the output. It's a scalar ref. Output:
java.util.UUID=SCALAR(0x100800e60) java.util.UUID
I looked at unbless but we are changing YAML handling in a framework used by other people, so the solution needs to result in scalars or objects that can be treated like strings. I appreciate the suggestion though. Can you explain why you put the _alias step in? What is the advantage? I found this equally effective:
BEGIN { { package YAML::Sucks::JavaUtilUUID; } $main::{'java.util.UUID::'} = $YAML::Sucks::{'JavaUtilUUID::'}; }
Again, thanks.

Replies are listed 'Best First'.
Re^3: Dealing with blessed scalars when using YAML::XS::Load (alias)
by tye (Sage) on May 02, 2012 at 16:07 UTC

    Aliasing a package like that is not expected. There may be things that break in the face of it. So I reduced the number of things that have to deal with that aliased package to a single thing, @ISA. Then one doesn't have to worry about ambiguity in the code context or name of a method or ref-counting issues or some other problem that might result from the hackish aliasing.

    - tye