Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: how to exec() with my filehandles !

by JavaFan (Canon)
on May 21, 2010 at 20:59 UTC ( #841131=note: print w/replies, xml ) Need Help??

in reply to [Resolved] how to exec() with my filehandles !

Call me confused, but the only "exec" I find in your program is in part of a string literal.

Assuming a POSIX system (and probably other Unix systems even if they aren't fully POSIX compliant, it may even hold for some non-Unix systems), filehandles are inherited by the execed process - unless they were marked "close on exec".

But one should realize that file handles are just numbers (well, this is Unix kernel stuff; Unix kernels are written in C; in C, everything is a number (or sequences of numbers); so it's not a surprise file handles are numbers). If your execed process is a Perl program, you'll have to dup a file handle (see perlopentut).

However, given the lack of an exec in your code, I don't really know what your question is.

Replies are listed 'Best First'.
Re^2: how to exec() with my filehandles !
by snfever (Novice) on May 21, 2010 at 21:31 UTC
    Yes sorry, i put a "system" function in my sub, but it's "exec"
    Code updated!
    thanks !

    I will also try open3, thanks !
      OK, i'm testing the short code (with open3) and it's working perfectly !
      I need to go to CPAN more :)
      Thanks everybody !
        IPC::Open3 is pretty low level. I suggest you look at IPC::Run3 or the more flexible IPC::Run
        Well, I don't want to curb your enthusiasm, but IPC::Open3 is a core module, meaning: it comes with Perl. So in this case, no visit to CPAN is necessary.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://841131]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2018-08-19 02:19 GMT
Find Nodes?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:

    Results (186 votes). Check out past polls.