Re: [Module-build-general] [PATCH] Better Makefile.PLs. Property methods.
Status: Beta
Brought to you by:
kwilliams
|
From: Michael G S. <sc...@po...> - 2003-08-11 12:22:30
|
On Mon, Aug 11, 2003 at 11:02:29AM +0100, Steve Purkis wrote:
> Can I also suggest a slight variation on the accessor methods to return
> $self in 'set' context, ie:
>
> *{$property} = sub {
> my $self = shift;
> if (@_) { $self->{$property} = $_[0]; return $self; }
> else { return $self->{$property}; }
> };
>
> # means I can do this:
> $self->module_name( 'Foo' )
> ->install_base( '/home/foo' );
$self->module_name( 'Foo' );
$self->install_base( '/home/foo' );
It doesn't buy much.
And it means you can't simultaneously set and get.
do_this if $self->module_bleh( $foo );
--
Michael G Schwern sc...@po... http://www.pobox.com/~schwern/
Hold on while I slip into something a little more naked.
|