in reply to Re: RFC: The Poor Man's Accessor Filter
in thread RFC: The Poor Man's Accessor Filter

Ah, I didn't realize source filters were so flighty. A shame.

Class::InsideOut and Object::Inside look nice. The former looks svelte and perhaps easier to pick up, while the latter appears to be more comprehensive.
  • Comment on Re^2: RFC: The Poor Man's Accessor Filter

Replies are listed 'Best First'.
Re^3: RFC: The Poor Man's Accessor Filter
by Arunbear (Prior) on Oct 08, 2008 at 17:13 UTC
    There is also ovid's Class::BuildMethods which does not care how you implement your objects (but can work with the inside out kind), e.g.
    package Soldier; use strict; use Class::BuildMethods 'name', rank => { default => 'private' }; sub new { my $class = shift; return bless [] => $class; } package main; use warnings; use Data::Dumper; my $foo = Soldier->new; $foo->name('John'); $foo->rank('Major'); printf "name: %s, rank: %s\n", $foo->name, $foo->rank; print Dumper($foo) . "\n";
    output:
    name: John, rank: Major $VAR1 = bless( [], 'Soldier' );
      Ummm, I like that quite a bit. So my new code would look like this:
      package Games::Traveller::Sophont; { use Class::BuildMethods qw/ name longname homeworld star orbit status niche ... etc ... /; sub new { bless {}, shift } ... etc ... } 1; package My::Purple::Blovinator; my $foo = new Games::Traveller::Sophont; $foo->name( "Chamaxi" ); ... etc ...
      Yeah... yeah, I think I like that a lot.