Change 31689 by [EMAIL PROTECTED] on 2007/08/08 17:27:48

        Subject: [PATCH] Move Tie::StdHandle into its own file.
        From: Michael G Schwern <[EMAIL PROTECTED]>
        Date: Tue, 07 Aug 2007 15:47:31 -0700
        Message-Id: <[EMAIL PROTECTED]>

Affected files ...

... //depot/perl/MANIFEST#1609 edit
... //depot/perl/lib/Tie/Handle.pm#17 edit
... //depot/perl/lib/Tie/Handle/stdhandle.t#2 edit
... //depot/perl/lib/Tie/Handle/stdhandle_from_handle.t#1 add
... //depot/perl/lib/Tie/StdHandle.pm#1 add

Differences ...

==== //depot/perl/MANIFEST#1609 (text) ====
Index: perl/MANIFEST
--- perl/MANIFEST#1608~31687~   2007-08-08 09:43:49.000000000 -0700
+++ perl/MANIFEST       2007-08-08 10:27:48.000000000 -0700
@@ -2765,6 +2765,7 @@
 lib/Tie/File/t/42_offset.t     Unit tests for the offset method
 lib/Tie/Handle.pm              Base class for tied handles
 lib/Tie/Handle/stdhandle.t     Test for Tie::StdHandle
+lib/Tie/Handle/stdhandle_from_handle.t Test for Tie::StdHandle/Handle 
backwards compat
 lib/Tie/Hash/NamedCapture.pm   Implements %- and %+ behaviour
 lib/Tie/Hash.pm                        Base class for tied hashes
 lib/Tie/Memoize.pm             Base class for memoized tied hashes
@@ -2776,6 +2777,7 @@
 lib/Tie/RefHash/threaded.t     Test for Tie::RefHash with threads
 lib/Tie/Scalar.pm              Base class for tied scalars
 lib/Tie/Scalar.t               See if Tie::Scalar works
+lib/Tie/StdHandle.pm           Tie::StdHandle
 lib/Tie/SubstrHash.pm          Compact hash for known key, value and table size
 lib/Tie/SubstrHash.t           Test for Tie::SubstrHash
 lib/Time/gmtime.pm             By-name interface to Perl's builtin gmtime

==== //depot/perl/lib/Tie/Handle.pm#17 (text) ====
Index: perl/lib/Tie/Handle.pm
--- perl/lib/Tie/Handle.pm#16~17374~    2002-06-28 05:07:49.000000000 -0700
+++ perl/lib/Tie/Handle.pm      2007-08-08 10:27:48.000000000 -0700
@@ -3,9 +3,13 @@
 use 5.006_001;
 our $VERSION = '4.1';
 
+# Tie::StdHandle used to be inside Tie::Handle.  For backwards compatibility
+# loading Tie::Handle has to make Tie::StdHandle available.
+use Tie::StdHandle;
+
 =head1 NAME
 
-Tie::Handle, Tie::StdHandle  - base class definitions for tied handles
+Tie::Handle - base class definitions for tied handles
 
 =head1 SYNOPSIS
 
@@ -194,41 +198,4 @@
     croak "$pkg doesn't define a CLOSE method";
 }
 
-package Tie::StdHandle; 
-our @ISA = 'Tie::Handle';
-use Carp;
-
-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;

==== //depot/perl/lib/Tie/Handle/stdhandle.t#2 (xtext) ====
Index: perl/lib/Tie/Handle/stdhandle.t
--- perl/lib/Tie/Handle/stdhandle.t#1~10676~    2001-06-17 21:17:15.000000000 
-0700
+++ perl/lib/Tie/Handle/stdhandle.t     2007-08-08 10:27:48.000000000 -0700
@@ -5,7 +5,7 @@
     @INC = '../lib';
 }
 
-use Tie::Handle;
+use Tie::StdHandle;
 tie *tst,Tie::StdHandle;
 
 $f = 'tst';

==== //depot/perl/lib/Tie/Handle/stdhandle_from_handle.t#1 (text) ====
Index: perl/lib/Tie/Handle/stdhandle_from_handle.t
--- /dev/null   2007-03-19 09:41:43.516454971 -0700
+++ perl/lib/Tie/Handle/stdhandle_from_handle.t 2007-08-08 10:27:48.000000000 
-0700
@@ -0,0 +1,18 @@
+#!./perl
+
+BEGIN {
+    chdir 't' if -d 't';
+    @INC = '../lib';
+}
+
+use Test::More tests => 1;
+
+use Tie::Handle;
+
+{
+    package Foo;
+    @ISA = qw(Tie::StdHandle);
+}
+
+# For backwards compatabilty with 5.8.x
+ok( Foo->can("TIEHANDLE"), "loading Tie::Handle loads TieStdHandle" );

==== //depot/perl/lib/Tie/StdHandle.pm#1 (text) ====
Index: perl/lib/Tie/StdHandle.pm
--- /dev/null   2007-03-19 09:41:43.516454971 -0700
+++ perl/lib/Tie/StdHandle.pm   2007-08-08 10:27:48.000000000 -0700
@@ -0,0 +1,40 @@
+package Tie::StdHandle; 
+
+use Tie::Handle;
+our @ISA = 'Tie::Handle';
+use Carp;
+
+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;
End of Patch.

Reply via email to