sub TIEHANDLE { my ($class, %args) = @_; my $handle = gensym(); my $impl = bless { handle => gensym() }, $class; $impl->OPEN (%args); return $impl; } sub OPEN { my ($impl, %args) = @_; open $impl->{handle}, $args{file} or croak "Could not open '$args{file}'"; $impl->{in_filter} = $args{in} || \&_no_filter; $impl->{out_filter} = $args{out} || \&_no_filter; }