July 30th, 2006


Dear hackers

For love of god,

            my $handler = $self->{can}{$func};
            my $ret = eval { $handler->($job); };

            my $work_req;
            if (defined $ret) {
                $work_req = Gearman::Util::pack_req_command("work_complete", "$handle\0" . (ref $ret ? $$ret : $ret));
            } else {
                $work_req = Gearman::Util::pack_req_command("work_fail", $handle);

Can someone tell me what is wrong with this code?

Oh right, someone, brad, is doing an eval {} and never looking at the error, so the handy error message, that tells ops people and developers alike, what is actually happening, instead it ignores the error and just return failed.

If you use eval {}, check the $@ or don't use an eval {}