##
sub content {
my $self = shift;
if (@_) {
my $set = shift;
if (isa($set,"CODE")) {
# fixed :-)
&$set for $self->{'content'}; # Code to modify content (as $_) gets executed
}
else {
$self->{'content'} = $set; # Direct set
}
}
$self->{'content'};
}
####
$self->content =~ s/foo/bar/g;
# instead of
# $self->content(map { s/foo/bar/g } map $_, $self->content);