File-Replace-Fancy
view release on metacpan or search on metacpan
lib/File/Replace/SingleHandle.pm view on Meta::CPAN
#!perl
package # hide from pause
File::Replace::SingleHandle;
use warnings;
use strict;
use Carp;
use warnings::register;
use Scalar::Util qw/blessed weaken/;
# For AUTHOR, COPYRIGHT, AND LICENSE see the bottom of this file
our $VERSION = '0.18';
## no critic (RequireFinalReturn, RequireArgUnpacking)
BEGIN {
require Tie::Handle::Base;
our @ISA = qw/ Tie::Handle::Base /; ## no critic (ProhibitExplicitISA)
lib/File/Replace/SingleHandle.pm view on Meta::CPAN
$other = $repl->out_fh; }
elsif ($mode eq 'out') {
$innerhandle = $repl->out_fh;
$other = $repl->in_fh; }
elsif ($mode eq 'onlyout') {
$innerhandle = $repl->out_fh; }
else { croak "bad mode" }
my $self = $class->SUPER::TIEHANDLE($innerhandle);
$self->{repl} = $repl;
$self->{other} = $other;
weaken( $self->{other} );
return $self;
}
sub replace { return shift->{repl} }
sub in_fh { return shift->{repl}->in_fh }
sub out_fh { return shift->{repl}->out_fh }
sub OPEN { croak "Can't reopen a ".ref($_[0])." handle" }
sub CLOSE {
( run in 0.261 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )