* Orton, Yves <[EMAIL PROTECTED]> [2003-11-03 17:34]:
> in hind site implementing an inside out object/attribute is so
> easy (its pretty small, heres what I use for good general
> coverage:)
>
> use Scalar::Util qw(refaddr);
>
> {
> my %attrib;
> sub inside_out {
> my $s=shift;
> if (@_) {
> $attrib{refaddr($s)}=shift;
> return $s;
> } else {
> return $attrib{refaddr($s)};
> }
> }
> }
>
> The refaddr is useful because it allows for $s to have
> stringification overloaded.
Precisely this bugs me about it.. you have to type out the
refaddr everywhere; and even without overloading, there's good
reasons not to just write $self (but stuff like 0+$self or
whatever).
And then there's accessor/mutator generation.. ie what
::MethodMaker does. Which there seems to be no easy way to do
(with lexicals) using inside out objects..
--
Regards,
Aristotle
"If you can't laugh at yourself, you don't take life seriously enough."