Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

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.


Comment on Re^2: Dealing with blessed scalars when using YAML::XS::Load
Select or Download Code
Re^3: Dealing with blessed scalars when using YAML::XS::Load (alias)
by tye (Cardinal) 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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://968463]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (15)
As of 2014-07-23 10:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (139 votes), past polls