Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re^2: Dealing with blessed scalars when using YAML::XS::Load

by Anonymous Monk
on May 02, 2012 at 14:59 UTC ( #968463=note: print w/replies, xml ) Need Help??

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        

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://968463]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2018-06-19 05:27 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (111 votes). Check out past polls.