Re: lvaluable AUTOLOAD (help! Abigail! someone!)
- From: Dodger <el.dodgero@xxxxxxxxx>
- Date: Tue, 6 May 2008 04:13:07 -0700 (PDT)
On May 6, 3:53 am, I wrote:
I decided I wanted to see if I could reproduce the effects of some
pretty common code in Perl. For instance, the Ruby version:
...
Is there away around this? Can I make this work?
BTW, I know of course I can easily do it without AUTOLOAD:
sub new($$$) {
my $class = shift;
my $self = {};
$self->{_vars}->{protected} = [qw(title)];
$self->{_discard} = undef;
bless $self, ref $class || $class;
$self->{title} = shift;
$self->{price} = shift;
return $self;
}
sub title {
shift->{title};
}
sub price : lvalue {
shift->{price};
}
That works fine. However, it seemed so strongly that I should be able
to do it with AUTOLOAD too...
--
Sean 'Dodger' Cannon
.
- References:
- lvaluable AUTOLOAD (help! Abigail! someone!)
- From: Dodger
- lvaluable AUTOLOAD (help! Abigail! someone!)
- Prev by Date: lvaluable AUTOLOAD (help! Abigail! someone!)
- Next by Date: Re: lvaluable AUTOLOAD (help! Abigail! someone!)
- Previous by thread: lvaluable AUTOLOAD (help! Abigail! someone!)
- Next by thread: Re: lvaluable AUTOLOAD (help! Abigail! someone!)
- Index(es):
Relevant Pages
|
|