polettix / App-Easer

Simplify writing (hierarchical) CLI applications in Perl
https://github.polettix.it/App-Easer
Other
9 stars 0 forks source link

Error in call to Params::Validate::XS if Params::Validate is loaded before App::Easer #11

Closed djerius closed 6 days ago

djerius commented 1 year ago

perl: 5.36.0 App::Easer:** 2.006 Params::Validate: 1.31 Params::Validate::XS: 1.31

The following code:

#! /usr/bin/env perl

use Params::Validate();
use App::Easer V2 => 'run';

exit run( {
        execute => sub {},
        default_child => '-self',
    },
    $0,
    @ARGV,
);

results in the following error:

Type of arg 1 to Params::Validate::XS::validate must be array (not single ref constructor) at [...]/App/Easer/V2.pm line 421, near "$config_validator)"
Type of arg 1 to Params::Validate::XS::validate_pos must be array (not single ref constructor) at [...]/App/Easer/V2.pm line 425, near "@*)"
Compilation failed in require at [...]/App/Easer.pm line 11.
BEGIN failed--compilation aborted at bug.pl line 5.
polettix commented 1 year ago

This is due to me being unable to read simple documentation, and the authors of Params::Validate choosing to use prototypes, which were never my thing.

Long story short: I'm passing an array reference instead of an array. When the module is already loaded, it checks the prototype and complains loudly.

Even worse, there's not test for this. I added this because it seemed simple; I can accept suggestions for testing.

polettix commented 2 weeks ago

Should be fixed by https://github.com/polettix/App-Easer/commit/cca85fa468211bf79b35689d180f3056e27741ed but still no tests for this...

polettix commented 2 weeks ago

Too bad... I did already fix that and re-introduced the bug with the commit linked above. Commit d44c028 should fix it... again.

polettix commented 6 days ago

Release v2.008 is out