| Next | Higher-Order Perl | 123 |
People are funny about syntax:
$freds_account->('deposit', 123.45); # Ick
$freds_account->deposit(123.45); # Yum
No problem:
package Bank_Account;
sub new {
my $class = shift;
my $bank_account = make_bank_account(@_);
bless $bank_account => $class;
}
sub deposit {
my $self = shift;
$self->('deposit', @_);
}
| Next | ![]() |
![]() |
Copyright © 2006 M. J. Dominus |