Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

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]
[robby_dobby]: I was falling asleep at my chair and threw out that one bit about participating in a YAPC. Things went from there :-)
[erix]: never too late to pull legs
[LanX]: Official YAPC Africa 2013 Announcement
erix always game to pull legs from sleeping cells
[erix]: hm nice might do a spot of diving - Red Sea is said to be beautiful
[LanX]: well too many terrorist tourists
[erix]: I guess I can pass for a native
[LanX]: talking about destruction of diving spots
[LanX]: Nodes to consider
[erix]: oops - got to run, see you later

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (13)
As of 2017-04-24 16:17 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (442 votes). Check out past polls.