- or download this
sub new {
my $proto = shift;
...
bless ($self, $class);
return $self;
}
- or download this
sub file {
my $self = shift;
...
$self->{file} = shift;
}
}
- or download this
sub _common {
my $self = shift;
...
$self->{$key}->($self) if defined $self->{$key};
}
}
- or download this
sub _common {
my $self = shift;
my $key = shift;
# ...
- or download this
sub pre {
my $self = shift;
$self->_common(pre => @_);
}
# etc.
- or download this
$self->pre();
open my $fh, '<', $self->{file} or croak "could not open $self
+->{file}: $!";
...
++$self->{count};
}
$self->post();
- or download this
my %data = $self->loop();
@{$self->{hash}{keys %data}} = values %data;
$count += scalar keys %data;