Skip Menu |

This queue is for tickets about the Socket-Class CPAN distribution.

Report information
The Basics
Id: 48039
Status: resolved
Priority: 0/
Queue: Socket-Class

People
Owner: Nobody in particular
Requestors: dmuey [...] cpan.org
Cc:
AdminCc:

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



Subject: readline() respect $/
regarding readline() the POD says "Reads characters from the socket and stops at \r\n, \n\r, \n, \r or \0." Could it instead be made to work consistently with perl's own readline() and respect $/ (or maybe take an arg)? [Pseudo code logic for 'take an arg' option] $ssl->readline($INPUT_RECORD_SEPARATOR); sub readline { if (@_) { use $_[0] } else { use \r\n, \n\r, \n, \r or \0 } 3rd idea is to set it via the object $ssl->set_readline_eol_list($INPUT_RECORD_SEPARATOR); # respect $/ $ssl->set_readline_eol_list("\r\n", "\n\r", "\n", "\r", "\0"); # set back to default value
Subject: Re: [rt.cpan.org #48039] readline() respect $/
Date: Thu, 23 Jul 2009 01:35:29 +0200 (CEST)
To: bug-Socket-Class [...] rt.cpan.org
From: "Christian Mueller" <christian [...] hbr1.com>
sorry, no respect to $/, but to take an arg sounds good. with version 2.34 its possible to add a line separator to readline($sep). it maps inernally to a new function read_packet($sep). christian Show quoted text
> Mon Jul 20 20:22:50 2009: Request 48039 was acted upon. > Transaction: Ticket created by DMUEY > Queue: Socket-Class > Subject: readline() respect $/ > Broken in: (no value) > Severity: Wishlist > Owner: Nobody > Requestors: dmuey@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=48039 > > > > regarding readline() the POD says "Reads characters from the socket and > stops at \r\n, \n\r, \n, \r or \0." > > Could it instead be made to work consistently with perl's own readline() > and respect $/ (or maybe take an arg)? > > [Pseudo code logic for 'take an arg' option] > > $ssl->readline($INPUT_RECORD_SEPARATOR); > > sub readline { > > if (@_) { > use $_[0] > } > else { > use \r\n, \n\r, \n, \r or \0 > } > > 3rd idea is to set it via the object > > $ssl->set_readline_eol_list($INPUT_RECORD_SEPARATOR); # respect $/ > $ssl->set_readline_eol_list("\r\n", "\n\r", "\n", "\r", "\0"); # set back > to > default value > > >
oops meant version 2.24. this could work too: $sock->readline( $/ );