Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: (tye)Re4: ref, no, maybe?

by chromatic (Archbishop)
on Jan 11, 2001 at 07:07 UTC ( [id://51067]=note: print w/replies, xml ) Need Help??


in reply to (tye)Re4: ref, no, maybe?
in thread ref, no, maybe?

I'm not sure this is a good example.

If you're inside your own class, you ought to know if it's a blessed hash or not without calling ref on it.

Not that I haven't violated that rule a few times... but we could all come up with outrageous examples where this doesn't work. We're just too smart for our own good; let's leave it at that.

Replies are listed 'Best First'.
(tye)Re5: ref, no, maybe?
by tye (Sage) on Jan 11, 2001 at 08:00 UTC

    Sorry, you misunderstood me. The problem is that I write a module, Tye::IsCool, that implements objects as blessed references to a hash. Well, you already wrote a module called Chromatic::HashMangler which is just the cat's pajamas and does interesting things to hashes.

    Well, inside of sub Tye::IsCool::AmazeNAstound() I want to use your module to do complex things to the hash that implements my object. But your module does:

    sub Chromatic::HashMangler::DeepMagic { my $refToHashToMangle= shift; croak "You suck" unless "HASH" eq ref($refToHashToMangle);
    so I'm screwed because you won't get "HASH"; you'll get "Tye::IsCool" and croak.

    Its a been a long day for me (and it isn't over yet), so I hope that makes more sense. :-}

            - tye (but my friends call me "Tye")

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-19 07:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found