in reply to Language features affect style
Admittedly the boilerplate issue is still there.use strict; use warnings; package Foo; sub new { bless {salary => 100} } my $private_method = sub { my $self = shift; my $factor = shift || 2; $self->{salary} *= $factor; }; sub get_salary { my $self = shift; $self->$private_method(10); return $self->{salary}; } package main; my $foo = Foo->new; printf "salary is %s\n", $foo->get_salary;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Language features affect style
by TimToady (Parson) on Jun 08, 2009 at 15:17 UTC | |
by John M. Dlugosz (Monsignor) on Jun 09, 2009 at 19:13 UTC | |
by TimToady (Parson) on Jun 09, 2009 at 23:15 UTC | |
by John M. Dlugosz (Monsignor) on Jun 10, 2009 at 17:01 UTC | |
by TimToady (Parson) on Jun 10, 2009 at 19:20 UTC | |
| |
by Anonymous Monk on Jun 08, 2009 at 15:30 UTC | |
by holli (Abbot) on Jun 10, 2009 at 06:51 UTC |