package FileHandle; use Carp; sub lock { my $self = shift; flock($self, 8) or confess("Cannot lock file: $!"); }