Title: RE: Class::FakeAttributes -- Opinions Wanted

> I guess in the absence of Class::InsideOut, having
> Class::OutOfBandAttributes as a band-aid isn't a bad idea.
> (There's a lot of orders of magnitude less useful stuff out on
> CPAN..)

Primary problem with creating a Class::InsideOut is the problem of where the hashes go.

If you dont mind using dynamics for them then you have no problem. If you want them in lexicals then I would say theres not much room to manoever, and 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.

Yves

Reply via email to