Bug fix and maintenance release 1.62 of perl-workflow

Jonas Brømsø - Feb 11 '23 - - Dev Community

Today we released bug fix and maintenance release 1.62.

The bug was nothing big, it was an error in the documentation, but not the less an error. It has now been corrected - thanks to @ehuelsmann

For the maintenance part @ehuelsmann did all the heavy lifting of localizing $EVAL_ERROR in all the places where eval is used, which is quite a few. Actually around 32 if my command line foo is not completely off (which it might be).

ag -c "\s+eval\s+{" |sed -e 's/.*:\([[:digit:]]\)/\1/' | awk '{sum += $1} END {print sum}'
32
Enter fullscreen mode Exit fullscreen mode

For the 2.x branch, we are using: Syntax::Keyword::Try, which does is a prettier solution.

From it's documentation:

use Syntax::Keyword::Try;

sub foo {
    try {
        attempt_a_thing();
        return "success";
    }
    catch ($e) {
        warn "It failed - $e";
        return "failure";
    }
}
Enter fullscreen mode Exit fullscreen mode

Compared to a an eval contruct (based on the above example);

use English qw( -no_match_vars );

sub foo {

    local $EVAL_ERROR = undef;
    eval {
        attempt_a_thing();
        return "success";
    };

    if ($EVAL_ERROR) {
        warn "It failed - $EVAL_ERROR";
        return "failure";
    }
}
Enter fullscreen mode Exit fullscreen mode

The above examples are untested and was just written here to support the description.

The examples could be simpler, but since we use English, the provided example is more true to the Workflow code and the terms used in this post.

A few eval statements are still in the 2.x branch, these might be factored out eventually. For now these has also patched in the unreleased branch of the Workflow distribution via PR: #212.

Here follows the change log of release 1.62.

Change Log

1.62 2023-02-11 bug fix/maintenance release, update recommended

  • Minor correction to documentation via PR #208 from @ehuelsmann

  • Improvement to the overall codebase by localizing $EVAL_ERROR in conjunction with eval structures, via PR #211 from @ehuelsmann

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .