-
Notifications
You must be signed in to change notification settings - Fork 214
Two serious problems #1656
pgpleroux
started this conversation in
Potential issues
Two serious problems
#1656
Describe your experience
Problems
- Firstly, I must confess my lack of GitHub use - I prefer CodeBerg :-)
- Trying to do a merge request, but it looks as if I got a problem with commit messages :-(
- I added support for Alpine Linux but while running perlcritic that most files does not pass?
- It passes all the tests in the source distro but it looks as if github have some extra Ubunto tests?
Now the bugs
I would suggest always 'use strict'!
Use of eval 'use $class"
- This will always return undef because 'class' does not return anything.
- implies that the existing code does nothing
- I used Class::Load in the affected code
More serious - circular class reference
- Rex::Hardware::Network depends on Rex::Commands::Gather
- but I found 'use Rex::Hardware::Network' in Rex::Commands::Gather
- This caused redefining of subroutines
Expected behavior
Strange that no-one saw this?
Anyone using perlcritic?
How to reproduce it
See code
Code example
#!/usr/bin/perl
use strict;
use warnings;
use Class::Load;
warn "eval = 'Foobar': " . eval ('use Foobar') ? 'eval Foobar ok' : 'eval Foobar failed';
warn "eval = 'YAML': " . eval ('use YAML') ? 'eval YAML ok' : 'eval YAML failed';
warn "class = 'Foobar': " . Class::Load::is_class_loaded('Foobar') ? 'Foobar ok' : 'Foobar failed';
warn "class = 'YAML': " . Class::Load::is_class_loaded('use YAML') ? 'YAML ok' : 'YAML failed';
Additional context
No response
Rex version
1.16.2
Installation method
dzil install
Perl version
v5.40.1
Operating system running rex
Devuan Excalibur
Operating system managed by rex
local
All reactions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment