Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Perl executing a command (on UNIX)

Reply
Thread Tools

Perl executing a command (on UNIX)

 
 
gil
Guest
Posts: n/a
 
      08-14-2007
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!

 
Reply With Quote
 
 
 
 
xhoster@gmail.com
Guest
Posts: n/a
 
      08-14-2007
gil <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
 
Martijn Lievaart
Guest
Posts: n/a
 
      08-14-2007
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
 
Reply With Quote
 
gil
Guest
Posts: n/a
 
      08-14-2007
On Aug 14, 7:20 am, (E-Mail Removed) wrote:
> gil <(E-Mail Removed)> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
executing source command from perl david Perl Misc 5 02-29-2008 07:49 PM
Pull out only first field of ps command ( in Perl ) PERL RUN COMMAND tweetiebirds@gmail.com Perl Misc 2 03-26-2005 06:03 AM
Perl system command not executing CoralBanded Perl Misc 6 01-08-2004 03:02 AM
Problem with executing UNIX command in perl script sunil Perl Misc 2 12-25-2003 04:03 AM
Perl CGI executing command line functions Nick Perl Misc 14 10-03-2003 03:05 PM



Advertisments