Skip Menu |

This queue is for tickets about the File-ReadBackwards CPAN distribution.

Report information
The Basics
Id: 6476
Status: resolved
Priority: 0/
Queue: File-ReadBackwards

People
Owner: Nobody in particular
Requestors: slaven [...] rezic.de
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 1.02
Fixed in: (no value)



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 ####
From: srezic [...] cpan.org
[SREZIC - Wed Jun 2 05:46:07 2004]: Show quoted text
> 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. >
Any comments to the suggested patch? Regards, Slaven
To: bug-File-ReadBackwards [...] rt.cpan.org
CC: undisclosed-recipients: ;
Subject: Re: [cpan #6476] Add getline method
From: Uri Guttman <uri [...] stemsystems.com>
Date: Fri, 15 Apr 2005 11:13:16 -0400
RT-Send-Cc:
Show quoted text
>>>>> "SRvR" == Slaven Rezic via RT <bug-File-ReadBackwards@rt.cpan.org> writes:
Show quoted text
SRvR> This message about File-ReadBackwards was sent to you by SREZIC <SREZIC@cpan.org> via rt.cpan.org
Show quoted text
SRvR> Full context and any attached attachments can be found at: SRvR> <URL: https://rt.cpan.org/Ticket/Display.html?id=6476 >
Show quoted text
SRvR> [SREZIC - Wed Jun 2 05:46:07 2004]:
Show quoted text
>> 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. >>
Show quoted text
SRvR> Any comments to the suggested patch?
i forgot about that. easy enough to do with an alias. i am slowly doing an upgrade pass on my cpan stuff and backwards is next. i need to check my queue of feature requests (you might be the only one! :). thanx, uri -- Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com --Perl Consulting, Stem Development, Systems Architecture, Design and Coding- Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org