Perl executing a command (on UNIX)

Discussion in 'Perl Misc' started by gil, Aug 14, 2007.

  1. gil

    gil Guest

    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!
     
    gil, Aug 14, 2007
    #1
    1. Advertising

  2. gil

    Guest

    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
     
    , Aug 14, 2007
    #2
    1. Advertising

  3. 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
     
    Martijn Lievaart, Aug 14, 2007
    #3
  4. gil

    gil Guest

    On Aug 14, 7:20 am, 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
     
    gil, Aug 14, 2007
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dpackwood
    Replies:
    3
    Views:
    1,830
  2. Replies:
    4
    Views:
    1,729
    Terry Hancock
    Apr 23, 2005
  3. sunil
    Replies:
    2
    Views:
    157
    Tintin
    Dec 25, 2003
  4. Robert Wallace

    my own perl "dos->unix"/"unix->dos"

    Robert Wallace, Jan 21, 2004, in forum: Perl Misc
    Replies:
    7
    Views:
    294
    Michele Dondi
    Jan 22, 2004
  5. Slickuser

    executing unix command on a diff domain

    Slickuser, Dec 9, 2008, in forum: Perl Misc
    Replies:
    3
    Views:
    117
    Slickuser
    Dec 10, 2008
Loading...

Share This Page