develooper Front page | perl.module-authors | Postings from November 2003

RE: Class::FakeAttributes -- Opinions Wanted

Thread Previous | Thread Next
Orton, Yves
November 3, 2003 08:32
RE: Class::FakeAttributes -- Opinions Wanted
Message ID:
> 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 (@_) {
          return $s;
      } else {
          return $attrib{refaddr($s)};

The refaddr is useful because it allows for $s to have stringification


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About