Subject: | Add getline method |
It would be nice to add a "getline" alias for the "readline" method to achieve API compatibility with IO::Handle. That way I don't have to write
my $nextline = $LOGFILE->can("readline")
? sub { $LOGFILE->readline }
: sub { $LOGFILE->getline };
to be able to read forward or backward in the same piece of code.
See the attached patch.
Regards,
Slaven
#
#
# To apply this patch:
# STEP 1: Chdir to the source directory.
# STEP 2: Run the 'applypatch' program with this patch file as input.
#
# If you do not have 'applypatch', it is part of the 'makepatch' package
# that you can fetch from the Comprehensive Perl Archive Network:
# http://www.perl.com/CPAN/authors/Johan_Vromans/makepatch-x.y.tar.gz
# In the above URL, 'x' should be 2 or higher.
#
# To apply this patch without the use of 'applypatch':
# STEP 1: Chdir to the source directory.
# STEP 2: Run the 'patch' program with this file as input.
#
#### End of Preamble ####
#### Patch data follows ####
diff -up '/usr/local/dist/cpan/build/File-ReadBackwards-1.02/ReadBackwards.pm' 'File-ReadBackwards-1.02/ReadBackwards.pm'
Index: ./ReadBackwards.pm
--- ./ReadBackwards.pm Fri Nov 21 07:54:39 2003
+++ ./ReadBackwards.pm Wed Jun 2 11:30:03 2004
@@ -50,6 +50,10 @@ BEGIN {
*EOF = \&eof ;
*CLOSE = \&close ;
*TELL = \&tell ;
+
+# this is for IO::Handle API compatibility:
+
+ *getline = \&readline ;
}
@@ -280,6 +284,10 @@ Readline takes no arguments and it retur
file or undef when there are no more lines in the file. If the file is
a non-seekable file (e.g. a pipe), then undef is returned.
+=head2 getline
+
+Getline is an alias for readline().
+
=head2 eof
Eof takes no arguments and it returns true when readline() has
#### End of Patch data ####
#### ApplyPatch data follows ####
# Data version : 1.0
# Date generated : Wed Jun 2 11:37:03 2004
# Generated by : makepatch 2.00_11*
# Recurse directories : Yes
# Excluded files : (\A|/).*\~\Z
# (\A|/).*\.a\Z
# (\A|/).*\.bak\Z
# (\A|/).*\.BAK\Z
# (\A|/).*\.elc\Z
# (\A|/).*\.exe\Z
# (\A|/).*\.gz\Z
# (\A|/).*\.ln\Z
# (\A|/).*\.o\Z
# (\A|/).*\.obj\Z
# (\A|/).*\.olb\Z
# (\A|/).*\.old\Z
# (\A|/).*\.orig\Z
# (\A|/).*\.rej\Z
# (\A|/).*\.so\Z
# (\A|/).*\.Z\Z
# (\A|/)\.del\-.*\Z
# (\A|/)\.make\.state\Z
# (\A|/)\.nse_depinfo\Z
# (\A|/)core\Z
# (\A|/)tags\Z
# (\A|/)TAGS\Z
# p 'ReadBackwards.pm' 9211 1086168603 0100644
#### End of ApplyPatch data ####
#### End of Patch kit [created: Wed Jun 2 11:37:03 2004] ####
#### Patch checksum: 60 2002 62271 ####
#### Checksum: 78 2626 48247 ####