Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: How do I close a pipe

by f00li5h (Chaplain)
on Dec 14, 2008 at 04:58 UTC ( #730250=note: print w/replies, xml ) Need Help??

in reply to How do I close a pipe

open (TELNET, '-|', "telnet 6088");

close FH;

These refer to different file handles. If you use lexical file handles (open my $telnet, ...) your file handle will be closed by magic when it drops out of scope

@_=qw; ask f00li5h to appear and remain for a moment of pretend better than a lifetime;;s;;@_[map hex,split'',B204316D8C2A4516DE];;y/05/os/&print;

Replies are listed 'Best First'.
Re^2: How do I close a pipe
by gmoque (Acolyte) on Dec 14, 2008 at 05:14 UTC

    I am sorry about the FH name, I updated the post.

    I added the SIG{INT} trap because without it when I send the signal (CTRL+C) the terminal session stays running, do you think that by closing the file handle (pipe) the telnet session is not being closed properly? (The server will never send EOF since it is always loggin data to the output)

      Per close, after the pipe is closed, perl will wait for the telnet process to complete and return its exit status in $?. Closing the pipe will result in telnet getting a SIGPIPE, which should cause telnet to terminate, but YMMV.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://730250]
[marto]: people are very defnsive about their bad ideas behaviour' :P
[usemodperl]: sorry veltro, venting...
[usemodperl]: (is that wrong marto?)
[aitap]: usemodperl: maybe it's you who has changed
[marto]: demonstrably yes, since you claim to want a safe space, your definition for which seems to be a place where you can name call, make things up or otherwise post without being challenged
[usemodperl]: no that's not it at all, meant safe for perl people, to not be hounded by weirdos obsessed with things like... whitespace :-)

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2018-06-24 15:54 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.