⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.177
Server IP:
50.6.168.112
Server:
Linux server-617809.webnetzimbabwe.com 5.14.0-570.25.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 9 04:57:09 EDT 2025 x86_64
Server Software:
Apache
PHP Version:
8.4.10
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
.cpan
/
build
/
Test-Needs-0.002010-0
/
t
/
View File Name :
find_missing.t
use strict; use warnings; use Test::More tests => 3*5 + 9; use Test::Needs (); use lib 't/lib'; *_find_missing = \&Test::Needs::_find_missing; my $have_vpm = eval { require version }; for my $v ($] - 0.001, $], $] + 0.001) { my $fail = $v > $]; my @parts = sprintf('%.6f', $v) =~ /^(\d+)\.(\d{3})(\d{3})/; my $str_v = join '.', map $_+0, @parts; for my $c ( $v, qq["$str_v"], qq["v$str_v"], qq[v$str_v], qq[version->new("$str_v")] ) { SKIP: { skip "version.pm not available", 1 if !$have_vpm && $c =~ /version->/; my $check = eval $c or die $@; my $message = _find_missing({ perl => $check }); if ($fail) { is $message, sprintf("Need perl %.6f (have %.6f)", $v, $]), "perl prereq of $c failed"; } else { is $message, undef, "perl prereq of $c passed"; } } } } my $missing = "Module::Does::Not::Exist::".time; is _find_missing('ModuleWithVersion'), undef, 'existing module accepted'; is _find_missing({ 'ModuleWithVersion' => 1 }), undef, 'existing module with version accepted'; is _find_missing($missing), "Need $missing", 'missing module rejected'; is _find_missing({ $missing => 1 }), "Need $missing 1", 'missing module with version rejected'; is _find_missing({ 'ModuleWithVersion' => 2 }), "Need ModuleWithVersion 2 (have 1)", 'existing module with old version rejected'; is _find_missing([ $missing ]), "Need $missing", 'missing module rejected (arrayref)'; is _find_missing([ $missing => 1 ]), "Need $missing 1", 'missing module with version rejected (arrayref)'; eval { _find_missing('BrokenModule') }; like $@, qr/Compilation failed/, 'broken module dies'; eval { _find_missing('BrokenModule') }; like $@, qr/Compilation failed/, 'broken module dies again';