Server IP : 103.119.228.120 / Your IP : 18.116.23.59 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/ssl/local/ssl/local/share/perl5/CPAN/Meta/ |
Upload File : |
package CPAN::Meta::Check; $CPAN::Meta::Check::VERSION = '0.013'; use strict; use warnings; use base 'Exporter'; our @EXPORT = qw//; our @EXPORT_OK = qw/check_requirements requirements_for verify_dependencies/; our %EXPORT_TAGS = (all => [ @EXPORT, @EXPORT_OK ] ); use CPAN::Meta::Prereqs '2.132830'; use CPAN::Meta::Requirements 2.121; use Module::Metadata 1.000023; sub _check_dep { my ($reqs, $module, $dirs) = @_; $module eq 'perl' and return ($reqs->accepts_module($module, $]) ? () : sprintf "Your Perl (%s) is not in the range '%s'", $], $reqs->requirements_for_module($module)); my $metadata = Module::Metadata->new_from_module($module, inc => $dirs); return "Module '$module' is not installed" if not defined $metadata; my $version = eval { $metadata->version }; return "Missing version info for module '$module'" if $reqs->requirements_for_module($module) and not $version; return sprintf 'Installed version (%s) of %s is not in range \'%s\'', $version, $module, $reqs->requirements_for_module($module) if not $reqs->accepts_module($module, $version || 0); return; } sub _check_conflict { my ($reqs, $module, $dirs) = @_; my $metadata = Module::Metadata->new_from_module($module, inc => $dirs); return if not defined $metadata; my $version = eval { $metadata->version }; return "Missing version info for module '$module'" if not $version; return sprintf 'Installed version (%s) of %s is in range \'%s\'', $version, $module, $reqs->requirements_for_module($module) if $reqs->accepts_module($module, $version); return; } sub requirements_for { my ($meta, $phases, $type) = @_; my $prereqs = ref($meta) eq 'CPAN::Meta' ? $meta->effective_prereqs : $meta; return $prereqs->merged_requirements(ref($phases) ? $phases : [ $phases ], [ $type ]); } sub check_requirements { my ($reqs, $type, $dirs) = @_; return +{ map { $_ => $type ne 'conflicts' ? scalar _check_dep($reqs, $_, $dirs) : scalar _check_conflict($reqs, $_, $dirs) } $reqs->required_modules }; } sub verify_dependencies { my ($meta, $phases, $type, $dirs) = @_; my $reqs = requirements_for($meta, $phases, $type); my $issues = check_requirements($reqs, $type, $dirs); return grep { defined } values %{ $issues }; } 1; #ABSTRACT: Verify requirements in a CPAN::Meta object __END__ =pod =encoding UTF-8 =head1 NAME CPAN::Meta::Check - Verify requirements in a CPAN::Meta object =head1 VERSION version 0.013 =head1 SYNOPSIS warn "$_\n" for verify_dependencies($meta, [qw/runtime build test/], 'requires'); =head1 DESCRIPTION This module verifies if requirements described in a CPAN::Meta object are present. =head1 FUNCTIONS =head2 check_requirements($reqs, $type, $incdirs) This function checks if all dependencies in C<$reqs> (a L<CPAN::Meta::Requirements|CPAN::Meta::Requirements> object) are met, taking into account that 'conflicts' dependencies have to be checked in reverse. It returns a hash with the modules as keys and any problems as values; the value for a successfully found module will be undef. Modules are searched for in C<@$incdirs>, defaulting to C<@INC>. =head2 verify_dependencies($meta, $phases, $types, $incdirs) Check all requirements in C<$meta> for phases C<$phases> and type C<$type>. Modules are searched for in C<@$incdirs>, defaulting to C<@INC>. C<$meta> should be a L<CPAN::Meta::Prereqs> or L<CPAN::Meta> object. =head2 requirements_for($meta, $phases, $types) B<< This function is deprecated and may be removed at some point in the future, please use CPAN::Meta::Prereqs->merged_requirements instead. >> This function returns a unified L<CPAN::Meta::Requirements|CPAN::Meta::Requirements> object for all C<$type> requirements for C<$phases>. C<$phases> may be either one (scalar) value or an arrayref of valid values as defined by the L<CPAN::Meta spec|CPAN::Meta::Spec>. C<$type> must be a relationship as defined by the same spec. C<$meta> should be a L<CPAN::Meta::Prereqs> or L<CPAN::Meta> object. =head1 SEE ALSO =over 4 =item * L<Test::CheckDeps|Test::CheckDeps> =item * L<CPAN::Meta|CPAN::Meta> =for comment # vi:noet:sts=2:sw=2:ts=2 =back =head1 AUTHOR Leon Timmermans <leont@cpan.org> =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2012 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut