http://qs321.pair.com?node_id=769498


in reply to Language features affect style

A contrived example showing that private methods can be simulated with lexical coderefs:
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;
Admittedly the boilerplate issue is still there.