Perl executing a command (on UNIX)

Perl executing a command (on UNIX)

am 14.08.2007 05:45:36 von 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!

Re: Perl executing a command (on UNIX)

am 14.08.2007 06:20:02 von xhoster

gil wrote:
> 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

--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB

Re: Perl executing a command (on UNIX)

am 14.08.2007 07:57:14 von Martijn Lievaart

On Tue, 14 Aug 2007 04:20:02 +0000, xhoster wrote:

> 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

Re: Perl executing a command (on UNIX)

am 14.08.2007 14:38:50 von gil

On Aug 14, 7:20 am, xhos...@gmail.com wrote:
> gil wrote:
> > 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
>
> --
> --------------------http://NewsReader.Com/------------------ --
> Usenet Newsgroup Service $9.95/Month 30GB

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

Gil