FAQ
Hi,

I'm writing a perl daemon with telnet interface. But here comes the
crunch time. I need to use <CR><LF> line breaks. Is there any better
auto-detect way than manualy switching to
$/ = $CRLF;
in every telnet session? The truth is, that i(they) have a badly
behaved php skript simulating a telnet session. It doesn't send
crlf nor accept it. Thus send/received text is shifted.

BTW: Isn't it better to create another interface for computers?
Easier without waiting/asking, immediately closed after the last
output line is send.

Thanks for advice,
-- Dalibor

Search Discussions

  • Ken Foskey at Aug 13, 2006 at 11:24 pm

    On Sun, 2006-08-13 at 21:04 +0200, Dalibor Straka wrote:
    Hi,

    I'm writing a perl daemon with telnet interface. But here comes the
    crunch time. I need to use <CR><LF> line breaks. Is there any better
    auto-detect way than manualy switching to
    $/ = $CRLF;
    in every telnet session? The truth is, that i(they) have a badly
    behaved php skript simulating a telnet session. It doesn't send
    crlf nor accept it. Thus send/received text is shifted.

    BTW: Isn't it better to create another interface for computers?
    Easier without waiting/asking, immediately closed after the last
    output line is send.
    I don't understand what you are trying to do.

    If you want your perl script to send crlf all the time you could simply
    be explicit `print "\r\n";`

    If you want to receive data that may or may not have crlf strip it on
    input

    $line = <>;
    $line =~ s/[\r\n]*$//;

    Ta
    Ken

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupbeginners @
categoriesperl
postedAug 13, '06 at 7:04p
activeAug 13, '06 at 11:24p
posts2
users2
websiteperl.org

2 users in discussion

Ken Foskey: 1 post Dalibor Straka: 1 post

People

Translate

site design / logo © 2022 Grokbase