summaryrefslogtreecommitdiff
path: root/ext/IO
diff options
context:
space:
mode:
authorPaul Johnson <paul@pjcj.net>1999-04-29 07:28:14 +0100
committerGurusamy Sarathy <gsar@cpan.org>1999-05-10 09:34:22 +0000
commit91cce2638d90409b99ef27a8e545f2452318f884 (patch)
treeffbc3611a8e91763bf508c29fd95d6f0950363d3 /ext/IO
parent767d463e9a7ba83b304a4002716436d480285abb (diff)
downloadperl-91cce2638d90409b99ef27a8e545f2452318f884.tar.gz
test suite and fix input_line_number()
Message-ID: <19990429062814.A17906@west-tip.transeda.com> Subject: [PATCH] IO::Handle 1.20 (was Re: FAIL Gedcom-1.01 i86pc-solaris 2.6) p4raw-id: //depot/perl@3365
Diffstat (limited to 'ext/IO')
-rw-r--r--ext/IO/lib/IO/Handle.pm15
1 files changed, 15 insertions, 0 deletions
diff --git a/ext/IO/lib/IO/Handle.pm b/ext/IO/lib/IO/Handle.pm
index 1063f1ad83..02595e50a5 100644
--- a/ext/IO/lib/IO/Handle.pm
+++ b/ext/IO/lib/IO/Handle.pm
@@ -468,16 +468,31 @@ sub input_record_separator {
}
sub input_line_number {
+ # local $. does not work properly, so we need to do it some other
+ # way. We use select, although this is not quite right. What we
+ # really need to know is the file handle that was the subject of the
+ # last read, seek or tell.
my $now = select;
my $keep = $.;
my $tell = tell qualify($_[0], caller) if ref($_[0]);
my $prev = $.;
$. = $_[1] if @_ > 1;
+ no strict "refs";
$tell = tell $now;
$. = $keep;
$prev;
}
+=for when local $. works properly
+sub input_line_number {
+ local $.;
+ my $tell = tell qualify($_[0], caller) if ref($_[0]);
+ my $prev = $.;
+ $. = $_[1] if @_ > 1;
+ $prev;
+}
+=cut
+
sub format_page_number {
my $old = new SelectSaver qualify($_[0], caller) if ref($_[0]);
my $prev = $%;