| Next | Tricks of the Wizards | 198 |
This is how Sarathy's clever Alias module works.
A typical object:
{ SALARY => 45_000, Children => ['Ishmael', 'Isaac'] }
A typical method:
sub method {
my $self = attr shift; # Alias::attr
$SALARY *= 1.06; # Raise salary 6%
print "You have lovely children, named @Children.\n";
pop @Children; # Pay the price for that 6%
}
| Next | ![]() |
Copyright © 2003 M. J. Dominus |