b374k
m1n1 1.01
Apache/2.2.15 (CentOS)
Linux obd60-6c49958d75-2q7cw 5.4.0-174-generic #193-Ubuntu SMP Thu Mar 7 14:29:28 UTC 2024 x86_64
uid=48(apache) gid=48(apache) groups=48(apache)
server ip : 104.21.65.202 | your ip : 10.244.126.0
safemode OFF
 >  / usr / share / perl5 / Tie /
Filename/usr/share/perl5/Tie/StdHandle.pm
Size1.31 kb
Permissionrw-r--r--
Ownerapache
Create time23-Dec-2025 17:41
Last modified22-Mar-2017 16:32
Last accessed22-Apr-2026 02:32
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
package Tie::StdHandle;

use strict;

use Tie::Handle;
use vars qw(@ISA $VERSION);
@ISA = 'Tie::Handle';
$VERSION = '4.2';

=head1 NAME

Tie::StdHandle - base class definitions for tied handles

=head1 SYNOPSIS

package NewHandle;
require Tie::Handle;

@ISA = qw(Tie::Handle);

sub READ { ... } # Provide a needed method
sub TIEHANDLE { ... } # Overrides inherited method


package main;

tie *FH, 'NewHandle';

=head1 DESCRIPTION

The B<Tie::StdHandle> package provide most methods for file handles described
in L<perltie> (the exceptions are C<UNTIE> and C<DESTROY>). It causes tied
file handles to behave exactly like standard file handles and allow for
selective overwriting of methods.

=cut

sub TIEHANDLE
{
my $class = shift;
my $fh = \do { local *HANDLE};
bless $fh,$class;
$fh->OPEN(@_) if (@_);
return $fh;
}

sub EOF { eof($_[0]) }
sub TELL { tell($_[0]) }
sub FILENO { fileno($_[0]) }
sub SEEK { seek($_[0],$_[1],$_[2]) }
sub CLOSE { close($_[0]) }
sub BINMODE { binmode($_[0]) }

sub OPEN
{
$_[0]->CLOSE if defined($_[0]->FILENO);
@_ == 2 ? open($_[0], $_[1]) : open($_[0], $_[1], $_[2]);
}

sub READ { read($_[0],$_[1],$_[2]) }
sub READLINE { my $fh = $_[0]; <$fh> }
sub GETC { getc($_[0]) }

sub WRITE
{
my $fh = $_[0];
print $fh substr($_[1],0,$_[2])
}


1;