App-GhostWork
view release on metacpan or search on metacpan
Esjis
Sjis
)};
}
# 12345678
my $requires_as_makefile_pl = join "\n", map {qq{ '$_' => '$requires{$_}',}} sort keys %requires;
# write Makefile.PL
open(FH_MAKEFILEPL,'>Makefile.PL') || die "Can't open file: Makefile.PL.\n";
binmode FH_MAKEFILEPL;
printf FH_MAKEFILEPL (<<'END', $package, $version, $abstract, $requires_as_makefile_pl, $author);
use strict;
BEGIN { $INC{'warnings.pm'} = '' if $] < 5.006 }; use warnings; local $^W=1;
use ExtUtils::MakeMaker;
WriteMakefile(
'NAME' => q{%s},
'VERSION' => q{%s},
'ABSTRACT' => q{%s},
'PREREQ_PM' => {
# meta-spec:
# version: 1.4
# url: http://module-build.sourceforge.net/META-spec-v1.4.html
# 12 1234
my $provides_as_yml = join "\n", map {" $_:\n file: $provides{$_}"} sort keys %provides;
my $requires_as_yml = join "\n", map {" $_: $requires{$_}"} sort keys %requires;
# 12
open(FH_METAYML,'>META.yml') || die "Can't open file: META.yml.\n";
binmode FH_METAYML;
printf FH_METAYML (<<'END', $name_as_dist_on_url, $version, $abstract, $author, $requires_as_yml, $name_as_dist_on_url);
--- #YAML:1.0
meta-spec:
version: 1.4
url: http://module-build.sourceforge.net/META-spec-v1.4.html
name: %s
version: %s
abstract: %s
author:
- %s
# "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
# "version" : 2
# },
# 1234567890123456
my $requires_as_json = join ",\n", map {qq{ "$_" : "$requires{$_}"}} sort keys %requires;
my $provides_as_json = join ",\n", map {qq{ "$_" : {\n "file" : "$provides{$_}"\n }}} sort keys %provides;
# 12345678 123456789012 12345678
open(FH_METAJSON,'>META.json') || die "Can't open file: META.json.\n";
binmode FH_METAJSON;
printf FH_METAJSON (<<'END', $name_as_dist_on_url, $version, $abstract, $author, $name_as_dist_on_url, $requires_as_json, $requires_as_json, $requires_as_json);
{
"name" : "%s",
"version" : "%s",
"abstract" : "%s",
"author" : [
"%s"
],
"dynamic_config" : 1,
"generated_by" : "pmake.bat",
}
}
}
}
END
close(FH_METAJSON);
check_usascii('META.json');
# write LICENSE
open(FH_LICENSE,'>LICENSE') || die "Can't open file: LICENSE\n";
binmode FH_LICENSE;
print FH_LICENSE <<'LICENSING';
Terms of Perl itself
a) the GNU General Public License as published by the Free
Software Foundation; either version 1, or (at your option) any
later version, or
b) the "Artistic License"
----------------------------------------------------------------------------
PURPOSE.
The End
LICENSING
close FH_LICENSE;
check_usascii('LICENSE');
# write CONTRIBUTING
open(FH_CONTRIBUTING,'>CONTRIBUTING') || die "Can't open file: CONTRIBUTING\n";
binmode FH_CONTRIBUTING;
print FH_CONTRIBUTING <<'TO_CONTRIBUTE';
# Contributing to this project
Before you go crazy with huge changes, send some small e-mail to check
that we want to change the tools in that way. E-mail that have one logical
change are better.
Good e-mail, patches, improvements, new features - are a fantastic help.
They should remain focused in scope and avoid containing unrelated commits.
#-----------------------------------------------------------------------------
eval q{
use Compress::Zlib;
use Archive::Tar;
};
my $BLOCK_SIZE = 512;
my $ZERO_BLOCK = "\0" x $BLOCK_SIZE;
# make *.tar file
open(FH_TAR, ">$tardir.tar") || die "Can't open file: $tardir.tar\n"; #'
binmode FH_TAR;
for my $file (@file) {
if (-e $file) {
mkpath(dirname("$tardir/$file"), 0, 0777);
print STDERR "copy $file $tardir/$file\n";
copy($file, "$tardir/$file");
#-----------------------------------------------------------------------------
# Sunday December 21, 2008 07:38 PM
# Fixing world writable files in tarball before upload to CPAN [ #38127 ]
# http://use.perl.org/~bart/journal/38127 (dead link)
# Fix CPAN uploads for world writable files
# http://perlmonks.org/index.pl?node_id=731935
#-----------------------------------------------------------------------------
# $tar->add_files("$tardir/$file");
#-----------------------------------------------------------------------------
open(FH, $file) || die "Can't open file: $file\n"; #'
binmode FH;
local $/ = undef; # slurp mode
my $data = <FH>;
close FH;
#-----------------------------------------------------------------------------
# Kwalitee Indicator: buildtool_not_executable core
# The build tool (Build.PL/Makefile.PL) is executable. This is bad because
# you should specify which perl you want to use while installing.
#
# How to fix
# syswrite FH_TAR, $ZERO_BLOCK; makes "tar: A lone zero block at %s"
syswrite FH_TAR, ($ZERO_BLOCK . $ZERO_BLOCK);
close FH_TAR;
rmtree($tardir,0,0);
# make *.tar.gz file
my $gz = gzopen("$tardir.tar.gz", 'wb');
open(FH_TAR, "$tardir.tar") || die "Can't open file: $tardir.tar\n";
binmode FH_TAR;
while (sysread(FH_TAR, $_, 1024*1024)) {
$gz->gzwrite($_);
}
close FH_TAR;
$gz->gzclose;
unlink "$tardir.tar";
}
# P.565 Cleaning Up Your Environment
# in Chapter 23: Security
}
else {
eval q{
use Compress::Zlib;
use Archive::Tar;
};
my $gz = gzopen($gzfile, 'rb');
(my $tarfile = $gzfile) =~ s/\.gz$//xmsi;
open(FH_TAR, ">$tarfile") || die "Can't open file: $tarfile\n";
binmode FH_TAR;
while ($gz->gzreadline(my $line)) {
print FH_TAR $line;
}
$gz->gzclose;
close FH_TAR;
my $tar = Archive::Tar->new($tarfile,1);
for my $file ($tar->list_files){
if (-e $file) {
print STDERR "skip $file is already exists.\n";
}
else {
eval q{
use Compress::Zlib;
use Archive::Tar;
};
my $gz = gzopen($gzfile, 'rb');
(my $tarfile = $gzfile) =~ s/\.gz$//xmsi;
open(FH_TAR, ">$tarfile") || die "Can't open file: $tarfile\n";
binmode FH_TAR;
while ($gz->gzreadline(my $line)) {
print FH_TAR $line;
}
$gz->gzclose;
close FH_TAR;
my $tar = Archive::Tar->new($tarfile,1);
for my $file ($tar->list_files){
if (-e $file) {
print STDERR "skip $file is already exists.\n";
close SOCKET;
if ($head =~ m#^Location: (\S+)#ms) {
$url = $1;
print STDERR "Location: $url\n";
next;
}
my($file) = $ARGV[0] =~ m#([^/]+)$#;
open(FILE,">$file") || die "Can't open file: $file\n";
binmode FILE;
print FILE $body;
close FILE;
if ($head =~ m#Content-Length: ([0-9]+)#ms) {
if (-s $file == $1) {
print STDERR "ok - $file\n";
}
else {
print STDERR "not ok - $file\n";
unlink $file;
}
( run in 1.017 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )