Perl executing a command (on UNIX)

G

gil

Hi,

I'm new at perl programming,
I'd like to execute a UNIX command, which takes no longer than
$time_out seconds.
Is there any easy way to do it, or do I have to use SIGs?

Thans!
 
X

xhoster

gil said:
Hi,

I'm new at perl programming,
I'd like to execute a UNIX command, which takes no longer than
$time_out seconds.

What do you want to happen when the $time_out seconds has expired?
Is there any easy way to do it, or do I have to use SIGs?

IPC::Run might be useful. It also might be overkill for a simple timeout,
though. But probably easier than handling it all yourself with fork
and alarm and kill and whatnot.

Xho
 
M

Martijn Lievaart

IPC::Run might be useful. It also might be overkill for a simple
timeout, though. But probably easier than handling it all yourself with
fork and alarm and kill and whatnot.

Ah thanks for the pointer! That does exactly what I had written myself,
but does it (naturally) better.

M4
 
G

gil

What do you want to happen when the $time_out seconds has expired?


IPC::Run might be useful. It also might be overkill for a simple timeout,
though. But probably easier than handling it all yourself with fork
and alarm and kill and whatnot.

Xho

Thanks! exactly what I was looking for (just want the execution to
terminate).

Gil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top