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

Re: Stopping hanging commands (evals) within debugger

by BrowserUk (Pope)
on Dec 17, 2012 at 00:07 UTC ( #1009100=note: print w/replies, xml ) Need Help??

in reply to Stopping hanging commands (evals) within debugger

Just wrap your string eval in a block eval in which you set a %SIG{ INT } = sub{ die; }; ie:

eval { local $SIG{ INT } = sub{die}; eval $_code };

If you also want to be able to break out of long-running opcodes, you'd have to look at setting local $ENV{ PERL_SIGNALS } = 'unsafe';.

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

RIP Neil Armstrong

Replies are listed 'Best First'.
Re^2: Stopping hanging commands (evals) within debugger
by LanX (Bishop) on Dec 17, 2012 at 00:35 UTC
    Excellent, testscript works fine! =)

    $|=1; $_code=' sleep 1, print for (1..100)'; eval { local $SIG{ INT } = sub{die;}; eval $_code }; print "after interrupt"; eval $_code; # again w/o wrapper

    I'll post again when I got it integrated within the debugger!

    Cheers Rolf

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1009100]
[marto]: 4, if they're good they#ll make it to 5 :P
[1nickt]: Mpph didn;t have twins bu I remember thinking that the "terrible twos" was a misnomer as age 4 seemed to be much more difficult.
LanX 4 kids and wanting to upgrade to 5? wow! ! !
[1nickt]: My lads are 15 and 31 now and both drive me just as crazy as when little, just less frequently.
[LanX]: ;p
[marto]: LanX I'd rather commit sudoku :P
[marto]: trench humour folks, feeling rough.

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (10)
As of 2017-11-18 18:49 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (277 votes). Check out past polls.