diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 317e9111..5107bd74 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: steps: - name: Check out repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Extract author information run: | echo AUTHOR_NAME="$(git log -1 ${GITHUB_REF} --pretty='%aN')" >> $GITHUB_ENV @@ -56,7 +56,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Upload build results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: build_results path: build @@ -66,13 +66,13 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - perl: [ "5.14", "5.20", "5.26", "5.30" ] + perl: [ "5.14", "5.20", "5.30", "5.34" ] name: linux ${{ matrix.perl }} steps: - name: Download build results - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: build_results path: build @@ -94,7 +94,7 @@ jobs: steps: - name: Download build results - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: build_results path: build @@ -114,7 +114,7 @@ jobs: steps: - name: Download build results - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: build_results path: build diff --git a/.gitignore b/.gitignore index 7013123a..b1fcaac4 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,5 @@ t/workflow_tests.log local/ eg/ticket/db/ eg/ticket/workflow.log +perl-workflow.code-workspace +db/workflow.db diff --git a/Changes.md b/Changes.md index b5432e29..05f9c879 100644 --- a/Changes.md +++ b/Changes.md @@ -6,6 +6,44 @@ SPOPS was developed by the original author of Workflow and the two have worked in parallel for a long time. The Workflow developers have come to a crossroad and focus of resources and efforts are aimed at modernizing workflow. +## 1.62 2023-02-11 bug fix/maintenance release, update recommended + +- Minor correction to documentation via PR [#208](https://github.com/jonasbn/perl-workflow/pull/208) from @ehuelsmann + +- Improvement to the overall codebase by localizing `$EVAL_ERROR` in conjunction with `eval` structures, via PR [#211](https://github.com/jonasbn/perl-workflow/pull/211) from @ehuelsmann + +## 1.61 2022-10-01 bug fix release, update recommended + +- We have removed some code, which was no longer used, which was causing some grievance see PR [#203](https://github.com/jonasbn/perl-workflow/pull/203) from by Oliver Welter (@oliwell) + +## 1.60 2022-03-02 bug fix release, update recommended + +- We have discovered a minor regression, founded in our eager to implement more clean code. This has been addressed via PR [#195](https://github.com/jonasbn/perl-workflow/pull/195) by Erik Huelsmann (@ehuelsmann). + + It was followed up by PR [#196](https://github.com/jonasbn/perl-workflow/pull/196/files) by Oliver Welter (@oliwell). + + We are now setting the bar a bit lower for the 1.x releases in regard to best practices and code quality and focus on improving the code for 2.x, so we do not experience any more regressions. + +## 1.59 2022-02-02 bug fix release, update required + +- Unfortunately we discovered a minor mishap, where a dependency was referenced without being properly declared as a dependency, which could result in inability for the distribution to work in a clean environment. This has now been addressed via PR [#190](https://github.com/jonasbn/perl-workflow/pull/190) + +We are sorry about any inconvenience this might have caused + +## 1.58 2022-02-02 Maintenance release, update not required + +- Addressed violations of [Perl::Critic](https://metacpan.org/pod/Perl::Critic) policies: + - [Subroutines::ProhibitExplicitReturnUndef](https://metacpan.org/pod/Perl::Critic::Policy::Subroutines::ProhibitExplicitReturnUndef) + - [ValuesAndExpressions::ProhibitMixedBooleanOperators](https://metacpan.org/pod/Perl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators) + + Adjustments to Perl::Critic resourcefile (`t/perlcriticrc`), this somewhat addresses issue [#43](https://github.com/jonasbn/perl-workflow/issues/43), there is more work to be done in this area, this will be adressed eventually + + By Jonas Brømsø (@jonasbn) + +- Requirement for Perl 5.14 has been made more explicit, see also PR [#185](https://github.com/jonasbn/perl-workflow/pull/185) by Erik Huelsmann (@ehuelsmann) + +- Delay of instantation, prevents additional loggings attempts, this makes logging less noisy when running tests. Via PR [#174](https://github.com/jonasbn/perl-workflow/pull/174) from Erik Huelsmann (@ehuelsmann) + ## 1.57 2021-10-17 Bug fix release, update recommended - PR [#170](https://github.com/jonasbn/perl-workflow/pull/170) addresses an issue where Workflow tries to log during the execution of `use` statements, at which time it's highly unlikely that the logger has already been initialized, resulting in warnings being printed on the console diff --git a/README.md b/README.md index 08761f03..1cfecd1a 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Workflow - Simple, flexible system to implement workflows # VERSION -This documentation describes version 1.57 of Workflow +This documentation describes version 1.62 of Workflow # SYNOPSIS @@ -505,14 +505,14 @@ If you want to divide actions in groups (for example state change group, approval group, which have to be shown at different places on the page) add group property to your action -<action name="terminate request" group="state change" class="MyApp::Action::Terminate" /> -<action name="approve request" group="approval" class="MyApp::Action::Approve" /> + + -my @actions = $wf->get\_current\_actions("approval"); + my @actions = $wf->get_current_actions("approval"); -$group should be string that reperesents desired group name. In @actions you will get +`$group` should be string that reperesents desired group name. In @actions you will get list of action names available from the current state for the given environment limited by group. -$group is optional parameter. +`$group` is optional parameter. Returns: list of strings representing available actions @@ -769,48 +769,53 @@ The test suite can be run using, [Module::Build](https://metacpan.org/pod/Module % ./Build test Some of the tests are reserved for the developers and are only run of the -environment variable TEST\_AUTHOR is set to true. +environment variable `TEST_AUTHOR` is set to true. # TEST COVERAGE -This is the current test coverage of Workflow version 1.32, with the TEST\_AUTHOR -flag enabled. - - ---------------------------- ------ ------ ------ ------ ------ ------ ------ - File stmt bran cond sub pod time total - ---------------------------- ------ ------ ------ ------ ------ ------ ------ - blib/lib/Workflow.pm 79.8 50.0 50.0 87.5 100.0 9.9 71.6 - blib/lib/Workflow/Action.pm 90.8 66.7 n/a 88.2 100.0 4.1 89.9 - ...flow/Action/InputField.pm 97.0 92.9 87.5 100.0 100.0 5.9 95.8 - ...Workflow/Action/Mailer.pm 100.0 n/a n/a 100.0 100.0 0.1 100.0 - ...b/Workflow/Action/Null.pm 100.0 n/a n/a 100.0 100.0 0.2 100.0 - blib/lib/Workflow/Base.pm 96.6 86.4 100.0 100.0 100.0 9.6 95.0 - ...lib/Workflow/Condition.pm 100.0 n/a n/a 100.0 100.0 0.8 100.0 - ...low/Condition/Evaluate.pm 59.0 16.7 33.3 87.5 100.0 0.9 53.0 - ...flow/Condition/HasUser.pm 57.7 0.0 0.0 71.4 100.0 0.1 51.2 - blib/lib/Workflow/Config.pm 96.2 81.2 33.3 100.0 100.0 6.1 92.2 - ...b/Workflow/Config/Perl.pm 96.8 75.0 66.7 100.0 100.0 4.1 91.0 - ...ib/Workflow/Config/XML.pm 92.3 50.0 60.0 100.0 100.0 4.9 81.4 - blib/lib/Workflow/Context.pm 100.0 n/a n/a 100.0 100.0 0.4 100.0 - ...lib/Workflow/Exception.pm 89.2 50.0 n/a 91.7 100.0 3.1 89.5 - blib/lib/Workflow/Factory.pm 86.3 61.2 37.5 92.3 100.0 19.6 75.4 - blib/lib/Workflow/History.pm 100.0 87.5 n/a 100.0 100.0 1.8 98.1 - ...lib/Workflow/Persister.pm 90.5 75.0 57.1 88.9 100.0 1.9 87.5 - ...Workflow/Persister/DBI.pm 75.3 51.2 25.0 83.3 100.0 7.4 67.5 - ...er/DBI/AutoGeneratedId.pm 77.8 40.0 n/a 100.0 100.0 0.4 70.1 - ...ersister/DBI/ExtraData.pm 25.9 0.0 0.0 71.4 100.0 0.1 22.9 - ...rsister/DBI/SequenceId.pm 56.2 0.0 0.0 75.0 100.0 0.3 53.1 - ...orkflow/Persister/File.pm 94.4 48.0 33.3 100.0 100.0 2.1 83.1 - ...low/Persister/RandomId.pm 100.0 n/a 100.0 100.0 100.0 1.8 100.0 - ...rkflow/Persister/SPOPS.pm 89.6 50.0 n/a 100.0 100.0 0.3 85.0 - ...orkflow/Persister/UUID.pm 100.0 n/a n/a 100.0 100.0 0.2 100.0 - blib/lib/Workflow/State.pm 74.4 44.2 25.0 91.7 100.0 11.0 64.3 - ...lib/Workflow/Validator.pm 100.0 100.0 n/a 100.0 100.0 1.1 100.0 - ...dator/HasRequiredField.pm 90.0 50.0 n/a 100.0 100.0 0.6 86.7 - ...dator/InEnumeratedType.pm 100.0 100.0 n/a 100.0 100.0 0.4 100.0 - ...ator/MatchesDateFormat.pm 93.3 70.0 66.7 100.0 100.0 0.8 88.2 - Total 83.9 54.7 39.7 93.0 100.0 100.0 76.8 - ---------------------------- ------ ------ ------ ------ ------ ------ ------ +This is the current test coverage of Workflow version 1.58, with the `TEST_AUTHOR` +flag enabled + + TEST_AUTHOR=1 dzil cover + + ---------------------------- ------ ------ ------ ------ ------ ------ ------ + File stmt bran cond sub pod time total + ---------------------------- ------ ------ ------ ------ ------ ------ ------ + blib/lib/Workflow.pm 91.6 68.7 60.0 93.3 100.0 1.2 86.7 + blib/lib/Workflow/Action.pm 93.5 60.0 n/a 94.1 100.0 4.4 91.4 + ...b/Workflow/Action/Null.pm 100.0 n/a n/a 100.0 100.0 2.3 100.0 + blib/lib/Workflow/Base.pm 96.7 86.3 83.3 100.0 100.0 3.0 94.5 + ...lib/Workflow/Condition.pm 100.0 100.0 100.0 100.0 100.0 4.4 100.0 + .../Condition/CheckReturn.pm 71.7 35.7 n/a 100.0 100.0 0.0 67.6 + ...low/Condition/Evaluate.pm 96.7 75.0 n/a 100.0 100.0 3.4 95.4 + ...low/Condition/GreedyOR.pm 100.0 100.0 n/a 100.0 100.0 0.0 100.0 + ...flow/Condition/HasUser.pm 70.0 n/a 33.3 83.3 100.0 0.0 70.0 + ...flow/Condition/LazyAND.pm 100.0 100.0 n/a 100.0 100.0 0.0 100.0 + ...kflow/Condition/LazyOR.pm 100.0 100.0 n/a 100.0 100.0 0.0 100.0 + ...flow/Condition/Negated.pm 100.0 n/a n/a 100.0 100.0 0.0 100.0 + blib/lib/Workflow/Config.pm 96.2 81.2 33.3 100.0 100.0 3.1 92.2 + ...b/Workflow/Config/Perl.pm 96.1 83.3 66.6 92.8 100.0 0.1 92.9 + ...ib/Workflow/Config/XML.pm 94.1 62.5 50.0 100.0 100.0 4.6 90.2 + blib/lib/Workflow/Context.pm 100.0 n/a n/a 100.0 100.0 2.3 100.0 + ...lib/Workflow/Exception.pm 100.0 100.0 n/a 100.0 100.0 0.9 100.0 + blib/lib/Workflow/Factory.pm 87.4 79.3 61.5 84.6 100.0 30.9 84.3 + blib/lib/Workflow/History.pm 100.0 87.5 n/a 100.0 100.0 4.3 98.2 + ...ib/Workflow/InputField.pm 98.6 96.1 87.5 100.0 100.0 2.5 97.6 + ...lib/Workflow/Persister.pm 98.4 100.0 71.4 94.7 100.0 2.4 96.4 + ...Workflow/Persister/DBI.pm 86.7 72.0 35.2 90.6 100.0 7.7 83.0 + ...er/DBI/AutoGeneratedId.pm 91.8 75.0 83.3 100.0 100.0 0.0 88.7 + ...ersister/DBI/ExtraData.pm 29.8 0.0 0.0 60.0 100.0 0.6 29.7 + ...rsister/DBI/SequenceId.pm 100.0 n/a 50.0 100.0 100.0 0.0 98.0 + ...orkflow/Persister/File.pm 94.4 50.0 33.3 100.0 100.0 0.2 88.5 + ...low/Persister/RandomId.pm 100.0 n/a 100.0 100.0 100.0 2.3 100.0 + ...orkflow/Persister/UUID.pm 100.0 n/a n/a 100.0 100.0 2.2 100.0 + blib/lib/Workflow/State.pm 88.1 62.5 16.6 96.3 100.0 4.9 81.7 + ...lib/Workflow/Validator.pm 100.0 83.3 n/a 100.0 100.0 2.4 97.5 + ...dator/HasRequiredField.pm 90.9 50.0 n/a 100.0 100.0 2.3 87.8 + ...dator/InEnumeratedType.pm 100.0 100.0 n/a 100.0 100.0 2.3 100.0 + ...ator/MatchesDateFormat.pm 100.0 100.0 100.0 100.0 100.0 4.0 100.0 + Total 90.7 73.6 57.6 94.9 100.0 100.0 87.8 + ---------------------------- ------ ------ ------ ------ ------ ------ ------ Activities to get improved coverage are ongoing. @@ -889,7 +894,7 @@ The code is kept under revision control using Git: # COPYRIGHT Copyright (c) 2003 Chris Winters and Arvato Direct; -Copyright (c) 2004-2021 Chris Winters. All rights reserved. +Copyright (c) 2004-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/dist.ini b/dist.ini index 73f3a8bf..d1712800 100644 --- a/dist.ini +++ b/dist.ini @@ -81,6 +81,7 @@ Data::Dumper = 0 Carp = 0 File::Slurp = 0 Data::UUID = 0 +Readonly = 0 ; REF: Dist::Zilla https://metacpan.org/pod/Dist::Zilla [Prereqs / Recommends] diff --git a/lib/Workflow.pm b/lib/Workflow.pm index 676f8ef6..67f502c9 100644 --- a/lib/Workflow.pm +++ b/lib/Workflow.pm @@ -2,7 +2,7 @@ package Workflow; use warnings; use strict; -use 5.006; # warnings +use v5.14.0; # warnings use base qw( Workflow::Base ); use Log::Log4perl qw( get_logger ); use Workflow::Context; @@ -16,7 +16,7 @@ my @FIELDS = qw( id type description state last_update time_zone ); my @INTERNAL = qw( _factory _observers ); __PACKAGE__->mk_accessors( @FIELDS, @INTERNAL ); -$Workflow::VERSION = '1.57'; +$Workflow::VERSION = '1.62'; use constant NO_CHANGE_VALUE => 'NOCHANGE'; @@ -116,6 +116,7 @@ sub execute_action { my $old_state = $self->state; my ( $new_state, $action_return ); + local $EVAL_ERROR = undef; eval { $action->validate($self); $self->log->debug("Action validated ok"); @@ -208,10 +209,6 @@ sub add_history { workflow_error "I don't know how to add a history of ", "type '", ref($item), "'"; } - - if ($EVAL_ERROR) { - workflow_error "Unable to assert history object"; - } } push @{ $self->{_histories} }, @to_add; $self->notify_observers( 'add history', \@to_add ); @@ -336,6 +333,8 @@ sub _get_next_state { sub _auto_execute_state { my ( $self, $wf_state ) = @_; my $action_name; + + local $EVAL_ERROR = undef; eval { $action_name = $wf_state->get_autorun_action_name($self); }; if ($EVAL_ERROR) { # we found an error, possibly more than one or none action @@ -377,7 +376,7 @@ Workflow - Simple, flexible system to implement workflows =head1 VERSION -This documentation describes version 1.57 of Workflow +This documentation describes version 1.62 of Workflow =head1 SYNOPSIS @@ -944,14 +943,14 @@ If you want to divide actions in groups (for example state change group, approval group, which have to be shown at different places on the page) add group property to your action - - + + -my @actions = $wf->get_current_actions("approval"); + my @actions = $wf->get_current_actions("approval"); -$group should be string that reperesents desired group name. In @actions you will get +C<$group> should be string that reperesents desired group name. In @actions you will get list of action names available from the current state for the given environment limited by group. -$group is optional parameter. +C<$group> is optional parameter. Returns: list of strings representing available actions @@ -1256,48 +1255,53 @@ The test suite can be run using, L % ./Build test Some of the tests are reserved for the developers and are only run of the -environment variable TEST_AUTHOR is set to true. +environment variable C is set to true. =head1 TEST COVERAGE -This is the current test coverage of Workflow version 1.32, with the TEST_AUTHOR -flag enabled. - - ---------------------------- ------ ------ ------ ------ ------ ------ ------ - File stmt bran cond sub pod time total - ---------------------------- ------ ------ ------ ------ ------ ------ ------ - blib/lib/Workflow.pm 79.8 50.0 50.0 87.5 100.0 9.9 71.6 - blib/lib/Workflow/Action.pm 90.8 66.7 n/a 88.2 100.0 4.1 89.9 - ...flow/Action/InputField.pm 97.0 92.9 87.5 100.0 100.0 5.9 95.8 - ...Workflow/Action/Mailer.pm 100.0 n/a n/a 100.0 100.0 0.1 100.0 - ...b/Workflow/Action/Null.pm 100.0 n/a n/a 100.0 100.0 0.2 100.0 - blib/lib/Workflow/Base.pm 96.6 86.4 100.0 100.0 100.0 9.6 95.0 - ...lib/Workflow/Condition.pm 100.0 n/a n/a 100.0 100.0 0.8 100.0 - ...low/Condition/Evaluate.pm 59.0 16.7 33.3 87.5 100.0 0.9 53.0 - ...flow/Condition/HasUser.pm 57.7 0.0 0.0 71.4 100.0 0.1 51.2 - blib/lib/Workflow/Config.pm 96.2 81.2 33.3 100.0 100.0 6.1 92.2 - ...b/Workflow/Config/Perl.pm 96.8 75.0 66.7 100.0 100.0 4.1 91.0 - ...ib/Workflow/Config/XML.pm 92.3 50.0 60.0 100.0 100.0 4.9 81.4 - blib/lib/Workflow/Context.pm 100.0 n/a n/a 100.0 100.0 0.4 100.0 - ...lib/Workflow/Exception.pm 89.2 50.0 n/a 91.7 100.0 3.1 89.5 - blib/lib/Workflow/Factory.pm 86.3 61.2 37.5 92.3 100.0 19.6 75.4 - blib/lib/Workflow/History.pm 100.0 87.5 n/a 100.0 100.0 1.8 98.1 - ...lib/Workflow/Persister.pm 90.5 75.0 57.1 88.9 100.0 1.9 87.5 - ...Workflow/Persister/DBI.pm 75.3 51.2 25.0 83.3 100.0 7.4 67.5 - ...er/DBI/AutoGeneratedId.pm 77.8 40.0 n/a 100.0 100.0 0.4 70.1 - ...ersister/DBI/ExtraData.pm 25.9 0.0 0.0 71.4 100.0 0.1 22.9 - ...rsister/DBI/SequenceId.pm 56.2 0.0 0.0 75.0 100.0 0.3 53.1 - ...orkflow/Persister/File.pm 94.4 48.0 33.3 100.0 100.0 2.1 83.1 - ...low/Persister/RandomId.pm 100.0 n/a 100.0 100.0 100.0 1.8 100.0 - ...rkflow/Persister/SPOPS.pm 89.6 50.0 n/a 100.0 100.0 0.3 85.0 - ...orkflow/Persister/UUID.pm 100.0 n/a n/a 100.0 100.0 0.2 100.0 - blib/lib/Workflow/State.pm 74.4 44.2 25.0 91.7 100.0 11.0 64.3 - ...lib/Workflow/Validator.pm 100.0 100.0 n/a 100.0 100.0 1.1 100.0 - ...dator/HasRequiredField.pm 90.0 50.0 n/a 100.0 100.0 0.6 86.7 - ...dator/InEnumeratedType.pm 100.0 100.0 n/a 100.0 100.0 0.4 100.0 - ...ator/MatchesDateFormat.pm 93.3 70.0 66.7 100.0 100.0 0.8 88.2 - Total 83.9 54.7 39.7 93.0 100.0 100.0 76.8 - ---------------------------- ------ ------ ------ ------ ------ ------ ------ +This is the current test coverage of Workflow version 1.58, with the C +flag enabled + + TEST_AUTHOR=1 dzil cover + + ---------------------------- ------ ------ ------ ------ ------ ------ ------ + File stmt bran cond sub pod time total + ---------------------------- ------ ------ ------ ------ ------ ------ ------ + blib/lib/Workflow.pm 91.6 68.7 60.0 93.3 100.0 1.2 86.7 + blib/lib/Workflow/Action.pm 93.5 60.0 n/a 94.1 100.0 4.4 91.4 + ...b/Workflow/Action/Null.pm 100.0 n/a n/a 100.0 100.0 2.3 100.0 + blib/lib/Workflow/Base.pm 96.7 86.3 83.3 100.0 100.0 3.0 94.5 + ...lib/Workflow/Condition.pm 100.0 100.0 100.0 100.0 100.0 4.4 100.0 + .../Condition/CheckReturn.pm 71.7 35.7 n/a 100.0 100.0 0.0 67.6 + ...low/Condition/Evaluate.pm 96.7 75.0 n/a 100.0 100.0 3.4 95.4 + ...low/Condition/GreedyOR.pm 100.0 100.0 n/a 100.0 100.0 0.0 100.0 + ...flow/Condition/HasUser.pm 70.0 n/a 33.3 83.3 100.0 0.0 70.0 + ...flow/Condition/LazyAND.pm 100.0 100.0 n/a 100.0 100.0 0.0 100.0 + ...kflow/Condition/LazyOR.pm 100.0 100.0 n/a 100.0 100.0 0.0 100.0 + ...flow/Condition/Negated.pm 100.0 n/a n/a 100.0 100.0 0.0 100.0 + blib/lib/Workflow/Config.pm 96.2 81.2 33.3 100.0 100.0 3.1 92.2 + ...b/Workflow/Config/Perl.pm 96.1 83.3 66.6 92.8 100.0 0.1 92.9 + ...ib/Workflow/Config/XML.pm 94.1 62.5 50.0 100.0 100.0 4.6 90.2 + blib/lib/Workflow/Context.pm 100.0 n/a n/a 100.0 100.0 2.3 100.0 + ...lib/Workflow/Exception.pm 100.0 100.0 n/a 100.0 100.0 0.9 100.0 + blib/lib/Workflow/Factory.pm 87.4 79.3 61.5 84.6 100.0 30.9 84.3 + blib/lib/Workflow/History.pm 100.0 87.5 n/a 100.0 100.0 4.3 98.2 + ...ib/Workflow/InputField.pm 98.6 96.1 87.5 100.0 100.0 2.5 97.6 + ...lib/Workflow/Persister.pm 98.4 100.0 71.4 94.7 100.0 2.4 96.4 + ...Workflow/Persister/DBI.pm 86.7 72.0 35.2 90.6 100.0 7.7 83.0 + ...er/DBI/AutoGeneratedId.pm 91.8 75.0 83.3 100.0 100.0 0.0 88.7 + ...ersister/DBI/ExtraData.pm 29.8 0.0 0.0 60.0 100.0 0.6 29.7 + ...rsister/DBI/SequenceId.pm 100.0 n/a 50.0 100.0 100.0 0.0 98.0 + ...orkflow/Persister/File.pm 94.4 50.0 33.3 100.0 100.0 0.2 88.5 + ...low/Persister/RandomId.pm 100.0 n/a 100.0 100.0 100.0 2.3 100.0 + ...orkflow/Persister/UUID.pm 100.0 n/a n/a 100.0 100.0 2.2 100.0 + blib/lib/Workflow/State.pm 88.1 62.5 16.6 96.3 100.0 4.9 81.7 + ...lib/Workflow/Validator.pm 100.0 83.3 n/a 100.0 100.0 2.4 97.5 + ...dator/HasRequiredField.pm 90.9 50.0 n/a 100.0 100.0 2.3 87.8 + ...dator/InEnumeratedType.pm 100.0 100.0 n/a 100.0 100.0 2.3 100.0 + ...ator/MatchesDateFormat.pm 100.0 100.0 100.0 100.0 100.0 4.0 100.0 + Total 90.7 73.6 57.6 94.9 100.0 100.0 87.8 + ---------------------------- ------ ------ ------ ------ ------ ------ ------ Activities to get improved coverage are ongoing. @@ -1400,7 +1404,7 @@ L =head1 COPYRIGHT Copyright (c) 2003 Chris Winters and Arvato Direct; -Copyright (c) 2004-2021 Chris Winters. All rights reserved. +Copyright (c) 2004-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Action.pm b/lib/Workflow/Action.pm index cd9993bc..02fb599f 100644 --- a/lib/Workflow/Action.pm +++ b/lib/Workflow/Action.pm @@ -12,7 +12,7 @@ use Workflow::Validator::HasRequiredField; use Workflow::Factory qw( FACTORY ); use Carp qw(croak); -$Workflow::Action::VERSION = '1.57'; +$Workflow::Action::VERSION = '1.62'; my @PROPS = qw( name class description group ); my @INTERNAL = qw( _factory ); @@ -80,7 +80,7 @@ sub validate { my @runtime_args = ($wf); foreach my $arg ( @{$args} ) { if ( $arg =~ /^\$(.*)$/ ) { - push @runtime_args, $context->param($1); + push @runtime_args, scalar $context->param($1); } else { push @runtime_args, $arg; } @@ -167,7 +167,7 @@ Workflow::Action - Base class for Workflow actions =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 SYNOPSIS @@ -486,7 +486,7 @@ fields. =head1 COPYRIGHT -Copyright (c) 2003-2021 Chris Winters. All rights reserved. +Copyright (c) 2003-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Action/InputField.pm b/lib/Workflow/Action/InputField.pm index 276daf57..f0e08296 100644 --- a/lib/Workflow/Action/InputField.pm +++ b/lib/Workflow/Action/InputField.pm @@ -7,7 +7,7 @@ use Log::Log4perl qw( get_logger ); use Workflow::Exception qw( configuration_error ); use English qw( -no_match_vars ); -$Workflow::Action::InputField::VERSION = '1.57'; +$Workflow::Action::InputField::VERSION = '1.62'; my @PROPS = qw( name label description type requirement source_class source_list class ); @@ -51,6 +51,7 @@ sub new { if ( my $source_class = $self->source_class ) { $log->debug("Possible values for '$name' from '$source_class'"); unless ( $INCLUDED{$source_class} ) { + local $EVAL_ERROR = undef; eval "require $source_class"; if ($EVAL_ERROR) { configuration_error "Failed to include source class ", @@ -121,7 +122,7 @@ Workflow::Action::InputField - Metadata about information required by an Action =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 SYNOPSIS @@ -311,7 +312,7 @@ example. =head1 COPYRIGHT -Copyright (c) 2003-2021 Chris Winters. All rights reserved. +Copyright (c) 2003-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Action/Mailer.pm b/lib/Workflow/Action/Mailer.pm index 1f79c335..9fab8f1b 100644 --- a/lib/Workflow/Action/Mailer.pm +++ b/lib/Workflow/Action/Mailer.pm @@ -4,7 +4,7 @@ use warnings; use strict; use base qw( Workflow::Action ); -$Workflow::Action::Mailer::VERSION = '1.57'; +$Workflow::Action::Mailer::VERSION = '1.62'; sub execute { my ($self) = @_; @@ -23,7 +23,7 @@ Workflow::Action::Mailer - a stub for a SMTP capable action =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 SYNOPSIS @@ -49,7 +49,7 @@ I =head1 COPYRIGHT -Copyright (c) 2003-2021 Chris Winters. All rights reserved. +Copyright (c) 2003-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Action/Null.pm b/lib/Workflow/Action/Null.pm index 310aa419..106f21b0 100644 --- a/lib/Workflow/Action/Null.pm +++ b/lib/Workflow/Action/Null.pm @@ -4,11 +4,11 @@ use warnings; use strict; use base qw( Workflow::Action ); -$Workflow::Action::Null::VERSION = '1.57'; +$Workflow::Action::Null::VERSION = '1.62'; sub execute { my ($self) = @_; - return undef; + return; } 1; @@ -23,7 +23,7 @@ Workflow::Action::Null - Workflow action for the terminally lazy =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 SYNOPSIS @@ -60,7 +60,7 @@ it by returning C. =head1 COPYRIGHT -Copyright (c) 2003-2021 Chris Winters. All rights reserved. +Copyright (c) 2003-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Base.pm b/lib/Workflow/Base.pm index 736938ce..64096fdc 100644 --- a/lib/Workflow/Base.pm +++ b/lib/Workflow/Base.pm @@ -4,7 +4,7 @@ use warnings; use strict; use base qw( Class::Accessor ); use Log::Log4perl; -$Workflow::Base::VERSION = '1.57'; +$Workflow::Base::VERSION = '1.62'; sub new { my ( $class, @params ) = @_; @@ -42,10 +42,7 @@ sub param { } unless ( defined $value ) { - if ( exists $self->{PARAMS}{$name} ) { - return $self->{PARAMS}{$name}; - } - return undef; + return $self->{PARAMS}{$name}; } return $self->{PARAMS}{$name} = $value; } @@ -53,8 +50,7 @@ sub param { sub delete_param { my ( $self, $name ) = @_; unless ( defined $name ) { - ## this is an error - perhaps an exception is too radical - return undef; + return; } # Allow multiple parameters to be deleted at once... @@ -74,9 +70,7 @@ sub delete_param { delete $self->{PARAMS}{$name}; return $value; } - - ## this is an error - perhaps an exception is too radical - return undef; + return; } sub clear_params { @@ -102,7 +96,7 @@ Workflow::Base - Base class with constructor =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 SYNOPSIS @@ -202,7 +196,7 @@ it in a list. If given neither return an empty list. =head1 COPYRIGHT -Copyright (c) 2003-2021 Chris Winters. All rights reserved. +Copyright (c) 2003-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Condition.pm b/lib/Workflow/Condition.pm index 1eb53a20..77eb958e 100644 --- a/lib/Workflow/Condition.pm +++ b/lib/Workflow/Condition.pm @@ -9,7 +9,7 @@ use Log::Log4perl qw( get_logger ); use Workflow::Exception qw( workflow_error condition_error ); $Workflow::Condition::CACHE_RESULTS = 1; -$Workflow::Condition::VERSION = '1.57'; +$Workflow::Condition::VERSION = '1.62'; my $log; my @FIELDS = qw( name class ); @@ -63,6 +63,8 @@ sub evaluate_condition { ->get_condition( $orig_condition, $wf->type ); $log->debug( "Evaluating condition '$orig_condition'" ); my $return_value; + + local $EVAL_ERROR = undef; eval { $return_value = $condition->evaluate($wf) }; if ($EVAL_ERROR) { @@ -118,7 +120,7 @@ Workflow::Condition - Evaluate a condition depending on the workflow state and e =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 SYNOPSIS @@ -319,7 +321,7 @@ consider it to be the value returned. =head1 COPYRIGHT -Copyright (c) 2003-2021 Chris Winters. All rights reserved. +Copyright (c) 2003-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Condition/CheckReturn.pm b/lib/Workflow/Condition/CheckReturn.pm index bfda5ce3..4ce0bb5b 100644 --- a/lib/Workflow/Condition/CheckReturn.pm +++ b/lib/Workflow/Condition/CheckReturn.pm @@ -3,7 +3,7 @@ package Workflow::Condition::CheckReturn; use strict; use warnings; -our $VERSION = '1.57'; +our $VERSION = '1.62'; use base qw( Workflow::Condition::Nested ); use Workflow::Exception qw( condition_error configuration_error ); @@ -63,11 +63,13 @@ sub evaluate { } elsif ( $arg =~ /^[a-zA-Z0-9_]+$/ ) { # alpha-numeric, plus '_' $argval = $wf->context->param($arg); } else { + local $EVAL_ERROR = undef; $argval = eval $arg; } my $condval = $self->evaluate_condition( $wf, $cond ); + local $EVAL_ERROR = undef; if ( eval "\$condval $op \$argval" ) { return 1; } else { @@ -90,7 +92,7 @@ Workflow::Condition::CheckReturn =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 DESCRIPTION @@ -164,7 +166,7 @@ above strings map to the following numeric operators internally: =head1 COPYRIGHT -Copyright (c) 2004-2021 Chris Winters. All rights reserved. +Copyright (c) 2004-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Condition/Evaluate.pm b/lib/Workflow/Condition/Evaluate.pm index 200d9904..77e83f6a 100644 --- a/lib/Workflow/Condition/Evaluate.pm +++ b/lib/Workflow/Condition/Evaluate.pm @@ -8,7 +8,7 @@ use Safe; use Workflow::Exception qw( condition_error configuration_error ); use English qw( -no_match_vars ); -$Workflow::Condition::Evaluate::VERSION = '1.57'; +$Workflow::Condition::Evaluate::VERSION = '1.62'; my @FIELDS = qw( test ); __PACKAGE__->mk_accessors(@FIELDS); @@ -40,6 +40,7 @@ sub evaluate { my $safe = Safe->new(); $safe->share('$context'); + local $EVAL_ERROR = undef; my $rv = $safe->reval($to_eval); if ($EVAL_ERROR) { condition_error @@ -68,7 +69,7 @@ Workflow::Condition::Evaluate - Inline condition that evaluates perl code for tr =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 SYNOPSIS @@ -137,7 +138,7 @@ A hashref of all the parameters in the L object =head1 COPYRIGHT -Copyright (c) 2004-2021 Chris Winters. All rights reserved. +Copyright (c) 2004-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Condition/GreedyOR.pm b/lib/Workflow/Condition/GreedyOR.pm index eb135ebf..ca38d364 100644 --- a/lib/Workflow/Condition/GreedyOR.pm +++ b/lib/Workflow/Condition/GreedyOR.pm @@ -3,7 +3,7 @@ package Workflow::Condition::GreedyOR; use strict; use warnings; -our $VERSION = '1.57'; +our $VERSION = '1.62'; use base qw( Workflow::Condition::Nested ); use Workflow::Exception qw( condition_error configuration_error ); @@ -57,7 +57,7 @@ Workflow::Condition::GreedyOR =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 DESCRIPTION @@ -119,7 +119,7 @@ B =head1 COPYRIGHT -Copyright (c) 2004-2021 Chris Winters. All rights reserved. +Copyright (c) 2004-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Condition/HasUser.pm b/lib/Workflow/Condition/HasUser.pm index 5e9a264c..c9fceb3f 100644 --- a/lib/Workflow/Condition/HasUser.pm +++ b/lib/Workflow/Condition/HasUser.pm @@ -6,7 +6,7 @@ use base qw( Workflow::Condition ); use Log::Log4perl qw( get_logger ); use Workflow::Exception qw( condition_error ); -$Workflow::Condition::HasUser::VERSION = '1.57'; +$Workflow::Condition::HasUser::VERSION = '1.62'; my $DEFAULT_USER_KEY = 'current_user'; @@ -41,7 +41,7 @@ Workflow::Condition::HasUser - Condition to determine if a user is available =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 SYNOPSIS @@ -108,7 +108,7 @@ Throws L if evaluation fails =head1 COPYRIGHT -Copyright (c) 2004-2021 Chris Winters. All rights reserved. +Copyright (c) 2004-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Condition/LazyAND.pm b/lib/Workflow/Condition/LazyAND.pm index 9ee86541..6ca0138a 100644 --- a/lib/Workflow/Condition/LazyAND.pm +++ b/lib/Workflow/Condition/LazyAND.pm @@ -3,7 +3,7 @@ package Workflow::Condition::LazyAND; use strict; use warnings; -our $VERSION = '1.57'; +our $VERSION = '1.62'; use base qw( Workflow::Condition::Nested ); use Workflow::Exception qw( condition_error configuration_error ); @@ -57,7 +57,7 @@ Workflow::Condition::LazyAND =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 DESCRIPTION @@ -113,7 +113,7 @@ B =head1 COPYRIGHT -Copyright (c) 2003-2021 Chris Winters. All rights reserved. +Copyright (c) 2003-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Condition/LazyOR.pm b/lib/Workflow/Condition/LazyOR.pm index 59fd265a..a744169e 100644 --- a/lib/Workflow/Condition/LazyOR.pm +++ b/lib/Workflow/Condition/LazyOR.pm @@ -3,7 +3,7 @@ package Workflow::Condition::LazyOR; use strict; use warnings; -our $VERSION = '1.57'; +our $VERSION = '1.62'; use base qw( Workflow::Condition::Nested ); use Workflow::Exception qw( condition_error configuration_error ); @@ -55,7 +55,7 @@ Workflow::Condition::LazyOR =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 DESCRIPTION @@ -111,7 +111,7 @@ B =head1 COPYRIGHT -Copyright (c) 2003-2021 Chris Winters. All rights reserved. +Copyright (c) 2003-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Condition/Negated.pm b/lib/Workflow/Condition/Negated.pm index 615f1b13..0b0d0952 100644 --- a/lib/Workflow/Condition/Negated.pm +++ b/lib/Workflow/Condition/Negated.pm @@ -3,7 +3,7 @@ package Workflow::Condition::Negated; use strict; use warnings; -our $VERSION = '1.57'; +our $VERSION = '1.62'; use base qw( Workflow::Condition ); @@ -36,7 +36,7 @@ Workflow::Condition::Negated - Negate workflow condition result =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 DESCRIPTION @@ -73,7 +73,7 @@ See L =head1 COPYRIGHT -Copyright (c) 2004-2021 Chris Winters. All rights reserved. +Copyright (c) 2004-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Condition/Nested.pm b/lib/Workflow/Condition/Nested.pm index 63ebdda5..8280b5ab 100644 --- a/lib/Workflow/Condition/Nested.pm +++ b/lib/Workflow/Condition/Nested.pm @@ -3,7 +3,7 @@ package Workflow::Condition::Nested; use strict; use warnings; -our $VERSION = '1.57'; +our $VERSION = '1.62'; use base qw( Workflow::Condition ); @@ -19,7 +19,7 @@ Workflow::Condition::Nested - Evaluate nested workflow conditions =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 DESCRIPTION @@ -86,7 +86,7 @@ See L =head1 COPYRIGHT -Copyright (c) 2004-2021 Chris Winters. All rights reserved. +Copyright (c) 2004-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Config.pm b/lib/Workflow/Config.pm index edadee0a..495e2485 100644 --- a/lib/Workflow/Config.pm +++ b/lib/Workflow/Config.pm @@ -7,7 +7,7 @@ use Data::Dumper qw( Dumper ); use Log::Log4perl qw( get_logger ); use Workflow::Exception qw( configuration_error ); -$Workflow::Config::VERSION = '1.57'; +$Workflow::Config::VERSION = '1.62'; # Map the valid type to the top-level XML tag or data # structure to look for. @@ -114,7 +114,7 @@ Workflow::Config - Parse configuration files for the workflow components =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 SYNOPSIS @@ -352,6 +352,7 @@ may hold a 'condition' key with one or more named conditions conditions: + type $ condition \@ name $ class $ @@ -392,11 +393,11 @@ keys actions: + type $ action \@ name $ class $ description $ - type $ field \@ name $ is_required yes|no @@ -493,7 +494,7 @@ For documentation of the other keys, please refer to the respective classes. =head1 COPYRIGHT -Copyright (c) 2003-2021 Chris Winters. All rights reserved. +Copyright (c) 2003-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Config/Perl.pm b/lib/Workflow/Config/Perl.pm index d4e3757b..ce17ad5d 100644 --- a/lib/Workflow/Config/Perl.pm +++ b/lib/Workflow/Config/Perl.pm @@ -8,7 +8,7 @@ use Workflow::Exception qw( configuration_error ); use Data::Dumper qw( Dumper ); use English qw( -no_match_vars ); -$Workflow::Config::Perl::VERSION = '1.57'; +$Workflow::Config::Perl::VERSION = '1.62'; sub parse { my ( $self, $type, @items ) = @_; @@ -84,6 +84,7 @@ sub _translate_perl { my $log = get_logger(); no strict 'vars'; + local $EVAL_ERROR = undef; my $data = eval $config; if ($EVAL_ERROR) { configuration_error "Cannot evaluate perl data structure ", @@ -104,7 +105,7 @@ Workflow::Config::Perl - Parse workflow configurations as Perl data structures =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 SYNOPSIS @@ -150,7 +151,7 @@ The method returns a list of configuration parameters. =head1 COPYRIGHT -Copyright (c) 2004-2021 Chris Winters. All rights reserved. +Copyright (c) 2004-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Config/XML.pm b/lib/Workflow/Config/XML.pm index abba883d..6f9b016e 100644 --- a/lib/Workflow/Config/XML.pm +++ b/lib/Workflow/Config/XML.pm @@ -8,7 +8,7 @@ use Workflow::Exception qw( configuration_error ); use Carp qw(croak); use English qw( -no_match_vars ); -$Workflow::Config::XML::VERSION = '1.57'; +$Workflow::Config::XML::VERSION = '1.62'; my ($log); @@ -55,6 +55,8 @@ sub parse { my $file_name = ( ref $item ) ? '[scalar ref]' : $item; $log->info("Will parse '$type' XML config file '$file_name'"); my $this_config; + + local $EVAL_ERROR = undef; eval { $this_config = $self->_translate_xml( $type, $item ); }; # If processing multiple config files, this makes it much easier @@ -81,6 +83,7 @@ sub parse { sub _translate_xml { my ( $self, $type, $config ) = @_; unless ($XML_REQUIRED) { + local $EVAL_ERROR = undef; eval { require XML::Simple }; if ($EVAL_ERROR) { configuration_error "XML::Simple must be installed to parse ", @@ -107,7 +110,7 @@ Workflow::Config::XML - Parse workflow configurations from XML content =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 SYNOPSIS @@ -143,7 +146,7 @@ Returns a list of config parameters as a array upon success. =head1 COPYRIGHT -Copyright (c) 2004-2021 Chris Winters. All rights reserved. +Copyright (c) 2004-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Context.pm b/lib/Workflow/Context.pm index 02559a0c..8ba8bafa 100644 --- a/lib/Workflow/Context.pm +++ b/lib/Workflow/Context.pm @@ -4,7 +4,7 @@ use warnings; use strict; use base qw( Workflow::Base ); -$Workflow::Context::VERSION = '1.57'; +$Workflow::Context::VERSION = '1.62'; sub init { @@ -35,7 +35,7 @@ Workflow::Context - Data blackboard for Workflows, Actions, Conditions and Valid =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 SYNOPSIS @@ -95,7 +95,7 @@ C<$other_context> wins. =head1 COPYRIGHT -Copyright (c) 2003-2021 Chris Winters. All rights reserved. +Copyright (c) 2003-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Exception.pm b/lib/Workflow/Exception.pm index 83906f23..b7324cd3 100644 --- a/lib/Workflow/Exception.pm +++ b/lib/Workflow/Exception.pm @@ -44,7 +44,7 @@ my %TYPE_LOGGING = ( ); -$Workflow::Exception::VERSION = '1.57'; +$Workflow::Exception::VERSION = '1.62'; @Workflow::Exception::ISA = qw( Exporter Exception::Class::Base ); @Workflow::Exception::EXPORT_OK = keys %TYPE_CLASSES; @@ -129,7 +129,7 @@ Workflow::Exception - Base class for workflow exceptions =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 SYNOPSIS @@ -246,7 +246,7 @@ This exception is thrown via when input data or similar of a workflow =head1 COPYRIGHT -Copyright (c) 2003-2021 Chris Winters. All rights reserved. +Copyright (c) 2003-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Factory.pm b/lib/Workflow/Factory.pm index 28a99f93..da5aab7c 100644 --- a/lib/Workflow/Factory.pm +++ b/lib/Workflow/Factory.pm @@ -8,7 +8,7 @@ use Log::Log4perl qw( get_logger ); use Workflow::Exception qw( configuration_error workflow_error ); use Carp qw(croak); use English qw( -no_match_vars ); -$Workflow::Factory::VERSION = '1.57'; +$Workflow::Factory::VERSION = '1.62'; # Extra action attribute validation is off by default for compatibility. our $VALIDATE_ACTION_CONFIG = 0; @@ -23,14 +23,17 @@ sub import { my $log = get_logger(__PACKAGE__); if ( defined $_[0] && $_[0] eq 'FACTORY' ) { shift; - my $instance = _initialize_instance($class); + my $instance; my $import_target = $package . '::FACTORY'; no strict 'refs'; unless ( defined &{$import_target} ) { - *{$import_target} = sub { return $instance }; + *{$import_target} = sub { + return $instance if $instance; + $instance = _initialize_instance($class); + return $instance; + }; } - return $instance; } $class->SUPER::import(@_); } @@ -312,6 +315,8 @@ sub _load_observers { sub _load_class { my ( $self, $class_to_load, $msg ) = @_; + + local $EVAL_ERROR = undef; eval "require $class_to_load"; if ($EVAL_ERROR) { my $full_msg = sprintf $msg, $class_to_load, $EVAL_ERROR; @@ -383,7 +388,8 @@ sub fetch_workflow { my $wf_info = $persister->fetch_workflow($wf_id); $wf_class = $wf_config->{class} || 'Workflow' unless ($wf_class); - return undef unless ($wf_info); + return unless ($wf_info); + $wf_info->{last_update} ||= ''; $self->log->debug( "Fetched data for workflow '$wf_id' ok: ", @@ -446,6 +452,8 @@ sub save_workflow { my $wf_config = $self->_get_workflow_config( $wf->type ); my $persister = $self->get_persister( $wf_config->{persister} ); + + local $EVAL_ERROR = undef; eval { $persister->update_workflow($wf); $self->log->info( "Workflow '", $wf->id, "' updated ok" ); @@ -534,6 +542,8 @@ sub _add_action_config { } $self->log->debug( "Trying to include action class '$action_class'..."); + + local $EVAL_ERROR = undef; eval "require $action_class"; if ($EVAL_ERROR) { my $msg = $EVAL_ERROR; @@ -595,6 +605,8 @@ sub _add_persister_config { } $self->log->debug( "Trying to include persister class '$persister_class'..."); + + local $EVAL_ERROR = undef; eval "require $persister_class"; if ($EVAL_ERROR) { configuration_error "Cannot include persister class ", @@ -603,6 +615,8 @@ sub _add_persister_config { $self->log->debug( "Included persister '$name' class '$persister_class' ", "ok; now try to instantiate persister..." ); + + # $EVAL_ERROR already localized above my $persister = eval { $persister_class->new($persister_config) }; if ($EVAL_ERROR) { configuration_error "Failed to create instance of persister ", @@ -674,6 +688,8 @@ sub _add_condition_config { } $self->log->debug( "Trying to include condition class '$condition_class'"); + + local $EVAL_ERROR = undef; eval "require $condition_class"; if ($EVAL_ERROR) { configuration_error "Cannot include condition class ", @@ -682,6 +698,8 @@ sub _add_condition_config { $self->log->debug( "Included condition '$name' class '$condition_class' ", "ok; now try to instantiate condition..." ); + + # $EVAL_ERROR already localized above my $condition = eval { $condition_class->new($condition_config) }; if ($EVAL_ERROR) { configuration_error @@ -760,6 +778,8 @@ sub _add_validator_config { } $self->log->debug( "Trying to include validator class '$validator_class'"); + + local $EVAL_ERROR = undef; eval "require $validator_class"; if ($EVAL_ERROR) { workflow_error @@ -769,6 +789,8 @@ sub _add_validator_config { "Included validator '$name' class '$validator_class' ", " ok; now try to instantiate validator..." ); + + # $EVAL_ERROR already localized above my $validator = eval { $validator_class->new($validator_config) }; if ($EVAL_ERROR) { workflow_error "Cannot create validator '$name': $EVAL_ERROR"; @@ -793,12 +815,12 @@ sub get_validators { return @validators; } -1; - sub _validate_action_config { return $VALIDATE_ACTION_CONFIG; } +1; + __END__ =pod @@ -809,7 +831,7 @@ Workflow::Factory - Generates new workflow and supporting objects =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 SYNOPSIS @@ -1216,7 +1238,7 @@ of L configs. See L for details. =head1 COPYRIGHT -Copyright (c) 2003-2021 Chris Winters. All rights reserved. +Copyright (c) 2003-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/History.pm b/lib/Workflow/History.pm index 045515e9..c2e1ab9b 100644 --- a/lib/Workflow/History.pm +++ b/lib/Workflow/History.pm @@ -5,7 +5,7 @@ use strict; use base qw( Class::Accessor ); use DateTime; -$Workflow::History::VERSION = '1.57'; +$Workflow::History::VERSION = '1.62'; my @FIELDS = qw( id workflow_id action description date user state time_zone ); @@ -66,7 +66,7 @@ Workflow::History - Recorded work on a workflow action or workflow itself =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 SYNOPSIS @@ -185,7 +185,7 @@ Sets saved state to true and returns 1 =head1 COPYRIGHT -Copyright (c) 2003-2021 Chris Winters. All rights reserved. +Copyright (c) 2003-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Persister.pm b/lib/Workflow/Persister.pm index 40031b7f..e302245e 100644 --- a/lib/Workflow/Persister.pm +++ b/lib/Workflow/Persister.pm @@ -9,7 +9,7 @@ use Workflow::Exception qw( persist_error ); use constant DEFAULT_ID_LENGTH => 8; -$Workflow::Persister::VERSION = '1.57'; +$Workflow::Persister::VERSION = '1.62'; my @FIELDS = qw( name class use_random use_uuid @@ -54,6 +54,8 @@ sub assign_generators { sub init_random_generators { my ( $self, $params ) = @_; my $length = $params->{id_length} || DEFAULT_ID_LENGTH; + + local $EVAL_ERROR = undef; eval { require Workflow::Persister::RandomId }; if (my $msg = $EVAL_ERROR) { $msg =~ s/\\n/ /g; @@ -67,6 +69,7 @@ sub init_random_generators { sub init_uuid_generators { my ( $self, $params ) = @_; + local $EVAL_ERROR = undef; eval { require Workflow::Persister::UUID }; if (my $msg = $EVAL_ERROR) { $msg =~ s/\\n/ /g; @@ -160,7 +163,7 @@ Workflow::Persister - Base class for workflow persistence =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 SYNOPSIS @@ -333,7 +336,7 @@ we shift parameters in? =head1 COPYRIGHT -Copyright (c) 2003-2021 Chris Winters. All rights reserved. +Copyright (c) 2003-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Persister/DBI.pm b/lib/Workflow/Persister/DBI.pm index 4dc20a68..83ee5adb 100644 --- a/lib/Workflow/Persister/DBI.pm +++ b/lib/Workflow/Persister/DBI.pm @@ -14,8 +14,12 @@ use Workflow::Persister::DBI::AutoGeneratedId; use Workflow::Persister::DBI::SequenceId; use Carp qw(croak); use English qw( -no_match_vars ); +use Readonly; -$Workflow::Persister::DBI::VERSION = '1.57'; +Readonly::Scalar my $TRUE => 1; +Readonly::Scalar my $FALSE => 0; + +$Workflow::Persister::DBI::VERSION = '1.62'; my @FIELDS = qw( _wf_fields _hist_fields handle dsn user password driver workflow_table history_table date_format parser autocommit); @@ -30,7 +34,7 @@ sub init { $self->date_format('%Y-%m-%d %H:%M'); # Default to autocommit on for backward compatibility. - $self->autocommit(1); + $self->autocommit($TRUE); # Load user-provided values from config. for (qw( dsn user password date_format autocommit )) { @@ -69,6 +73,8 @@ sub create_handle { "key 'dsn' which maps to the first paramter ", "in the DBI 'connect()' call."; } + + local $EVAL_ERROR = undef; my $dbh = eval { DBI->connect( $self->dsn, $self->user, $self->password ) || croak "Cannot connect to database: $DBI::errstr"; @@ -76,9 +82,9 @@ sub create_handle { if ($EVAL_ERROR) { persist_error $EVAL_ERROR; } - $dbh->{RaiseError} = 1; - $dbh->{PrintError} = 0; - $dbh->{ChopBlanks} = 1; + $dbh->{RaiseError} = $TRUE; + $dbh->{PrintError} = $FALSE; + $dbh->{ChopBlanks} = $TRUE; $dbh->{AutoCommit} = $self->autocommit(); $self->log->debug( "Connected to database '", $self->dsn, "' and ", "assigned to persister ok" ); @@ -213,6 +219,8 @@ sub create_workflow { } my ($sth); + + local $EVAL_ERROR = undef; eval { $sth = $dbh->prepare($sql); $sth->execute(@values); @@ -249,6 +257,8 @@ sub fetch_workflow { } my ($sth); + + local $EVAL_ERROR = undef; eval { $sth = $self->handle->prepare($sql); $sth->execute($wf_id); @@ -257,7 +267,7 @@ sub fetch_workflow { persist_error "Cannot fetch workflow: $EVAL_ERROR"; } my $row = $sth->fetchrow_arrayref; - return undef unless ($row); + return unless ($row); return { state => $row->[0], @@ -283,6 +293,8 @@ sub update_workflow { } my ($sth); + + local $EVAL_ERROR = undef; eval { $sth = $self->handle->prepare($sql); $sth->execute( $wf->state, $update_date, $wf->id ); @@ -322,6 +334,8 @@ sub create_history { } my ($sth); + + local $EVAL_ERROR = undef; eval { $sth = $dbh->prepare($sql); $sth->execute(@values); @@ -360,6 +374,8 @@ sub fetch_history { } my ($sth); + + local $EVAL_ERROR = undef; eval { $sth = $self->handle->prepare($sql); $sth->execute( $wf->id ); @@ -372,17 +388,17 @@ sub fetch_history { my @history = (); while ( my $row = $sth->fetchrow_arrayref ) { - my $hist = Workflow::History->new( - { id => $row->[0], - workflow_id => $row->[1], - action => $row->[2], - description => $row->[3], - state => $row->[4], - user => $row->[5], - date => $self->parser->parse_datetime( $row->[6] ), - } - ); $self->log->debug("Fetched history object '$row->[0]'"); + + my $hist = Workflow::History->new({ + id => $row->[0], + workflow_id => $row->[1], + action => $row->[2], + description => $row->[3], + state => $row->[4], + user => $row->[5], + date => $self->parser->parse_datetime( $row->[6] ), + }); $hist->set_saved(); push @history, $hist; } @@ -393,6 +409,7 @@ sub fetch_history { sub commit_transaction { my ( $self, $wf ) = @_; if ( not $self->autocommit() ) { + local $EVAL_ERROR = undef; eval { $self->handle->commit(); }; if ($EVAL_ERROR) { $self->log->error("Caught error committing transaction: $EVAL_ERROR"); @@ -404,6 +421,7 @@ sub commit_transaction { sub rollback_transaction { my ( $self, $wf ) = @_; if ( not $self->autocommit() ) { + local $EVAL_ERROR = undef; eval { $self->handle->rollback(); }; if ($EVAL_ERROR) { $self->log->error("Caught error rolling back transaction: $EVAL_ERROR"); @@ -459,7 +477,7 @@ Workflow::Persister::DBI - Persist workflow and history to DBI database =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 SYNOPSIS @@ -799,7 +817,7 @@ Returns nothing =head1 COPYRIGHT -Copyright (c) 2003-2021 Chris Winters. All rights reserved. +Copyright (c) 2003-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Persister/DBI/AutoGeneratedId.pm b/lib/Workflow/Persister/DBI/AutoGeneratedId.pm index a79bf3db..e065d0ac 100644 --- a/lib/Workflow/Persister/DBI/AutoGeneratedId.pm +++ b/lib/Workflow/Persister/DBI/AutoGeneratedId.pm @@ -6,7 +6,7 @@ use base qw( Class::Accessor ); use Log::Log4perl qw( get_logger ); use Workflow::Exception qw( configuration_error ); -$Workflow::Persister::DBI::AutoGeneratedId::VERSION = '1.57'; +$Workflow::Persister::DBI::AutoGeneratedId::VERSION = '1.62'; my @FIELDS = qw( log from_handle handle_property func_property ); __PACKAGE__->mk_accessors(@FIELDS); @@ -65,7 +65,7 @@ Workflow::Persister::DBI::AutoGeneratedId - Pull IDs from databases that autogen =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 SYNOPSIS @@ -130,7 +130,7 @@ database handle, based on the statement handle. =head1 COPYRIGHT -Copyright (c) 2003-2021 Chris Winters. All rights reserved. +Copyright (c) 2003-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Persister/DBI/ExtraData.pm b/lib/Workflow/Persister/DBI/ExtraData.pm index 2e2cd86a..06102135 100644 --- a/lib/Workflow/Persister/DBI/ExtraData.pm +++ b/lib/Workflow/Persister/DBI/ExtraData.pm @@ -7,7 +7,7 @@ use Log::Log4perl qw( get_logger ); use Workflow::Exception qw( configuration_error persist_error ); use English qw( -no_match_vars ); -$Workflow::Persister::DBI::ExtraData::VERSION = '1.57'; +$Workflow::Persister::DBI::ExtraData::VERSION = '1.62'; my @FIELDS = qw( table data_field context_key ); __PACKAGE__->mk_accessors(@FIELDS); @@ -65,6 +65,7 @@ sub fetch_extra_workflow_data { $self->log->debug( "Bind parameters: ", $wf->id ); my ($sth); + local $EVAL_ERROR = undef; eval { $sth = $self->handle->prepare($sql); $sth->execute( $wf->id ); @@ -106,7 +107,7 @@ Workflow::Persister::DBI::ExtraData - Fetch extra data with each workflow and pu =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 SYNOPSIS @@ -220,7 +221,7 @@ Throws L if retrieval is not successful. =head1 COPYRIGHT -Copyright (c) 2003-2021 Chris Winters. All rights reserved. +Copyright (c) 2003-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Persister/DBI/SequenceId.pm b/lib/Workflow/Persister/DBI/SequenceId.pm index fdd2f074..5f113539 100644 --- a/lib/Workflow/Persister/DBI/SequenceId.pm +++ b/lib/Workflow/Persister/DBI/SequenceId.pm @@ -8,7 +8,7 @@ use Log::Log4perl qw( get_logger ); use Workflow::Exception qw( persist_error ); use English qw( -no_match_vars ); -$Workflow::Persister::DBI::SequenceId::VERSION = '1.57'; +$Workflow::Persister::DBI::SequenceId::VERSION = '1.62'; my @FIELDS = qw( log sequence_name sequence_select ); __PACKAGE__->mk_accessors(@FIELDS); @@ -27,6 +27,8 @@ sub pre_fetch_id { my $full_select = sprintf $self->sequence_select, $self->sequence_name; $self->log->debug("SQL to fetch sequence: ", $full_select); my ($row); + + local $EVAL_ERROR = undef; eval { my $sth = $dbh->prepare($full_select); $sth->execute; @@ -53,7 +55,7 @@ Workflow::Persister::DBI::SequenceId - Persister to fetch ID from a sequence =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 SYNOPSIS @@ -112,7 +114,7 @@ This is a I method, use L =head1 COPYRIGHT -Copyright (c) 2003-2021 Chris Winters. All rights reserved. +Copyright (c) 2003-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Persister/File.pm b/lib/Workflow/Persister/File.pm index 2161208f..693fa177 100644 --- a/lib/Workflow/Persister/File.pm +++ b/lib/Workflow/Persister/File.pm @@ -11,7 +11,7 @@ use Workflow::Persister::RandomId; use File::Slurp qw(slurp); use English qw( -no_match_vars ); -$Workflow::Persister::File::VERSION = '1.57'; +$Workflow::Persister::File::VERSION = '1.62'; my @FIELDS = qw( path ); __PACKAGE__->mk_accessors(@FIELDS); @@ -45,6 +45,7 @@ sub create_workflow { $self->log->debug("Generated workflow ID '$wf_id'"); $self->_serialize_workflow($wf); my $full_history_path = $self->_get_history_path($wf); + ## no critic (ProhibitMagicNumbers) mkdir( $full_history_path, 0777 ) || persist_error "Cannot create history dir '$full_history_path': $!"; @@ -60,6 +61,8 @@ sub fetch_workflow { persist_error "No workflow with ID '$wf_id' is available"; } $self->log->debug("File exists, reconstituting workflow"); + + local $EVAL_ERROR = undef; my $wf_info = eval { $self->constitute_object($full_path) }; if ($EVAL_ERROR) { persist_error "Cannot reconstitute data from file for ", @@ -97,11 +100,11 @@ sub fetch_history { my ( $self, $wf ) = @_; my $history_dir = $self->_get_history_path($wf); $self->log->debug("Trying to read history files from dir '$history_dir'"); - opendir( HISTORY, $history_dir ) + opendir( my $hist, $history_dir ) || persist_error "Cannot read history from '$history_dir': $!"; my @history_files = grep { -f $_ } - map { catfile( $history_dir, $_ ) } readdir HISTORY; - closedir HISTORY; + map { catfile( $history_dir, $_ ) } readdir $hist; + closedir $hist; my @histories = (); foreach my $history_file (@history_files) { @@ -148,6 +151,7 @@ sub constitute_object { my $content = slurp($object_path); no strict; + local $EVAL_ERROR = undef; my $object = eval $content; croak $EVAL_ERROR if ($EVAL_ERROR); return $object; @@ -178,7 +182,7 @@ Workflow::Persister::File - Persist workflow and history to the filesystem =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 SYNOPSIS @@ -290,7 +294,7 @@ to deserialization attempt. =head1 COPYRIGHT -Copyright (c) 2003-2021 Chris Winters. All rights reserved. +Copyright (c) 2003-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Persister/RandomId.pm b/lib/Workflow/Persister/RandomId.pm index dc58e4ce..81e3b5d5 100644 --- a/lib/Workflow/Persister/RandomId.pm +++ b/lib/Workflow/Persister/RandomId.pm @@ -8,7 +8,7 @@ use constant DEFAULT_ID_LENGTH => 8; use constant RANDOM_SEED => 26; use constant CONSTANT_INCREMENT => 65; -$Workflow::Persister::RandomId::VERSION = '1.57'; +$Workflow::Persister::RandomId::VERSION = '1.62'; my @FIELDS = qw( id_length ); __PACKAGE__->mk_accessors(@FIELDS); @@ -42,7 +42,7 @@ Workflow::Persister::RandomId - Persister to generate random ID =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 SYNOPSIS @@ -84,7 +84,7 @@ This method is unimplemented at this time, please see the TODO. =head1 COPYRIGHT -Copyright (c) 2003-2021 Chris Winters. All rights reserved. +Copyright (c) 2003-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Persister/SPOPS.pm b/lib/Workflow/Persister/SPOPS.pm index 4ca86e40..d3c11460 100644 --- a/lib/Workflow/Persister/SPOPS.pm +++ b/lib/Workflow/Persister/SPOPS.pm @@ -8,7 +8,7 @@ use Log::Log4perl qw( get_logger ); use Workflow::Exception qw( configuration_error persist_error ); use English qw( -no_match_vars ); -$Workflow::Persister::SPOPS::VERSION = '1.57'; +$Workflow::Persister::SPOPS::VERSION = '1.62'; my @FIELDS = qw( workflow_class history_class ); __PACKAGE__->mk_accessors(@FIELDS); @@ -143,7 +143,7 @@ Workflow::Persister::SPOPS - Persist workflows using SPOPS =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 SYNOPSIS @@ -249,7 +249,7 @@ Returns an array of workflow history objects upon success =head1 COPYRIGHT -Copyright (c) 2003-2021 Chris Winters. All rights reserved. +Copyright (c) 2003-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Persister/UUID.pm b/lib/Workflow/Persister/UUID.pm index 08c45ba5..a824aa80 100644 --- a/lib/Workflow/Persister/UUID.pm +++ b/lib/Workflow/Persister/UUID.pm @@ -4,7 +4,7 @@ use warnings; use strict; use Data::UUID; -$Workflow::Persister::UUID::VERSION = '1.57'; +$Workflow::Persister::UUID::VERSION = '1.62'; sub new { my ( $class, $params ) = @_; @@ -31,7 +31,7 @@ Workflow::Persister::UUID - Persister to generate Universally Unique Identifiers =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 SYNOPSIS @@ -84,7 +84,7 @@ This method is unimplemented at this time, please see the TODO. =head1 COPYRIGHT -Copyright (c) 2003-2021 Chris Winters. All rights reserved. +Copyright (c) 2003-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/State.pm b/lib/Workflow/State.pm index bd1ae1ab..ce62a314 100644 --- a/lib/Workflow/State.pm +++ b/lib/Workflow/State.pm @@ -11,7 +11,7 @@ use Exception::Class; use Workflow::Factory qw( FACTORY ); use English qw( -no_match_vars ); -$Workflow::State::VERSION = '1.57'; +$Workflow::State::VERSION = '1.62'; my @FIELDS = qw( state description type ); my @INTERNAL = qw( _test_condition_count _factory _actions _conditions @@ -78,6 +78,7 @@ sub get_available_action_names { sub is_action_available { my ( $self, $wf, $action_name ) = @_; + local $EVAL_ERROR = undef; eval { $self->evaluate_action( $wf, $action_name ) }; # Everything is fine @@ -108,6 +109,7 @@ sub evaluate_action { my $condition_name = $condition->name; my $rv; + local $EVAL_ERROR = undef; eval { $rv = Workflow::Condition->evaluate_condition($wf, $condition_name); }; @@ -242,7 +244,7 @@ sub _assign_next_state_from_array { my @errors = (); my %new_resulting = (); foreach my $map ( @{$resulting} ) { - if ( !$map->{state} or !defined $map->{return} ) { + if ( not $map->{state} or not defined $map->{return} ) { push @errors, "Must have both 'state' ($map->{state}) and 'return' " . "($map->{return}) keys defined."; @@ -353,7 +355,7 @@ Workflow::State - Information about an individual state in a workflow =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 SYNOPSIS @@ -503,7 +505,7 @@ Returns name of action to be used for autorunning the state. =head3 clear_condition_cache ( ) -Deprecated, kept for 1.57 compatibility. +Deprecated, kept for 1.62 compatibility. Used to empties the condition result cache for a given state. @@ -555,7 +557,7 @@ performing some sanity checks like ensuring every action has a =head1 COPYRIGHT -Copyright (c) 2003-2021 Chris Winters. All rights reserved. +Copyright (c) 2003-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Validator.pm b/lib/Workflow/Validator.pm index 1abcf131..55f042ca 100644 --- a/lib/Workflow/Validator.pm +++ b/lib/Workflow/Validator.pm @@ -5,7 +5,7 @@ use strict; use base qw( Workflow::Base ); use Carp qw(croak); -$Workflow::Validator::VERSION = '1.57'; +$Workflow::Validator::VERSION = '1.62'; my @FIELDS = qw( name class ); __PACKAGE__->mk_accessors(@FIELDS); @@ -43,7 +43,7 @@ Workflow::Validator - Ensure data are valid =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 SYNOPSIS @@ -147,7 +147,7 @@ get the application context information from the C<$workflow> object. =head1 COPYRIGHT -Copyright (c) 2003-2021 Chris Winters. All rights reserved. +Copyright (c) 2003-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Validator/HasRequiredField.pm b/lib/Workflow/Validator/HasRequiredField.pm index c8d14443..1e24e979 100644 --- a/lib/Workflow/Validator/HasRequiredField.pm +++ b/lib/Workflow/Validator/HasRequiredField.pm @@ -5,7 +5,7 @@ use strict; use base qw( Workflow::Validator ); use Workflow::Exception qw( validation_error ); -$Workflow::Validator::HasRequiredField::VERSION = '1.57'; +$Workflow::Validator::HasRequiredField::VERSION = '1.62'; sub validate { my ( $self, $wf, @required_fields ) = @_; @@ -34,7 +34,7 @@ Workflow::Validator::HasRequiredField - Validator to ensure certain data are in =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 SYNOPSIS @@ -103,7 +103,7 @@ L's are thrown in case of missing fields. =head1 COPYRIGHT -Copyright (c) 2003-2021 Chris Winters. All rights reserved. +Copyright (c) 2003-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Validator/InEnumeratedType.pm b/lib/Workflow/Validator/InEnumeratedType.pm index 97512005..e80faf19 100644 --- a/lib/Workflow/Validator/InEnumeratedType.pm +++ b/lib/Workflow/Validator/InEnumeratedType.pm @@ -5,7 +5,7 @@ use strict; use base qw( Workflow::Validator ); use Workflow::Exception qw( configuration_error validation_error ); -$Workflow::Validator::InEnumeratedType::VERSION = '1.57'; +$Workflow::Validator::InEnumeratedType::VERSION = '1.62'; sub _init { my ( $self, $params ) = @_; @@ -59,7 +59,7 @@ Workflow::Validator::InEnumeratedType - Ensure a value is one of a declared set =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 SYNOPSIS @@ -215,7 +215,7 @@ part of the set. =head1 COPYRIGHT -Copyright (c) 2003-2021 Chris Winters. All rights reserved. +Copyright (c) 2003-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Workflow/Validator/MatchesDateFormat.pm b/lib/Workflow/Validator/MatchesDateFormat.pm index c85432d1..7d6da032 100644 --- a/lib/Workflow/Validator/MatchesDateFormat.pm +++ b/lib/Workflow/Validator/MatchesDateFormat.pm @@ -8,7 +8,7 @@ use Workflow::Exception qw( configuration_error validation_error ); use English qw( -no_match_vars ); use Carp qw(carp); -$Workflow::Validator::MatchesDateFormat::VERSION = '1.57'; +$Workflow::Validator::MatchesDateFormat::VERSION = '1.62'; __PACKAGE__->mk_accessors('formatter'); @@ -35,6 +35,7 @@ sub validate { return unless ($date_string); # already converted! + local $EVAL_ERROR = undef; if ( ref $date_string and eval { $date_string->isa('DateTime'); } ) { return; } @@ -64,7 +65,7 @@ Workflow::Validator::MatchesDateFormat - Ensure a stringified date matches a giv =head1 VERSION -This documentation describes version 1.57 of this package +This documentation describes version 1.62 of this package =head1 SYNOPSIS @@ -140,7 +141,7 @@ parameter, which should adhere to a predefined date format. =head1 COPYRIGHT -Copyright (c) 2003-2021 Chris Winters. All rights reserved. +Copyright (c) 2003-2023 Chris Winters. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/perl-workflow.code-workspace b/perl-workflow.code-workspace new file mode 100644 index 00000000..876a1499 --- /dev/null +++ b/perl-workflow.code-workspace @@ -0,0 +1,8 @@ +{ + "folders": [ + { + "path": "." + } + ], + "settings": {} +} \ No newline at end of file diff --git a/t/TestApp/CustomWorkflow.pm b/t/TestApp/CustomWorkflow.pm index 839211d2..424d7982 100644 --- a/t/TestApp/CustomWorkflow.pm +++ b/t/TestApp/CustomWorkflow.pm @@ -2,7 +2,7 @@ package TestApp::CustomWorkflow; use warnings; use strict; -use 5.006; +use v5.14.0; use base qw( Workflow ); $TestApp::CustomWorkflow::VERSION = '0.01'; diff --git a/t/factory.t b/t/factory.t index cd866399..7b76ba7d 100644 --- a/t/factory.t +++ b/t/factory.t @@ -3,7 +3,7 @@ use strict; use lib qw(../lib lib ../t t); use TestUtil; -use Test::More tests => 7; +use Test::More tests => 6; use Test::Exception; require_ok( 'Workflow::Factory' ); @@ -18,10 +18,6 @@ my $factory_new = eval { Workflow::Factory->new() }; is( ref( $@ ), 'Workflow::Exception', 'Call to new() throws proper exception' ); -my $i_factory = Workflow::Factory->import( 'FACTORY' ); -is( $i_factory, $factory, - 'Imported factory returns the same object' ); - lives_ok { $factory->add_config_from_file( workflow => 'workflow.xml', action => [ 'workflow_action.xml', 'workflow_action_type.xml', 'workflow_action.perl', ], validator => [ 'workflow_validator.xml', 'workflow_validator.perl' ], diff --git a/t/factory_subclass.t b/t/factory_subclass.t index df51716d..ab876632 100644 --- a/t/factory_subclass.t +++ b/t/factory_subclass.t @@ -3,7 +3,7 @@ use strict; use lib qw(../lib lib ../t t); use TestUtil; -use Test::More tests => 5; +use Test::More tests => 4; require_ok( 'FactorySubclass' ); my $factory = FactorySubclass->instance(); @@ -16,7 +16,3 @@ my $factory_new = eval { FactorySubclass->new() }; is( ref( $@ ), 'Workflow::Exception', 'Call to new() throws proper exception' ); -my $i_factory = FactorySubclass->import( 'FACTORY' ); -is( $i_factory, $factory, - 'Imported factory returns the same object' ); - diff --git a/t/perlcriticrc b/t/perlcriticrc index d23d1d1b..838ace37 100644 --- a/t/perlcriticrc +++ b/t/perlcriticrc @@ -1,41 +1,72 @@ -# $Id$ - severity = 5 -verbose = 8 +verbose = 3 #------------------------------------------------------------------------------ +# REF: https://metacpan.org/pod/Perl::Critic::Policy::Documentation::RequirePodSections [Documentation::RequirePodSections] lib_sections = NAME|DESCRIPTION|SYNOPSIS|AUTHORS|COPYRIGHT script_sections = NAME|DESCRIPTION|SYNOPSIS|AUTHORS|COPYRIGHT +# REF: https://metacpan.org/pod/Perl::Critic::Policy::TestingAndDebugging::RequireUseWarnings [TestingAndDebugging::RequireUseWarnings] + +# REF: https://metacpan.org/pod/Perl::Critic::Policy::ValuesAndExpressions::ProhibitMagicNumbers [ValuesAndExpressions::ProhibitMagicNumbers] -#Might be to late to address -[-Subroutines::ProhibitExplicitReturnUndef] +# Might be to late to address, so it is disabled at various places in the code, could perhaps be +# revisited with a major release, since it would break backwards compatibility, the recommeded +# solution is bare return +# REF: https://metacpan.org/pod/Perl::Critic::Policy::Subroutines::ProhibitExplicitReturnUndef +[Subroutines::ProhibitExplicitReturnUndef] -#The violater of this is an overwrite for Class::Accessor +# The violater of this is an overwrite for Class::Accessor +# REF: https://metacpan.org/pod/Perl::Critic::Policy::NamingConventions::ProhibitAmbiguousNames [-NamingConventions::ProhibitAmbiguousNames] -#We are using Constants +# We are using Constants +# Perhaps exchange this for Readonly? +# REF: https://metacpan.org/pod/Perl::Critic::Policy::ValuesAndExpressions::ProhibitConstantPragma [-ValuesAndExpressions::ProhibitConstantPragma] -#We currently utilize a package variable deliberately, should be addressed -#again +# We currently utilize a package variable deliberately, should be addressed again +# REF: https://metacpan.org/pod/Perl::Critic::Policy::Variables::ProhibitPackageVars [-Variables::ProhibitPackageVars] -#For embedded SQL this is perfectly ok +# For embedded SQL this is perfectly ok +# REF: https://metacpan.org/pod/Perl::Critic::Policy::ValuesAndExpressions::ProhibitImplicitNewlines [-ValuesAndExpressions::ProhibitImplicitNewlines] -#Exchange for Module::Load? +# Exchange for Module::Load? +# REF: https://metacpan.org/pod/Perl::Critic::Policy::BuiltinFunctions::ProhibitStringyEval [-BuiltinFunctions::ProhibitStringyEval] +# We use log +# REF: https://metacpan.org/pod/Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms +[-Subroutines::ProhibitBuiltinHomonyms] + #------------------------------------------------------------------------------ # TODO +# REF: https://metacpan.org/pod/Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict [-TestingAndDebugging::ProhibitNoStrict] -[-InputOutput::ProhibitBarewordFileHandles] \ No newline at end of file +# REF: https://metacpan.org/pod/Perl::Critic::Policy::TestingAndDebugging::ProhibitProlongedStrictureOverride +[-TestingAndDebugging::ProhibitProlongedStrictureOverride] + +# REF: https://metacpan.org/pod/Perl::Critic::Policy::InputOutput::ProhibitBarewordFileHandles +[-InputOutput::ProhibitBarewordFileHandles] + +# REF: https://metacpan.org/pod/Perl::Critic::Policy::Subroutines::RequireFinalReturn +[-Subroutines::RequireFinalReturn] + +# REF: https://metacpan.org/pod/Perl::Critic::Policy::Subroutines::RequireArgUnpacking +[-Subroutines::RequireArgUnpacking] + +# REF: https://metacpan.org/pod/Perl::Critic::Policy::InputOutput::RequireBriefOpen +[-InputOutput::RequireBriefOpen] + +# REF: https://metacpan.org/pod/Perl::Critic::Policy::ValuesAndExpressions::ProhibitCommaSeparatedStatements +[-ValuesAndExpressions::ProhibitCommaSeparatedStatements]