[Bioperl-l] Auto-method caller proposal

Sendu Bala bix at sendu.me.uk
Thu Jan 4 10:15:37 UTC 2007


aaron.j.mackey at gsk.com wrote:
> I'm not against this at all, but let's not reinvent a (somewhat-standard) 
> wheel: see Class::MethodMaker and accompanying tools.

It would certainly be possible for a module author to make use of 
Class::MethodMaker, but from what I can see each module would have to 
use Class::MethodMaker itself, leaving them to setup and configure it in 
their own way, and still leaving them to handle how user arguments 
become method values.

The primary motivation for this proposal is to provide an incredibly 
simple and consistent way of turning user args into method values. 
Method creation was just an added extra, implemented since the burden 
was just a few extra lines of trivial code. I don't see any significant 
benefit* of farming out to another class to do that simple thing, only 
the disadvantage of adding what would be a third (true) pre-requisite 
for Bioperl installation.


>> We can have the nicer:
>>
>> package Bio::Tools::Run::GoodBoy;
>> sub new {
>>    my ($class, @args) = @_;
>>    my $self = $class->SUPER::new(@args);
>>
>>    $self->_set_from_args(\@args,
>>                          -methods => [qw(id score evalue)]);
>>
>>    return $self;
>> }
>> # methods...
>> 1;


[*] The only benefit I see is that Class::MethodMaker lets you create 
methods for storing arrays and hashes, not just scalars. But in Bioperl 
we don't 'like' auto-created methods, using them primarily for the 
simple scalar get/setters needed by run-wrappers where it would be too 
tedious to implement them all directly.



More information about the Bioperl-l mailing list