atoomic / Perl-Critic-Policy-PreferredModules

Custom package recommendations
1 stars 1 forks source link

Can't load Policies from namespace "Perl::Critic::Policy": Can't use string ("DIR") as a symbol ref #2

Open eserte opened 2 years ago

eserte commented 2 years ago

t/check-policy.t fails on some of my systems like this:

Exception::Fatal::Generic: A general problem was found.

Can't load Policies from namespace "Perl::Critic::Policy": Can't use string ("DIR") as a symbol ref while "strict refs" in use at /usr/perl5.34.0Dp/lib/5.34.0/File/Find.pm line 618.

Mon Jan 24 22:20:55 2022

Trace begun at /usr/perl5.34.0Dp/lib/site_perl/5.34.0/Perl/Critic/PolicyFactory.pm line 59
Perl::Critic::PolicyFactory::import('Perl::Critic::PolicyFactory') called at /usr/perl5.34.0Dp/lib/site_perl/5.34.0/Perl/Critic/Config.pm line 17
Perl::Critic::Config::BEGIN at /usr/perl5.34.0Dp/lib/site_perl/5.34.0/Perl/Critic/Config.pm line 17
eval {...} at /usr/perl5.34.0Dp/lib/site_perl/5.34.0/Perl/Critic/Config.pm line 17
require Perl/Critic/Config.pm at /usr/perl5.34.0Dp/lib/site_perl/5.34.0/Perl/Critic.pm line 17
Perl::Critic::BEGIN at /usr/perl5.34.0Dp/lib/site_perl/5.34.0/Perl/Critic/Config.pm line 17
eval {...} at /usr/perl5.34.0Dp/lib/site_perl/5.34.0/Perl/Critic/Config.pm line 17
require Perl/Critic.pm at t/check-policy.t line 13
main::BEGIN at /usr/perl5.34.0Dp/lib/site_perl/5.34.0/Perl/Critic/Config.pm line 17
eval {...} at /usr/perl5.34.0Dp/lib/site_perl/5.34.0/Perl/Critic/Config.pm line 17
BEGIN failed--compilation aborted at /usr/perl5.34.0Dp/lib/site_perl/5.34.0/Perl/Critic/Config.pm line 17.
Compilation failed in require at /usr/perl5.34.0Dp/lib/site_perl/5.34.0/Perl/Critic.pm line 17.
BEGIN failed--compilation aborted at /usr/perl5.34.0Dp/lib/site_perl/5.34.0/Perl/Critic.pm line 17.
Compilation failed in require at t/check-policy.t line 13.
BEGIN failed--compilation aborted at t/check-policy.t line 13.
t/check-policy.t ....... 
Dubious, test returned 255 (wstat 65280, 0xff00)
No subtests run 
eserte commented 2 years ago

Could be related to the installed Test::MockFile (0.21 or older?).

atoomic commented 2 years ago

Test::MockFile has a missing dependency which is not fixed yet on Text::Glob I wonder if this is related view https://github.com/cpanel/Test-MockFile/issues/104

eserte commented 2 years ago

With newer Test-MockFile (version 0.029) the test failure looks somewhat different:

Can't load Policies from namespace "Perl::Critic::Policy": Use of stat to access unmocked file or directory '/home/cpansand/.cpan/build/2022022121/Perl-Critic-Policy-PreferredModules-0.004-0/blib/lib/Perl/Critic/Policy' in strict mode at /opt/perl-5.34.0/lib/site_perl/5.34.0/Module/Pluggable/Object.pm line 198 at /opt/perl-5.34.0/lib/site_perl/5.34.0/Module/Pluggable/Object.pm line 198.
    Module::Pluggable::Object::search_paths(Module::Pluggable::Object=HASH(0x2cf9c50), "/home/cpansand/.cpan/build/2022022121/Perl-Critic-Policy-Pref"...) called at /opt/perl-5.34.0/lib/site_perl/5.34.0/Module/Pluggable/Object.pm line 178
...