Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Need suggestion for selecting IPC::Open3 or backticks

by techman2006 (Beadle)
on Nov 12, 2013 at 18:29 UTC ( #1062248=note: print w/replies, xml ) Need Help??


in reply to Re: Need suggestion for selecting IPC::Open3 or backticks
in thread Need suggestion for selecting IPC::Open3 or backticks

G'day Ken,

Thanks for the references. Let me try to explain the problem on which I am working.

I need to scan a set of directory and based on certain criteria I may need to perform a tar operation. Once the operation is successful I need to update some entries in DB( a SQLite DB).

Now the issue is say an user use Ctrl-C to abort the program. As it may come while DB operations going on it will result into a inconsistent state of DB (which need to be avoided). As if the program run again the flow will be decided based on the entries in DB.

So there are two ways to handle such case

1. Catch all such signals and let the program run

2. Catch such signals and handle the condition gracefully.

So I am thinking to take approach 2 for the same. So I was thinking how to achieve the same. Any example with this reference will be great help.

Hope this will help.

  • Comment on Re^2: Need suggestion for selecting IPC::Open3 or backticks

Replies are listed 'Best First'.
Re^3: Need suggestion for selecting IPC::Open3 or backticks
by kcott (Archbishop) on Nov 12, 2013 at 19:10 UTC

    "perlipc: Signals" explains how to trap and handle signals.

    There's quite a few examples, including $SIG{INT} which is what you want for Ctrl-C.

    Make sure you read down to the caveat: "Be careful: qx(), system(), and some modules for calling external commands ..." - this also has example code.

    -- Ken

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1062248]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2023-09-21 21:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?