Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Are array based objects fixed length?

by BrentDax (Hermit)
on Jul 26, 2002 at 13:18 UTC ( [id://185530]=note: print w/replies, xml ) Need Help??


in reply to Are array based objects fixed length?

I'd suggest that in the general case you use a Pixie::Array wrapper with an overloaded @{} operator. The overloaded @{} would return the host object's data; Pixie would know how to get its stuff out of a Pixie::Array.

Or something like that. It's a pretty hard problem. *shrugs*

<thought type="evil">Could you set up an overloaded @{} in UNIVERSAL that would implement this behavior? That would solve the problem of Pixie::Array's blessing. Alternatively, Pixie::Arrays could keep track of their "real" blessing and redispatch:

package Pixie::Array; sub PIXIE_getoid { return shift->{oid} } # ... sub AUTOLOAD { return shift->{realobj}->$AUTOLOAD(@_) }
</thought>

=cut
--Brent Dax
There is no sig.

Replies are listed 'Best First'.
Re: Re: Are array based objects fixed length?
by pdcawley (Hermit) on Sep 05, 2002 at 20:33 UTC
    The problem with overloading @{} in UNIVERSAL is what happens when one of the storedclasses has overloading in place?

    I have already discovered to my cost that reblessing and overloading do not play well together; you get all sorts of painful spooky inaction at a distance (ie: The spooky action at a distance you were hoping would happen doesn't).

    However, my boss recently played a blinder when he had the idea of using XS to hang sv_magic off the object which, (after a certain amount of buggering about due to problems with sv_unmagic being a little, well, eager) combined with a weakref back to the object for DESTROY convenience gives us what we need. And, marvellously, it dramatically simplifies our object tracking and caching code and removes the need to rebless into a 'managed' class. Now the only reblessing we need to worry about is when a proxy object gets restored.

    This is probably not the place for a Pixie walkthrough though. I'll see about preparing a meditation on some of the tricks we get up to in order to 'just work' for the client.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-24 22:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found