Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: How to protect Redis calls with eval ?

by shmem (Chancellor)
on Apr 27, 2011 at 15:10 UTC ( #901593=note: print w/replies, xml ) Need Help??


in reply to How to protect Redis calls with eval ?

That could work. However, if you say

$errorcode = eval {@results = $instance_ref->$command(@_)} ;

you are evaluating @results in scalar context and assigning the result of that evaluation to $errorcode - which is not what your want. Just say e.g.

@results = eval { $instance_ref->$command(@_)} ;

and check $@ for errors, which gets set if your eval'ed code dies.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://901593]
help
Chatterbox?
[1nickt]: choroba I'm trying to make a cpanfile for pm-cb ... how to handle the MCE vs Thread::Queue question? Maybe with on 'build' => sub { if ($threaded_perl) { requires 'Thread::Queue' } else { requires 'MCE' } ?
choroba isn't sure
[choroba]: I plan to break the monolith into modules and create a CPAN App distribution, but I haven't expolored the details yet

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (14)
As of 2017-10-18 13:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (244 votes). Check out past polls.

    Notices?