Server IP : 103.119.228.120 / Your IP : 3.142.200.247 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/share/perl5/Module/Build/ |
Upload File : |
package Module::Build::PPMMaker; use strict; use warnings; use Config; our $VERSION = '0.4220'; $VERSION = eval $VERSION; # This code is mostly borrowed from ExtUtils::MM_Unix 6.10_03, with a # few tweaks based on the PPD spec at # http://www.xav.com/perl/site/lib/XML/PPD.html # The PPD spec is based on <http://www.w3.org/TR/NOTE-OSD> sub new { my $package = shift; return bless {@_}, $package; } sub make_ppd { my ($self, %args) = @_; my $build = delete $args{build}; my @codebase; if (exists $args{codebase}) { @codebase = ref $args{codebase} ? @{$args{codebase}} : ($args{codebase}); } else { my $distfile = $build->ppm_name . '.tar.gz'; print "Using default codebase '$distfile'\n"; @codebase = ($distfile); } my %dist; foreach my $info (qw(name author abstract version)) { my $method = "dist_$info"; $dist{$info} = $build->$method() or die "Can't determine distribution's $info\n"; } $self->_simple_xml_escape($_) foreach $dist{abstract}, @{$dist{author}}; # TODO: could add <LICENSE HREF=...> tag if we knew what the URLs were for # various licenses my $ppd = <<"PPD"; <SOFTPKG NAME=\"$dist{name}\" VERSION=\"$dist{version}\"> <ABSTRACT>$dist{abstract}</ABSTRACT> @{[ join "\n", map " <AUTHOR>$_</AUTHOR>", @{$dist{author}} ]} <IMPLEMENTATION> PPD # We don't include recommended dependencies because PPD has no way # to distinguish them from normal dependencies. We don't include # build_requires dependencies because the PPM installer doesn't # build or test before installing. And obviously we don't include # conflicts either. foreach my $type (qw(requires)) { my $prereq = $build->$type(); foreach my $modname (sort keys %$prereq) { next if $modname eq 'perl'; my $min_version = '0.0'; foreach my $c ($build->_parse_conditions($prereq->{$modname})) { my ($op, $version) = $c =~ /^\s* (<=?|>=?|==|!=) \s* ([\w.]+) \s*$/x; # This is a nasty hack because it fails if there is no >= op if ($op eq '>=') { $min_version = $version; last; } } # PPM4 spec requires a '::' for top level modules $modname .= '::' unless $modname =~ /::/; $ppd .= qq! <REQUIRE NAME="$modname" VERSION="$min_version" />\n!; } } # We only include these tags if this module involves XS, on the # assumption that pure Perl modules will work on any OS. if (keys %{$build->find_xs_files}) { my $perl_version = $self->_ppd_version($build->perl_version); $ppd .= sprintf(<<'EOF', $self->_varchname($build->config) ); <ARCHITECTURE NAME="%s" /> EOF } foreach my $codebase (@codebase) { $self->_simple_xml_escape($codebase); $ppd .= sprintf(<<'EOF', $codebase); <CODEBASE HREF="%s" /> EOF } $ppd .= <<'EOF'; </IMPLEMENTATION> </SOFTPKG> EOF my $ppd_file = "$dist{name}.ppd"; open(my $fh, '>', $ppd_file) or die "Cannot write to $ppd_file: $!"; binmode($fh, ":utf8") if $] >= 5.008 && $Config{useperlio}; print $fh $ppd; close $fh; return $ppd_file; } sub _ppd_version { my ($self, $version) = @_; # generates something like "0,18,0,0" return join ',', (split(/\./, $version), (0)x4)[0..3]; } sub _varchname { # Copied from PPM.pm my ($self, $config) = @_; my $varchname = $config->{archname}; # Append "-5.8" to architecture name for Perl 5.8 and later if ($] >= 5.008) { my $vstring = sprintf "%vd", $^V; $vstring =~ s/\.\d+$//; $varchname .= "-$vstring"; } return $varchname; } { my %escapes = ( "\n" => "\\n", '"' => '"', '&' => '&', '>' => '>', '<' => '<', ); my $rx = join '|', keys %escapes; sub _simple_xml_escape { $_[1] =~ s/($rx)/$escapes{$1}/go; } } 1; __END__ =head1 NAME Module::Build::PPMMaker - Perl Package Manager file creation =head1 SYNOPSIS On the command line, builds a .ppd file: ./Build ppd =head1 DESCRIPTION This package contains the code that builds F<.ppd> "Perl Package Description" files, in support of ActiveState's "Perl Package Manager". Details are here: L<http://aspn.activestate.com/ASPN/Downloads/ActivePerl/PPM/> =head1 AUTHOR Dave Rolsky <autarch@urth.org>, Ken Williams <kwilliams@cpan.org> =head1 COPYRIGHT Copyright (c) 2001-2006 Ken Williams. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 SEE ALSO perl(1), Module::Build(3) =cut