reading from socket

2015-08-11 Thread Chris Knipe
Hi All, I'm reading "binary" from a socket, and just like a normal email message on the SMTP protocol (for example), the data is terminated by \r\n.\r\n I'm saying "binary" because the data stream does include yEnc data (or character codes > 127) I'm having issues to exit my read loop w

Re: reading from socket

2015-08-11 Thread Brandon McCaig
Chris: On Tue, Aug 11, 2015 at 02:24:13PM +0200, Chris Knipe wrote: > Hi All, Hello, > I'm reading "binary" from a socket, and just like a normal email message on > the SMTP protocol (for example), the data is terminated by \r\n.\r\n > > > > I'm saying "binary" because the data stream does i

Re: reading from socket

2015-08-11 Thread John SJ Anderson
On Tue, Aug 11, 2015 at 6:58 AM, John SJ Anderson wrote: > On Tue, Aug 11, 2015 at 5:24 AM, Chris Knipe wrote: > >> >> >> my $numBytesToRead = 512; >> >> my $buffer; >> >> while ($bytesRead = read($TCPSocket, $buffer, $numBytesToRead)) { >> >> if ($buffer =~ m/\r\n\.\r\n$/) { >> >> print $

Re: reading from socket

2015-08-11 Thread John SJ Anderson
On Tue, Aug 11, 2015 at 5:24 AM, Chris Knipe wrote: > > > my $numBytesToRead = 512; > > my $buffer; > > while ($bytesRead = read($TCPSocket, $buffer, $numBytesToRead)) { > > if ($buffer =~ m/\r\n\.\r\n$/) { > > print $buffer; > > last; > > } > > } > > > > I’m obviously doing this wron

Re: reading from socket

2015-08-11 Thread Chris Knipe
On Tue, Aug 11, 2015 at 5:28 PM, John SJ Anderson wrote: > On Tue, Aug 11, 2015 at 6:58 AM, John SJ Anderson > wrote: > >> On Tue, Aug 11, 2015 at 5:24 AM, Chris Knipe >> wrote: >> >>> >>> >>> my $numBytesToRead = 512; >>> >>> my $buffer; >>> >>> while ($bytesRead = read($TCPSocket, $buffer, $n

Re: reading from socket

2015-08-11 Thread Chris Knipe
> > Firstly, if the handle isn't being read with binmode set then > perhaps the \r\n are being converted to \n (if this is Windows)? > How are you creating/initializing the socket? > Unfortunately, with or without binmode, there's no difference to the matching (from what I can tell) Socket creat

Re: reading from socket

2015-08-11 Thread Chris Knipe
On Wed, Aug 12, 2015 at 12:16 AM, Chris Knipe wrote: > Lines *should* be terminated by CRLF (provided the 8-bit encoding doesn't > mess up the detection), and the entire data stream is then terminated with > a CRLF.CRLF (similar to a SMTP message for example in terms of protocol). > Looking at

Re: reading from socket

2015-08-11 Thread Jim Gibson
> On Aug 11, 2015, at 3:16 PM, Chris Knipe wrote: > > Lastly, you're reading from a socket so there's no guarantee that > the buffer string is going to necessarily end at the termination > boundary. Perhaps the protocol guarantees that, but the socket > surely doesn't. You may need to look for t

Looking for introductory to advanced examples of RESTful programming in Perl

2015-08-11 Thread Kenneth Wolcott
Hello; I'm looking for introductory to advanced examples of RESTful programming in Perl preferably with some good explanations and best practices. Thanks, Ken Wolcott -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://lear

Re: Looking for introductory to advanced examples of RESTful programming in Perl

2015-08-11 Thread Raj Barath
You'd have to try any of the web framework for creating RESTful API You can try Mojolicious http://mojolicio.us/perldoc Or you can try dancer2. https://metacpan.org/pod/Dancer2::Cookbook#Writing-a-REST-application https://metacpan.org/pod/Dancer2::Tutorial

Re: Looking for introductory to advanced examples of RESTful programming in Perl

2015-08-11 Thread Hao Wu
take a look at http://www.todobackend.com/ you can port the mojolicious one to Dancer as a learning experience. On Tue, Aug 11, 2015 at 6:50 PM, Kenneth Wolcott wrote: > Hello; > > I'm looking for introductory to advanced examples of RESTful > programming in Perl preferably with some good

Re: Looking for introductory to advanced examples of RESTful programming in Perl

2015-08-11 Thread Kenneth Wolcott
Hello again; > take a look at > > http://www.todobackend.com/ > > you can port the mojolicious one to Dancer as a learning experience. Thank you for the tips... > You'd have to try any of the web framework for creating RESTful API > You can try Mojolicious > http://mojolicio.us/perldoc > Or you