@@ -1,12 +1,16 @@
+#!/usr/bin/env perl
+# This file was created automatically
+use 5.006;
use strict;
use warnings;
-use lib qw( builder );
+use lib qw( builder/lib );
use Build;
-
my $mb = Build->new;
-$mb->change_versions(1);
-$mb->copyright_first_year( '2006' );
-$mb->add_pod_author_copyright_license(1);
+
+$mb->add_pod_author_copyright_license( 1 );
+$mb->copyright_first_year( 2006 );
+$mb->change_versions( 1 );
+
$mb->create_build_script;
1;
@@ -1,5 +1,8 @@
Revision history for Perl extension Sys::Info::Base.
+0.7803 Fri May 10 01:06:29 EEST 2013
+ => Bump version for new release.
+
0.7802 Sun Jul 31 03:21:23 2011
=> Fix device('available'). Reported by Matthäus Kiem.
@@ -1,4 +1,4 @@
-This software is copyright (c) 2011 by Burak Gursoy <burak@cpan.org>.
+This software is copyright (c) 2013 by Burak Gursoy <burak@cpan.org>.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
@@ -12,7 +12,7 @@ b) the "Artistic License"
--- The GNU General Public License, Version 1, February 1989 ---
-This software is Copyright (c) 2011 by Burak Gursoy <burak@cpan.org>.
+This software is Copyright (c) 2013 by Burak Gursoy <burak@cpan.org>.
This is free software, licensed under:
@@ -22,7 +22,7 @@ This is free software, licensed under:
Version 1, February 1989
Copyright (C) 1989 Free Software Foundation, Inc.
- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ 51 Franklin St, Suite 500, Boston, MA 02110-1335 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -272,7 +272,7 @@ That's all there is to it!
--- The Artistic License 1.0 ---
-This software is Copyright (c) 2011 by Burak Gursoy <burak@cpan.org>.
+This software is Copyright (c) 2013 by Burak Gursoy <burak@cpan.org>.
This is free software, licensed under:
@@ -1,22 +1,31 @@
+.perlcriticrc
+Build.PL Generated automatically
+builder/lib/Build.pm
+builder/lib/Build/Constants.pm
+builder/lib/Build/Spec.pm
+builder/lib/Build/Util.pm
+builder/templates/pod/author.pod
+builder/templates/pod/monolith-warning.pod
+builder/templates/tools/Build.PL
+builder/templates/tools/builder.header
+builder/templates/tools/Makefile.PL
+builder/templates/tools/Makefile.PL.hook
+Changes
lib/Sys/Info/Base.pm
lib/Sys/Info/Constants.pm
lib/Sys/Info/Device.pm
+lib/Sys/Info/Device/CPU.pm
lib/Sys/Info/Driver.pm
+lib/Sys/Info/Helper.pm
lib/Sys/Info/OS.pm
-lib/Sys/Info/Device/CPU.pm
-t/03-basic.t
-t/slurp.txt
-Build.PL
-Changes
+LICENSE
+Makefile.PL Generated automatically
MANIFEST
+META.json
+META.yml
README
SPEC
-.perlcriticrc
-builder/Build.pm
-builder/Build/Spec.pm
-t/201-pod.t
-t/202-pod-coverage.t
-Makefile.PL Generated automatically
-LICENSE
-META.yml
-META.json
+t/03-basic.t
+t/slurp.txt
+xt/author/201-pod.t
+xt/author/202-pod-coverage.t
@@ -4,7 +4,7 @@
"Burak Gursoy <burak@cpan.org>"
],
"dynamic_config" : 1,
- "generated_by" : "Module::Build version 0.38, CPAN::Meta::Converter version 2.110930",
+ "generated_by" : "Module::Build version 0.4003, CPAN::Meta::Converter version 2.120921",
"license" : [
"perl_5"
],
@@ -17,7 +17,8 @@
"directory" : [
"monolithic_version",
"builder",
- "t"
+ "t",
+ "xt"
]
},
"prereqs" : {
@@ -28,34 +29,38 @@
},
"configure" : {
"requires" : {
- "Module::Build" : "0.38"
+ "Module::Build" : "0.40"
}
}
},
"provides" : {
"Sys::Info::Base" : {
"file" : "lib/Sys/Info/Base.pm",
- "version" : "0.7802"
+ "version" : "0.7803"
},
"Sys::Info::Constants" : {
"file" : "lib/Sys/Info/Constants.pm",
- "version" : "0.7802"
+ "version" : "0.7803"
},
"Sys::Info::Device" : {
"file" : "lib/Sys/Info/Device.pm",
- "version" : "0.7802"
+ "version" : "0.7803"
},
"Sys::Info::Device::CPU" : {
"file" : "lib/Sys/Info/Device/CPU.pm",
- "version" : "0.7802"
+ "version" : "0.7803"
},
"Sys::Info::Driver" : {
"file" : "lib/Sys/Info/Driver.pm",
- "version" : "0.7802"
+ "version" : "0.7803"
+ },
+ "Sys::Info::Helper" : {
+ "file" : "lib/Sys/Info/Helper.pm",
+ "version" : "0.7803"
},
"Sys::Info::OS" : {
"file" : "lib/Sys/Info/OS.pm",
- "version" : "0.7802"
+ "version" : "0.7803"
}
},
"release_status" : "stable",
@@ -67,5 +72,5 @@
"url" : "http://bitbucket.org/burak/cpan-sys-info-base/"
}
},
- "version" : "0.7802"
+ "version" : "0.7803"
}
@@ -5,9 +5,9 @@ author:
build_requires:
Test::More: 0.40
configure_requires:
- Module::Build: 0.38
+ Module::Build: 0.40
dynamic_config: 1
-generated_by: 'Module::Build version 0.38, CPAN::Meta::Converter version 2.110930'
+generated_by: 'Module::Build version 0.4003, CPAN::Meta::Converter version 2.120921'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -18,26 +18,30 @@ no_index:
- monolithic_version
- builder
- t
+ - xt
provides:
Sys::Info::Base:
file: lib/Sys/Info/Base.pm
- version: 0.7802
+ version: 0.7803
Sys::Info::Constants:
file: lib/Sys/Info/Constants.pm
- version: 0.7802
+ version: 0.7803
Sys::Info::Device:
file: lib/Sys/Info/Device.pm
- version: 0.7802
+ version: 0.7803
Sys::Info::Device::CPU:
file: lib/Sys/Info/Device/CPU.pm
- version: 0.7802
+ version: 0.7803
Sys::Info::Driver:
file: lib/Sys/Info/Driver.pm
- version: 0.7802
+ version: 0.7803
+ Sys::Info::Helper:
+ file: lib/Sys/Info/Helper.pm
+ version: 0.7803
Sys::Info::OS:
file: lib/Sys/Info/OS.pm
- version: 0.7802
+ version: 0.7803
resources:
license: http://dev.perl.org/licenses/
repository: http://bitbucket.org/burak/cpan-sys-info-base/
-version: 0.7802
+version: 0.7803
@@ -1,8 +1,11 @@
#!/usr/bin/env perl
+# This file was created automatically
+use 5.006;
use strict;
-use ExtUtils::MakeMaker;
-use lib qw( builder );
+use warnings;
+use lib qw( builder/lib );
use Build::Spec qw( mm_spec );
+use ExtUtils::MakeMaker;
my %spec = mm_spec;
@@ -1,8 +1,6 @@
{
module_name => 'Sys::Info::Base',
- requires => {
- ( $] < 5.006 ? ( 'warnings::compat' => 0 ) : ()),
- },
+ requires => {},
meta_merge => {
resources => {
repository => 'http://bitbucket.org/burak/cpan-sys-info-base/',
@@ -13,4 +11,9 @@
repository => 'http://bitbucket.org/burak/cpan-sys-info-base/',
},
},
+ BUILDER => {
+ change_versions => 1,
+ copyright_first_year => 2006,
+ add_pod_author_copyright_license => 1,
+ },
}
@@ -1,102 +0,0 @@
-package Build::Spec;
-use strict;
-use vars qw( $VERSION @ISA @EXPORT @EXPORT_OK );
-use Exporter ();
-use Carp qw( croak );
-use constant DEFAULT_AUTHOR => 'Burak Gursoy <burak@cpan.org>';
-use constant OS_ERROR => qr{OS \s+ unsupported}xms;
-use base qw( Exporter );
-
-# since this is a builder we don't care about warnings.pm to support older perl
-## no critic (RequireUseWarnings)
-
-BEGIN {
- $VERSION = '0.64';
- @EXPORT = qw( spec );
- @EXPORT_OK = qw( mm_spec );
-}
-
-sub spec {
- my $file = 'SPEC';
- my $spec = do $file;
-
- my %rv =
- $@ ? do { croak $@ =~ OS_ERROR ? $@ : "Couldn't parse $file: $@" }
- : ! defined $spec && $! ? croak "Couldn't do $file: $!"
- : ! $spec ? croak "$file did not return a true value"
- : ref($spec) ne 'HASH' ? croak "Return type of $file is not HASH"
- : ! $spec->{module_name} ? croak "The specification returned from $file does"
- .q{ not have the mandatory 'module_name' key}
- : %{ $spec };
- ;
-
- # these needs to be set here
- $rv{dist_author} ||= DEFAULT_AUTHOR;
- $rv{recommends} ||= {};
- $rv{requires} ||= {};
- my $breq = $rv{build_requires} ||= {};
- $breq->{'Test::More'} = '0.40' if ! exists $breq->{'Test::More'};
-
- return %rv;
-}
-
-sub trim {
- my $s = shift;
- return $s if ! $s;
- $s =~ s{ \A \s+ }{}xms;
- $s =~ s{ \s+ \z }{}xms;
- return $s;
-}
-
-# Makefile.PL related things
-
-sub mm_spec {
- my %spec = spec();
- (my $file = $spec{module_name}) =~ s{::}{/}xmsg;
- $spec{VERSION_FROM} = "lib/$file.pm";
- $spec{PREREQ_PM} = { %{ $spec{requires} }, %{ $spec{build_requires} } };
- _mm_recommend( %spec );
- $spec{ABSTRACT} = _mm_abstract( $spec{VERSION_FROM} );
- $spec{EXE_FILES} = $spec{script_files} ? $spec{script_files} : [];
- return %spec;
-}
-
-sub _mm_recommend {
- my %spec = @_;
- return if ! $spec{recommends};
- my %rec = %{ $spec{recommends} } or return;
- my $info = "\nRecommended Modules:\n\n";
- foreach my $m ( sort keys %rec ) {
- $info .= sprintf "\t%s\tv%s\n", $m, $rec{$m};
- }
- my $pok = print "$info\n";
- return;
-}
-
-sub _mm_abstract {
- my $file = shift;
- require IO::File;
- my $fh = IO::File->new;
- $fh->open( $file, 'r' ) || croak "Can not read $file: $!";
- binmode $fh;
- while ( my $line = <$fh> ) {
- chomp $line;
- last if $line eq '=head1 NAME';
- }
- my $buf;
- while ( my $line = <$fh> ) {
- chomp $line;
- last if $line =~ m{ \A =head }xms;
- $buf .= $line;
- }
- $fh->close || croak "Can not close $file: $!";
- croak 'Unable to get ABSTRACT' if ! $buf;
- $buf = trim( $buf );
- my($mod, $desc) = split m{\-}xms, $buf, 2;
- $desc = trim( $desc ) || croak 'Unable to get ABSTRACT';
- return $desc;
-}
-
-1;
-
-__END__
@@ -1,542 +0,0 @@
-package Build;
-use strict;
-use vars qw( $VERSION );
-use constant TAINT_SHEBANG => "#!perl -Tw\nuse constant TAINTMODE => 1;\n";
-
-# since this is a builder we don't care about warnings.pm to support older perl
-## no critic (RequireUseWarnings, InputOutput::RequireBriefOpen, InputOutput::ProhibitBacktickOperators)
-
-$VERSION = '0.70';
-
-use File::Find;
-use File::Spec;
-use File::Path;
-use Carp qw( croak );
-use Build::Spec;
-use base qw( Module::Build );
-use constant RE_VERSION_LINE => qr{
- \A (our\s+)? \$VERSION \s+ = \s+ ["'] (.+?) ['"] ; (.+?) \z
-}xms;
-use constant RE_POD_LINE => qr{
-\A =head1 \s+ DESCRIPTION \s+ \z
-}xms;
-use constant VTEMP => q{%s$VERSION = '%s';};
-use constant MONTHS => qw(
- January February March April May June
- July August September October November December
-);
-use constant MONOLITH_TEST_FAIL =>
- "\nFAILED! Building the monolithic version failed during unit testing\n\n";
-
-use constant NO_INDEX => qw( monolithic_version builder t );
-use constant DEFAULTS => qw(
- license perl
- create_license 1
- sign 0
-);
-use constant YEAR_ADD => 1900;
-use constant YEAR_SLOT => 5;
-
-__PACKAGE__->add_property( build_monolith => 0 );
-__PACKAGE__->add_property( change_versions => 0 );
-__PACKAGE__->add_property( vanilla_makefile_pl => 1 );
-__PACKAGE__->add_property( monolith_add_to_top => [] );
-__PACKAGE__->add_property( taint_mode_tests => 0 );
-__PACKAGE__->add_property( add_pod_author_copyright_license => 0 );
-__PACKAGE__->add_property( copyright_first_year => 0 );
-__PACKAGE__->add_property( initialization_hook => q() );
-
-sub new {
- my $class = shift;
- my %opt = spec;
- my %def = DEFAULTS;
- foreach my $key ( keys %def ) {
- $opt{ $key } = $def{ $key } if ! defined $opt{ $key };
- }
- $opt{no_index} ||= {};
- $opt{no_index}{directory} ||= [];
- push @{ $opt{no_index}{directory} }, NO_INDEX;
- return $class->SUPER::new( %opt );
-}
-
-sub create_build_script {
- my $self = shift;
- $self->_add_vanilla_makefile_pl if $self->vanilla_makefile_pl;
- my $hook = $self->initialization_hook;
- if ( $hook ) {
- my $eok = eval $hook;
- croak "Error compiling initialization_hook: $@" if $@;
- }
- return $self->SUPER::create_build_script( @_ );
-}
-
-sub mytrim {
- my $self = shift;
- my $s = shift;
- return $s if ! $s; # false or undef
- my $extra = shift || q{};
- $s =~ s{\A \s+ }{$extra}xms;
- $s =~ s{ \s+ \z}{$extra}xms;
- return $s;
-}
-
-sub ACTION_dist { ## no critic (NamingConventions::Capitalization)
- my $self = shift;
- my $msg = sprintf q{RUNNING 'dist' Action from subclass %s v%s},
- ref($self),
- $VERSION;
- warn "$msg\n";
- my @modules;
- find {
- wanted => sub {
- my $file = $_;
- return if $file !~ m{ [.] pm \z }xms;
- $file = File::Spec->catfile( $file );
- push @modules, $file;
- warn "FOUND Module: $file\n";
- },
- no_chdir => 1,
- }, 'lib';
- $self->_create_taint_mode_tests if $self->taint_mode_tests;
- $self->_change_versions( \@modules ) if $self->change_versions;
- $self->_build_monolith( \@modules ) if $self->build_monolith;
- return $self->SUPER::ACTION_dist( @_ );
-}
-
-sub _create_taint_mode_tests {
- my $self = shift;
- my @tests = glob 't/*.t';
- my @taints;
- require File::Basename;
- foreach my $t ( @tests ) {
- my($num,$rest) = split /\-/xms, File::Basename::basename( $t ), 2;
- push @taints, "t/$num-taint-mode-$rest";
- }
-
- for my $i ( 0..$#tests ) {
- next if $tests[$i] =~ m{ pod[.]t \z }xms;
- next if $tests[$i] =~ m{ pod\-coverage[.]t \z }xms;
- next if $tests[$i] =~ m{ all\-modules\-have\-the\-same\-version[.]t \z }xms;
-
- next if -e $taints[$i]; # already created!
-
- open my $ORIG, '<:raw', $tests[$i] or croak "Can not open file($tests[$i]): $!";
- open my $DEST, '>:raw', $taints[$i] or croak "Can not open file($taints[$i]): $!";
- print {$DEST} TAINT_SHEBANG or croak "Can not print to destination: $!";
- while ( my $line = readline $ORIG ) {
- print {$DEST} $line or croak "Can not print to destination: $!";
- }
- close $ORIG or croak "Can not close original: $!";
- close $DEST or croak "Can not close destination: $!";
- $self->_write_file( '>>', 'MANIFEST', "$taints[$i]\n");
- }
- return;
-}
-
-sub _change_versions_pod {
- my($self, $mod) = @_;
- my $dver = $self->dist_version;
- my(undef, undef, undef, $mday, $mon, $year) = localtime time;
- my $date = join q{ }, $mday, [MONTHS]->[$mon], $year + YEAR_ADD;
-
- my $ns = $mod;
- $ns =~ s{ [\\/] }{::}xmsg;
- $ns =~ s{ \A lib :: }{}xms;
- $ns =~ s{ [.] pm \z }{}xms;
- my $pod = "\nThis document describes version C<$dver> of C<$ns>\n"
- . "released on C<$date>.\n"
- ;
-
- if ( $dver =~ m{[_]}xms ) {
- $pod .= "\nB<WARNING>: This version of the module is part of a\n"
- . "developer (beta) release of the distribution and it is\n"
- . "not suitable for production use.\n";
- }
-
- return $pod;
-}
-
-sub _change_versions {
- my($self, $files) = @_;
- my $dver = $self->dist_version;
-
- warn "CHANGING VERSIONS\n";
- warn "\tDISTRO Version: $dver\n";
-
- foreach my $mod ( @{ $files } ) {
- warn "\tPROCESSING $mod\n";
- my $new = $mod . '.new';
- open my $RO_FH, '<:raw', $mod or croak "Can not open file($mod): $!";
- open my $W_FH , '>:raw', $new or croak "Can not open file($new): $!";
-
- CHANGE_VERSION: while ( my $line = readline $RO_FH ) {
- if ( $line =~ RE_VERSION_LINE ) {
- my $prefix = $1 || q{};
- my $oldv = $2;
- my $remainder = $3;
- warn "\tCHANGED Version from $oldv to $dver\n";
- printf {$W_FH} VTEMP . $remainder, $prefix, $dver;
- last CHANGE_VERSION;
- }
- print {$W_FH} $line or croak "Unable to print to FH: $!";
- }
-
- $self->_change_pod( $RO_FH, $W_FH, $mod );
-
- close $RO_FH or croak "Can not close file($mod): $!";
- close $W_FH or croak "Can not close file($new): $!";
-
- unlink($mod) || croak "Can not remove original module($mod): $!";
- rename( $new, $mod ) || croak "Can not rename( $new, $mod ): $!";
- warn "\tRENAME Successful!\n";
- }
-
- return;
-}
-
-sub _change_pod {
- my($self, $RO_FH, $W_FH, $mod) = @_;
- my $acl = $self->add_pod_author_copyright_license;
- my $acl_buf;
-
- CHANGE_POD: while ( my $line = readline $RO_FH ) {
- if ( $acl && $line =~ m{ \A =cut }xms ) {
- $acl_buf = $line; # buffer the last line
- last;
- }
- print {$W_FH} $line or croak "Unable to print to FH: $!";
- if ( $line =~ RE_POD_LINE ) {
- print {$W_FH} $self->_change_versions_pod( $mod )
- or croak "Unable to print to FH: $!";
- }
- }
-
- if ( $acl && defined $acl_buf ) {
- warn "\tADDING AUTHOR COPYRIGHT LICENSE TO POD\n";
- print {$W_FH} $self->_pod_author_copyright_license, $acl_buf
- or croak "Unable to print to FH: $!";
- while ( my $line = readline $RO_FH ) {
- print {$W_FH} $line or croak "Unable to print to FH: $!";
- }
- }
-
- return;
-}
-
-sub _build_monolith {
- my $self = shift;
- my $files = shift;
- my @mono_dir = ( monolithic_version => split /::/xms, $self->module_name );
- my $mono_file = pop(@mono_dir) . '.pm';
- my $dir = File::Spec->catdir( @mono_dir );
- my $mono = File::Spec->catfile( $dir, $mono_file );
- my $buffer = File::Spec->catfile( $dir, 'buffer.txt' );
- my $readme = File::Spec->catfile( qw( monolithic_version README ) );
- my $copy = $mono . '.tmp';
-
- mkpath $dir;
-
- warn "STARTING TO BUILD MONOLITH\n";
-
- my @files;
- my $c;
- foreach my $f ( @{ $files }) {
- my(undef, undef, $base) = File::Spec->splitpath($f);
- if ( $base eq 'Constants.pm' ) {
- $c = $f;
- next;
- }
- push @files, $f;
- }
- push @files, $c;
-
- my $POD = $self->_monolith_merge(\@files, $mono_file, $mono, $buffer);
-
- $self->_monolith_add_pre( $mono, $copy, \@files, $buffer );
-
- if ( $POD ) {
- open my $MONOX, '>>:raw', $mono or croak "Can not open file($mono): $!";
- foreach my $line ( split /\n/xms, $POD ) {
- print {$MONOX} $line, "\n" or croak "Unable to print to FH: $!";
- if ( "$line\n" =~ RE_POD_LINE ) {
- print {$MONOX} $self->_monolith_pod_warning
- or croak "Unable to print to FH: $!";
- }
- }
- close $MONOX or croak "Unable to close FH: $!";;
- }
-
- unlink $buffer or croak "Can not delete $buffer $!";
- unlink $copy or croak "Can not delete $copy $!";
-
- print "\t" or croak "Unable to print to STDOUT: $!";
- system( $^X, '-wc', $mono ) && die "$mono does not compile!\n";
-
- $self->_monolith_prove();
-
- warn "\tADD README\n";
- $self->_write_file('>', $readme, $self->_monolith_readme);
-
- warn "\tADD TO MANIFEST\n";
- (my $monof = $mono ) =~ s{\\}{/}xmsg;
- (my $readmef = $readme) =~ s{\\}{/}xmsg;
- my $name = $self->module_name;
- $self->_write_file( '>>', 'MANIFEST',
- "$readmef\n",
- "$monof\tThe monolithic version of $name",
- " to ease dropping into web servers. Generated automatically.\n"
- );
- return;
-}
-
-sub _monolith_merge {
- my($self, $files, $mono_file, $mono, $buffer) = @_;
- my %add_pod;
- my $POD = q{};
-
- open my $MONO , '>:raw', $mono or croak "Can not open file($mono): $!";
- open my $BUFFER, '>:raw', $buffer or croak "Can not open file($buffer): $!";
-
- MONO_FILES: foreach my $mod ( reverse @{ $files } ) {
- my(undef, undef, $base) = File::Spec->splitpath($mod);
- warn "\tMERGE $mod\n";
- my $is_eof = 0;
- my $is_pre = $self->_monolith_add_to_top( $base );
- open my $RO_FH, '<:raw', $mod or croak "Can not open file($mod): $!";
- MONO_MERGE: while ( my $line = readline $RO_FH ) {
- #print $MONO "{\n" if ! $curly_top{ $mod }++;
- my $chomped = $line;
- chomp $chomped;
- $is_eof++ if $chomped eq '1;';
- my $no_pod = $is_eof && $base ne $mono_file;
- $no_pod ? last MONO_MERGE
- : do {
- warn "\tADD POD FROM $mod\n"
- if $is_eof && ! $add_pod{ $mod }++;
- };
- $is_eof ? do { $POD .= $line; }
- : do {
- print { $is_pre ? $BUFFER : $MONO } $line
- or croak "Unable to print to FH: $!";
- };
- }
- close $RO_FH or croak "Unable to close FH: $!";
- #print $MONO "}\n";
- }
-
- close $MONO or croak "Unable to close FH: $!";
- close $BUFFER or croak "Unable to close FH: $!";
-
- return $POD;
-}
-
-sub _monolith_prove {
- my($self) = @_;
-
- warn "\tTESTING MONOLITH\n";
- local $ENV{AUTHOR_TESTING_MONOLITH_BUILD} = 1;
- require File::Basename;
- require File::Spec;
- my $pbase = File::Basename::dirname( $^X );
-
- my $prove;
- find {
- wanted => sub {
- my $file = $_;
- return if $file !~ m{ prove }xms;
- $prove = $file;
- },
- no_chdir => 1,
- }, $pbase;
-
- if ( ! $prove || ! -e $prove ) {
- croak "No `prove command found related to $^X`";
- }
-
- warn "\n\tFOUND `prove` at $prove\n\n";
-
- my @output = qx($prove -Imonolithic_version);
- for my $line ( @output ) {
- print "\t$line" or croak "Unable to print to STDOUT: $!";
- }
- chomp(my $result = pop @output);
- croak MONOLITH_TEST_FAIL if $result ne 'Result: PASS';
- return;
-
-}
-
-sub _monolith_add_pre {
- my($self, $mono, $copy, $files, $buffer) = @_;
- require File::Copy;
- File::Copy::copy( $mono, $copy ) or croak "Copy failed: $!";
-
- my $clean_file = sub {
- my $f = shift;
- $f =~ s{ \\ }{/}xmsg;
- $f =~ s{ \A lib/ }{}xms;
- return $f;
- };
-
- my $clean_module = sub {
- my $m = shift;
- $m =~ s{ [.]pm \z }{}xms;
- $m =~ s{ / }{::}xmsg;
- return $m;
- };
-
- my @inc_files = map { $clean_file->( $_ ) } @{ $files };
- my @packages = map { $clean_module->( $_ ) } @inc_files;
-
- open my $W, '>:raw', $mono or croak "Can not open file($mono): $!";
-
- printf {$W} q/BEGIN { $INC{$_} = 1 for qw(%s); }/, join q{ }, @inc_files
- or croak "Can not print to MONO file: $!";
- print {$W} "\n" or croak "Can not print to MONO file: $!";
-
- foreach my $name ( @packages ) {
- print {$W} qq/package $name;\nsub ________monolith {}\n/
- or croak "Can not print to MONO file: $!";
- }
-
- open my $TOP, '<:raw', $buffer or croak "Can not open file($buffer): $!";
- while ( my $line = <$TOP> ) {
- print {$W} $line or croak "Can not print to BUFFER file: $!";
- }
- close $TOP or croak 'Can not close BUFFER file';
-
- open my $COPY, '<:raw', $copy or croak "Can not open file($copy): $!";
- while ( my $line = <$COPY> ) {
- print {$W} $line or croak "Can not print to COPY file: $!";
- }
-
- close $COPY or croak "Can not close COPY file: $!";
- close $W or croak "Can not close MONO file: $!";
-
- return;
-
-}
-
-sub _write_file {
- my($self, $mode, $file, @data) = @_;
- $mode = $mode . ':raw';
- open my $FH, $mode, $file or croak "Can not open file($file): $!";
- foreach my $content ( @data ) {
- print {$FH} $content or croak "Can not print to FH: $!";
- }
- close $FH or croak "Can not close $file $!";
- return;
-}
-
-sub _monolith_add_to_top {
- my $self = shift;
- my $base = shift;
- my $list = $self->monolith_add_to_top || croak 'monolith_add_to_top not set';
- croak 'monolith_add_to_top is not an ARRAY' if ref $list ne 'ARRAY';
- foreach my $test ( @{ $list } ) {
- return 1 if $test eq $base;
- }
- return 0;
-}
-
-sub _monolith_readme {
- my $self = shift;
- my $pod = $self->_monolith_pod_warning;
- $pod =~ s{B<(.+?)>}{$1}xmsg;
- return $pod;
-}
-
-sub _monolith_pod_warning {
- my $self = shift;
- my $name = $self->module_name;
- return <<"MONOLITH_POD_WARNING";
-
-B<WARNING>! This is the monolithic version of $name
-generated with an automatic build tool. If you experience problems
-with this version, please install and use the supported standard
-version. This version is B<NOT SUPPORTED>.
-MONOLITH_POD_WARNING
-}
-
-sub _add_vanilla_makefile_pl {
- my $self = shift;
- my $file = 'Makefile.PL';
- return if -e $file; # do not overwrite
- $self->_write_file( '>', $file, $self->_vanilla_makefile_pl );
- $self->_write_file( '>>', 'MANIFEST', "$file\tGenerated automatically\n");
- warn "ADDED VANILLA $file\n";
- return;
-}
-
-sub _vanilla_makefile_pl {
- my $self = shift;
- my $hook = $self->initialization_hook;
- my $extra = ! $hook ? q() : <<'HOOK';
-
-my $eok = eval <<'THIS_IS_SOME_IDENTIFIER';
-<%HOOK%>
-THIS_IS_SOME_IDENTIFIER
-
-die "Error compiling initialization_hook: $@\n" if $@;
-
-HOOK
-
- $extra =~ s{<%HOOK%>}{$hook}xmsg if $extra;
-
- my $code = <<'VANILLA_MAKEFILE_PL';
-#!/usr/bin/env perl
-use strict;
-use ExtUtils::MakeMaker;
-use lib qw( builder );
-use Build::Spec qw( mm_spec );
-
-my %spec = mm_spec;
-
-<%EXTRA%>
-
-WriteMakefile(
- NAME => $spec{module_name},
- VERSION_FROM => $spec{VERSION_FROM},
- PREREQ_PM => $spec{PREREQ_PM},
- PL_FILES => {},
- ($] >= 5.005 ? (
- AUTHOR => $spec{dist_author},
- ABSTRACT => $spec{ABSTRACT},
- EXE_FILES => $spec{EXE_FILES},
- ) : ()),
-);
-VANILLA_MAKEFILE_PL
- $code =~ s{<%EXTRA%>}{$extra}xmsg;
- return $code;
-}
-
-sub _pod_author_copyright_license {
- my $self = shift;
- my $da = $self->dist_author; # support only 1 author for now
- my($author, $email) = $da->[0] =~ m{ (.+?) < ( .+?) > }xms;
- $author = $self->mytrim( $author );
- $email = $self->mytrim( $email );
- my $cfy = $self->copyright_first_year;
- my $year = (localtime time)[YEAR_SLOT] + YEAR_ADD;
- $year = "$cfy - $year" if $cfy && $cfy != $year && $cfy < $year;
- my $perl = sprintf '%vd', $^V;
- return <<"POD";
-=head1 AUTHOR
-
-$author <$email>.
-
-=head1 COPYRIGHT
-
-Copyright $year $author. All rights reserved.
-
-=head1 LICENSE
-
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself, either Perl version $perl or,
-at your option, any later version of Perl 5 you may have available.
-
-POD
-}
-
-1;
-
-__END__
@@ -0,0 +1,58 @@
+package Build::Constants;
+use strict;
+use warnings;
+
+our $VERSION = '0.80';
+
+use base qw( Exporter );
+
+use constant TAINT_SHEBANG => "#!perl -Tw\nuse constant TAINTMODE => 1;\n";
+use constant RE_VERSION_LINE => qr{
+ \A (our\s+)? \$VERSION \s+ = \s+ ["'] (.+?) ['"] ; (.+?) \z
+}xms;
+use constant RE_POD_LINE => qr{
+ \A
+ =head1 \s+ DESCRIPTION \s+
+ \z
+}xms;
+use constant VTEMP => q{%s$VERSION = '%s';};
+use constant MONTHS => qw(
+ January February March April May June
+ July August September October November December
+);
+use constant MONOLITH_TEST_FAIL =>
+ "\nFAILED! Building the monolithic version failed during unit testing\n\n";
+
+use constant NO_INDEX => qw(
+ monolithic_version
+ builder
+ t
+ xt
+);
+use constant DEFAULTS => qw(
+ license perl
+ create_license 1
+ sign 0
+);
+use constant YEAR_ADD => 1900;
+use constant YEAR_SLOT => 5;
+
+our @EXPORT_OK = qw(
+ TAINT_SHEBANG
+ RE_VERSION_LINE
+ RE_POD_LINE
+ VTEMP
+ MONTHS
+ MONOLITH_TEST_FAIL
+ NO_INDEX
+ DEFAULTS
+ YEAR_ADD
+ YEAR_SLOT
+);
+our %EXPORT_TAGS = (
+ all => \@EXPORT_OK,
+);
+
+1;
+
+__END__
@@ -0,0 +1,102 @@
+package Build::Spec;
+use strict;
+use warnings;
+use Exporter ();
+use Carp qw( croak );
+use constant DEFAULT_AUTHOR => 'Burak Gursoy <burak@cpan.org>';
+use constant OS_ERROR => qr{OS \s+ unsupported}xms;
+use base qw( Exporter );
+
+BEGIN {
+ our $VERSION = '0.80';
+ our @EXPORT = qw( spec );
+ our @EXPORT_OK = qw( mm_spec );
+}
+
+sub spec {
+ my %opt = @_;
+ my $file = 'SPEC';
+ my $spec = do $file;
+
+ my %rv =
+ $@ ? do { croak $@ =~ OS_ERROR ? $@ : "Couldn't parse $file: $@" }
+ : ! defined $spec && $! ? croak "Couldn't do $file: $!"
+ : ! $spec ? croak "$file did not return a true value"
+ : ref($spec) ne 'HASH' ? croak "Return type of $file is not HASH"
+ : ! $spec->{module_name} ? croak "The specification returned from $file does"
+ .q{ not have the mandatory 'module_name' key}
+ : %{ $spec };
+ ;
+
+ # these needs to be set here
+ $rv{dist_author} ||= DEFAULT_AUTHOR;
+ $rv{recommends} ||= {};
+ $rv{requires} ||= {};
+ my $breq = $rv{build_requires} ||= {};
+ $breq->{'Test::More'} = '0.40' if ! exists $breq->{'Test::More'};
+
+ delete $rv{BUILDER} if ! $opt{builder};
+
+ return %rv;
+}
+
+sub trim {
+ my $s = shift;
+ return $s if ! $s;
+ $s =~ s{ \A \s+ }{}xms;
+ $s =~ s{ \s+ \z }{}xms;
+ return $s;
+}
+
+# Makefile.PL related things
+
+sub mm_spec {
+ my %spec = spec();
+ (my $file = $spec{module_name}) =~ s{::}{/}xmsg;
+ $spec{VERSION_FROM} = "lib/$file.pm";
+ $spec{PREREQ_PM} = { %{ $spec{requires} }, %{ $spec{build_requires} } };
+ _mm_recommend( %spec );
+ $spec{ABSTRACT} = _mm_abstract( $spec{VERSION_FROM} );
+ $spec{EXE_FILES} = $spec{script_files} ? $spec{script_files} : [];
+ return %spec;
+}
+
+sub _mm_recommend {
+ my %spec = @_;
+ return if ! $spec{recommends};
+ my %rec = %{ $spec{recommends} } or return;
+ my $info = "\nRecommended Modules:\n\n";
+ foreach my $m ( sort keys %rec ) {
+ $info .= sprintf "\t%s\tv%s\n", $m, $rec{$m};
+ }
+ my $pok = print "$info\n";
+ return;
+}
+
+sub _mm_abstract {
+ my $file = shift;
+ require IO::File;
+ my $fh = IO::File->new;
+ $fh->open( $file, 'r' ) || croak "Can not read $file: $!";
+ binmode $fh;
+ while ( my $line = <$fh> ) {
+ chomp $line;
+ last if $line eq '=head1 NAME';
+ }
+ my $buf;
+ while ( my $line = <$fh> ) {
+ chomp $line;
+ last if $line =~ m{ \A =head }xms;
+ $buf .= $line;
+ }
+ $fh->close || croak "Can not close $file: $!";
+ croak 'Unable to get ABSTRACT' if ! $buf;
+ $buf = trim( $buf );
+ my($mod, $desc) = split m{\-}xms, $buf, 2;
+ $desc = trim( $desc ) || croak 'Unable to get ABSTRACT';
+ return $desc;
+}
+
+1;
+
+__END__
@@ -0,0 +1,32 @@
+package Build::Util;
+use strict;
+use warnings;
+use base qw( Exporter );
+use Carp ();
+
+our $VERSION = '0.80';
+our @EXPORT_OK = qw( slurp trim );
+
+sub slurp {
+ my $path = shift || Carp::croak( 'No file path specified' );
+ if ( ! -e $path ) {
+ Carp::croak( "The specified file path $path does not exist" );
+ }
+ open my $FH, '<', $path or Carp::croak( "Can not open file($path): $!" );
+ my $rv = do { local $/; <$FH> };
+ close $FH or Carp::croak( "Can't close($path): $!" );
+ return $rv;
+}
+
+sub trim {
+ my($s, $extra) = @_;
+ return $s if ! $s;
+ $extra ||= q{};
+ $s =~ s{\A \s+ }{$extra}xms;
+ $s =~ s{ \s+ \z}{$extra}xms;
+ return $s;
+}
+
+1;
+
+__END__
@@ -0,0 +1,596 @@
+package Build;
+use strict;
+use warnings;
+use base qw( Module::Build );
+
+## no critic (InputOutput::ProhibitBacktickOperators)
+
+our $VERSION = '0.80';
+
+use File::Find;
+use File::Spec;
+use File::Path;
+use Carp qw( croak );
+
+use Build::Constants qw( :all );
+use Build::Spec;
+use Build::Util qw( slurp trim );
+
+BEGIN {
+ my %default = (
+ add_pod_author_copyright_license => 0,
+ build_monolith => 0,
+ change_versions => 0,
+ copyright_first_year => 0,
+ initialization_hook => q(),
+ monolith_add_to_top => [],
+ taint_mode_tests => 0,
+ vanilla_makefile_pl => 1,
+ );
+ foreach my $meth ( keys %default ) {
+ __PACKAGE__->add_property( $meth => $default{ $meth } );
+ }
+}
+
+sub new {
+ my $class = shift;
+ my %opt = spec;
+ my %def = DEFAULTS;
+ foreach my $key ( keys %def ) {
+ $opt{ $key } = $def{ $key } if ! defined $opt{ $key };
+ }
+ $opt{no_index} ||= {};
+ $opt{no_index}{directory} ||= [];
+ push @{ $opt{no_index}{directory} }, NO_INDEX;
+ return $class->SUPER::new( %opt );
+}
+
+sub create_build_script {
+ my $self = shift;
+ $self->_add_vanilla_makefile_pl if $self->vanilla_makefile_pl;
+
+ if ( my $hook = $self->initialization_hook ) {
+ my $eok = eval $hook;
+ croak "Error compiling initialization_hook: $@" if $@;
+ }
+
+ return $self->SUPER::create_build_script( @_ );
+}
+
+sub ACTION_dist { ## no critic (NamingConventions::Capitalization)
+ my $self = shift;
+ my $msg = sprintf q{RUNNING 'dist' Action from subclass %s v%s},
+ ref($self),
+ $VERSION;
+ warn "$msg\n";
+ my @modules;
+ find {
+ wanted => sub {
+ my $file = $_;
+ return if $file !~ m{ [.] pm \z }xms;
+ $file = File::Spec->catfile( $file );
+ push @modules, $file;
+ warn "FOUND Module: $file\n";
+ },
+ no_chdir => 1,
+ }, 'lib';
+
+ $self->_create_taint_mode_tests if $self->taint_mode_tests;
+ $self->_change_versions( \@modules ) if $self->change_versions;
+ $self->_build_monolith( \@modules ) if $self->build_monolith;
+
+ return $self->SUPER::ACTION_dist( @_ );
+}
+
+sub ACTION_extratest {
+ # Stolen from
+ # http://elliotlovesperl.com/2009/11/24/explicitly-running-author-tests
+ #
+ my($self) = @_;
+ $self->depends_on( 'build' );
+ $self->depends_on( 'manifest' );
+ $self->depends_on( 'distmeta' );
+
+ $self->test_files( qw< xt > );
+ $self->recursive_test_files(1);
+
+ $self->depends_on( 'test' );
+
+ return;
+}
+
+sub ACTION_distdir {
+ my ($self) = @_;
+
+ $self->depends_on( 'extratest' );
+
+ return $self->SUPER::ACTION_distdir();
+}
+
+sub _create_taint_mode_tests {
+ my $self = shift;
+ my @tests = glob 't/*.t';
+ my @taints;
+ require File::Basename;
+ foreach my $t ( @tests ) {
+ my($num,$rest) = split /\-/xms, File::Basename::basename( $t ), 2;
+ push @taints, "t/$num-taint-mode-$rest";
+ }
+
+ for my $i ( 0..$#tests ) {
+ next if $tests[$i] =~ m{ pod[.]t \z }xms;
+ next if $tests[$i] =~ m{ pod\-coverage[.]t \z }xms;
+ next if $tests[$i] =~ m{ all\-modules\-have\-the\-same\-version[.]t \z }xms;
+
+ next if -e $taints[$i]; # already created!
+
+ open my $ORIG, '<:raw', $tests[$i] or croak "Can not open file($tests[$i]): $!";
+ open my $DEST, '>:raw', $taints[$i] or croak "Can not open file($taints[$i]): $!";
+ print {$DEST} TAINT_SHEBANG or croak "Can not print to destination: $!";
+
+ while ( defined( my $line = readline $ORIG ) ) {
+ print {$DEST} $line or croak "Can not print to destination: $!";
+ }
+
+ close $ORIG or croak "Can not close original: $!";
+ close $DEST or croak "Can not close destination: $!";
+
+ $self->_write_file( '>>', 'MANIFEST', "$taints[$i]\n");
+ }
+
+ return;
+}
+
+sub _change_versions_pod {
+ my($self, $mod) = @_;
+ my $dver = $self->dist_version;
+ my($mday, $mon, $year) = (localtime time)[3..5];
+ my $date = join q{ }, $mday, [MONTHS]->[$mon], $year + YEAR_ADD;
+
+ my $ns = $mod;
+ $ns =~ s{ [\\/] }{::}xmsg;
+ $ns =~ s{ \A lib :: }{}xms;
+ $ns =~ s{ [.] pm \z }{}xms;
+ my $pod = "\nThis document describes version C<$dver> of C<$ns>\n"
+ . "released on C<$date>.\n"
+ ;
+
+ if ( $dver =~ m{[_]}xms ) {
+ $pod .= join qq{\n},
+ "\nB<WARNING>: This version of the module is part of a",
+ "developer (beta) release of the distribution and it is",
+ "not suitable for production use.",
+ ;
+ }
+
+ return $pod;
+}
+
+sub _change_versions {
+ my($self, $files) = @_;
+ my $dver = $self->dist_version;
+
+ warn "CHANGING VERSIONS\n";
+ warn "\tDISTRO Version: $dver\n";
+
+ foreach my $mod ( @{ $files } ) {
+ warn "\tPROCESSING $mod\n";
+ my $new = $mod . '.new';
+
+ open my $RO_FH, '<:raw', $mod or croak "Can not open file($mod): $!";
+ open my $W_FH , '>:raw', $new or croak "Can not open file($new): $!";
+
+ CHANGE_VERSION: while ( defined( my $line = readline $RO_FH ) ) {
+ if ( $line =~ RE_VERSION_LINE ) {
+ my $prefix = $1 || q{};
+ my $oldv = $2;
+ my $remainder = $3;
+ warn "\tCHANGED Version from $oldv to $dver\n";
+ printf {$W_FH} VTEMP . $remainder, $prefix, $dver;
+ last CHANGE_VERSION;
+ }
+ print {$W_FH} $line or croak "Unable to print to FH: $!";
+ }
+
+ $self->_change_pod( $RO_FH, $W_FH, $mod );
+
+ close $RO_FH or croak "Can not close file($mod): $!";
+ close $W_FH or croak "Can not close file($new): $!";
+
+ unlink($mod) || croak "Can not remove original module($mod): $!";
+ rename( $new, $mod ) || croak "Can not rename( $new, $mod ): $!";
+ warn "\tRENAME Successful!\n";
+ }
+
+ return;
+}
+
+sub _change_pod {
+ my($self, $RO_FH, $W_FH, $mod) = @_;
+ my $acl = $self->add_pod_author_copyright_license;
+ my $acl_buf;
+
+ CHANGE_POD: while ( defined( my $line = readline $RO_FH ) ) {
+ if ( $acl && $line =~ m{ \A =cut }xms ) {
+ $acl_buf = $line; # buffer the last line
+ last;
+ }
+
+ print {$W_FH} $line or croak "Unable to print to FH: $!";
+
+ if ( $line =~ RE_POD_LINE ) {
+ print {$W_FH} $self->_change_versions_pod( $mod )
+ or croak "Unable to print to FH: $!";
+ }
+ }
+
+ if ( $acl && defined $acl_buf ) {
+ warn "\tADDING AUTHOR COPYRIGHT LICENSE TO POD\n";
+ print {$W_FH} $self->_pod_author_copyright_license, $acl_buf
+ or croak "Unable to print to FH: $!";
+
+ while ( defined( my $line = readline $RO_FH ) ) {
+ print {$W_FH} $line or croak "Unable to print to FH: $!";
+ }
+ }
+
+ return;
+}
+
+sub _build_monolith {
+ my $self = shift;
+ my $files = shift;
+ my @mono_dir = ( monolithic_version => split /::/xms, $self->module_name );
+ my $mono_file = pop(@mono_dir) . '.pm';
+ my $dir = File::Spec->catdir( @mono_dir );
+ my $mono = File::Spec->catfile( $dir, $mono_file );
+ my $buffer = File::Spec->catfile( $dir, 'buffer.txt' );
+ my $readme = File::Spec->catfile( qw( monolithic_version README ) );
+ my $copy = $mono . '.tmp';
+
+ mkpath $dir;
+
+ warn "STARTING TO BUILD MONOLITH\n";
+
+ my(@files, $c);
+ foreach my $f ( @{ $files }) {
+ my(undef, undef, $base) = File::Spec->splitpath($f);
+ if ( $base eq 'Constants.pm' ) {
+ $c = $f;
+ next;
+ }
+ push @files, $f;
+ }
+
+ push @files, $c;
+
+ my $POD = $self->_monolith_merge(\@files, $mono_file, $mono, $buffer);
+ $self->_monolith_add_pre( $mono, $copy, \@files, $buffer );
+
+ if ( $POD ) {
+ open my $MONOX, '>>:raw', $mono or croak "Can not open file($mono): $!";
+ foreach my $line ( split /\n/xms, $POD ) {
+ print {$MONOX} $line, "\n" or croak "Unable to print to FH: $!";
+ if ( "$line\n" =~ RE_POD_LINE ) {
+ print {$MONOX} $self->_monolith_pod_warning
+ or croak "Unable to print to FH: $!";
+ }
+ }
+ close $MONOX or croak "Unable to close FH: $!";;
+ }
+
+ unlink $buffer or croak "Can not delete $buffer $!";
+ unlink $copy or croak "Can not delete $copy $!";
+
+ print "\t" or croak "Unable to print to STDOUT: $!";
+ system( $^X, '-wc', $mono ) && die "$mono does not compile!\n";
+
+ $self->_monolith_prove;
+
+ warn "\tADD README\n";
+ $self->_write_file('>', $readme, $self->_monolith_readme);
+
+ warn "\tADD TO MANIFEST\n";
+
+ (my $monof = $mono ) =~ s{\\}{/}xmsg;
+ (my $readmef = $readme) =~ s{\\}{/}xmsg;
+ my $name = $self->module_name;
+
+ $self->_write_file( '>>', 'MANIFEST',
+ "$readmef\n",
+ "$monof\tThe monolithic version of $name",
+ " to ease dropping into web servers. Generated automatically.\n"
+ );
+
+ return;
+}
+
+sub _monolith_merge {
+ my($self, $files, $mono_file, $mono, $buffer) = @_;
+ my %add_pod;
+ my $pod = q{};
+
+ open my $MONO , '>:raw', $mono or croak "Can't open file($mono): $!";
+ open my $BUFFER, '>:raw', $buffer or croak "Can't open file($buffer): $!";
+
+ MONO_FILES: foreach my $mod ( reverse @{ $files } ) {
+ warn "\tMERGE $mod\n";
+ my(undef, undef, $base) = File::Spec->splitpath( $mod );
+ my $is_eof = 0;
+ my $is_pre = $self->_monolith_add_to_top( $base );
+ my $TARGET = $is_pre ? $BUFFER : $MONO;
+ open my $RO_FH, '<:raw', $mod or croak "Can not open file($mod): $!";
+
+ MONO_MERGE: while ( defined( my $line = readline $RO_FH ) ) {
+ chomp( my $chomped = $line );
+ $is_eof++ if $chomped eq '1;';
+ last MONO_MERGE if $is_eof && $base ne $mono_file;
+
+ if ( $is_eof ) {
+ warn "\tADD POD FROM $mod\n" if ! $add_pod{ $mod }++;
+ $pod .= $line;
+ next;
+ }
+
+ print { $TARGET } $line or croak "Unable to print to FH: $!";
+ }
+
+ close $RO_FH or croak "Unable to close FH: $!";
+ }
+
+ close $MONO or croak "Unable to close FH: $!";
+ close $BUFFER or croak "Unable to close FH: $!";
+
+ return $pod;
+}
+
+sub _monolith_prove {
+ my($self) = @_;
+
+ warn "\tTESTING MONOLITH\n";
+ local $ENV{AUTHOR_TESTING_MONOLITH_BUILD} = 1;
+
+ require File::Basename;
+ require File::Spec;
+
+ my $pbase = File::Basename::dirname( $^X );
+ my $prove;
+ find {
+ wanted => sub {
+ my $file = $_;
+ return if $file !~ m{ prove }xms;
+ $prove = $file;
+ },
+ no_chdir => 1,
+ }, $pbase;
+
+ if ( ! $prove || ! -e $prove ) {
+ croak "No `prove command found related to $^X`";
+ }
+
+ warn "\n\tFOUND `prove` at $prove\n\n";
+
+ require IPC::Open3;
+ my $prove_pid = IPC::Open3::open3(
+ my($prove_in, $prove_out, $prove_err),
+ $prove, qw(-Ilib -r t xt)
+ );
+
+ my $prove_status;
+ while ( defined( my $result = <$prove_out> ) ) {
+ chomp $result;
+ $prove_status = $result;
+ print "\t$result\n" or croak "Unable to print to STDOUT: $!";
+ }
+
+ waitpid( $prove_pid, 0 );
+ my $prove_failed = $? >> 8;
+
+ if ( $prove_failed || $prove_status ne 'Result: PASS' ) {
+ croak MONOLITH_TEST_FAIL;
+ }
+
+ return;
+}
+
+sub _monolith_add_pre {
+ my($self, $mono, $copy, $files, $buffer) = @_;
+ require File::Copy;
+ File::Copy::copy( $mono, $copy ) or croak "Copy failed: $!";
+
+ my $clean_file = sub {
+ my $f = shift;
+ $f =~ s{ \\ }{/}xmsg;
+ $f =~ s{ \A lib/ }{}xms;
+ return $f;
+ };
+
+ my $clean_module = sub {
+ my $m = shift;
+ $m =~ s{ [.]pm \z }{}xms;
+ $m =~ s{ / }{::}xmsg;
+ return $m;
+ };
+
+ my @inc_files = map { $clean_file->( $_ ) } @{ $files };
+ my @packages = map { $clean_module->( $_ ) } @inc_files;
+
+ open my $W, '>:raw', $mono or croak "Can not open file($mono): $!";
+
+ printf {$W} q/BEGIN { $INC{$_} = 1 for qw(%s); }/, join q{ }, @inc_files
+ or croak "Can not print to MONO file: $!";
+ print {$W} "\n" or croak "Can not print to MONO file: $!";
+
+ foreach my $name ( @packages ) {
+ print {$W} qq/package $name;\nsub ________monolith {}\n/
+ or croak "Can not print to MONO file: $!";
+ }
+
+ open my $TOP, '<:raw', $buffer or croak "Can not open file($buffer): $!";
+ while ( defined( my $line = <$TOP> ) ) {
+ print {$W} $line or croak "Can not print to BUFFER file: $!";
+ }
+ close $TOP or croak 'Can not close BUFFER file';
+
+ open my $COPY, '<:raw', $copy or croak "Can not open file($copy): $!";
+
+ while ( defined( my $line = <$COPY> ) ) {
+ print {$W} $line or croak "Can not print to COPY file: $!";
+ }
+
+ close $COPY or croak "Can't close COPY file: $!";
+ close $W or croak "Can't close MONO file: $!";
+
+ return;
+}
+
+sub _write_file {
+ my($self, $mode, $file, @data) = @_;
+ $mode = $mode . ':raw';
+ open my $FH, $mode, $file or croak "Can not open file($file): $!";
+ print {$FH} @data or croak "Can not print to FH: $!";
+ close $FH or croak "Can not close $file $!";
+ return;
+}
+
+sub _monolith_add_to_top {
+ my $self = shift;
+ my $base = shift;
+ my $list = $self->monolith_add_to_top || croak 'monolith_add_to_top not set';
+ croak 'monolith_add_to_top is not an ARRAY' if ref $list ne 'ARRAY';
+ return grep { $_ eq $base } @{ $list };
+}
+
+sub _monolith_readme {
+ my $self = shift;
+ (my $pod = $self->_monolith_pod_warning) =~ s{B<(.+?)>}{$1}xmsg;
+ return $pod;
+}
+
+sub _monolith_pod_warning {
+ my $self = shift;
+ return $self->_compile_template(
+ 'pod/monolith-warning.pod' => {
+ module => $self->module_name,
+ },
+ );
+}
+
+sub _automatic_build_file_header {
+ return shift->_compile_template( 'tools/builder.header' );
+}
+
+sub _add_automatic_build_pl {
+ my $self = shift;
+ my $file = 'Build.PL';
+ return if -e $file; # do not overwrite
+ $self->_write_file( '>', $file => $self->_automatic_build_pl );
+ $self->_write_file( '>>', MANIFEST => "$file\tGenerated automatically\n");
+ warn "ADDED AUTOMATIC $file\n";
+ return;
+}
+
+sub _automatic_build_pl {
+ my $self = shift;
+ my %spec = Build::Spec::spec( builder => 1 );
+ my $build = delete $spec{BUILDER} || croak 'SPEC does not have a BUILDER key';
+ my $methods = join ";\n",
+ map { sprintf q{$mb->%s( %s )}, $_, $build->{ $_ } }
+ keys %{ $build };
+
+ return join q{},
+ $self->_automatic_build_file_header,
+ $self->_compile_template(
+ 'tools/Build.PL' => {
+ methods => $methods,
+ },
+ ),
+ ;
+}
+
+sub _add_vanilla_makefile_pl {
+ my $self = shift;
+ my $file = 'Makefile.PL';
+ return if -e $file; # don't overwrite
+ $self->_write_file( '>', $file => $self->_vanilla_makefile_pl );
+ $self->_write_file( '>>', MANIFEST => "$file\tGenerated automatically\n");
+ warn "ADDED VANILLA $file\n";
+ return;
+}
+
+sub _vanilla_makefile_pl {
+ my $self = shift;
+ my $hook = $self->initialization_hook;
+
+ if ( $hook ) {
+ $hook = $self->_compile_template(
+ 'tools/Makefile.PL.hook' => {
+ hook => $hook,
+ },
+ ),
+ }
+
+ return join q{},
+ $self->_automatic_build_file_header,
+ $self->_compile_template(
+ 'tools/Makefile.PL' => {
+ hook => $hook || q{},
+ },
+ ),
+ ;
+}
+
+sub _pod_author_copyright_license {
+ my $self = shift;
+ my $da = $self->dist_author; # support only 1 author for now
+ my $cfy = $self->copyright_first_year;
+ my $year = (localtime time)[YEAR_SLOT] + YEAR_ADD;
+ my($author, $email) = $da->[0] =~ m{ (.+?) < (.+?) > }xms;
+ $author = trim( $author ) if $author;
+ $email = trim( $email ) if $email;
+ $year = "$cfy - $year" if $cfy && $cfy != $year && $cfy < $year;
+
+ return $self->_compile_template(
+ 'pod/author.pod' => {
+ author => $author,
+ email => $email,
+ year => $year,
+ perl => sprintf( '%vd', $^V ),
+ },
+ );
+
+}
+
+sub _compile_template {
+ my($self, $path, $param) = @_;
+
+ my $full_path = File::Spec->catfile( qw( builder templates ), $path );
+ die "Can't locate template $path: $!" if ! -e $full_path;
+
+ $param ||= {};
+ my $raw = slurp( $full_path );
+ my %p = map { uc( $_ ) => $param->{ $_ } } keys %{ $param };
+ my %seen;
+ my $key_value = sub {
+ my $match = shift;
+ my $key = trim( $match );
+ my $value = $p{ $key };
+
+ if ( ! defined $value ) {
+ if ( ! $seen{ $key }++ ) {
+ warn "$path: Bogus or no value for template key '$key'";
+ }
+ return q();
+ }
+
+ return $value;
+ };
+
+ $raw =~ s{[[][%](.+?)[%][]]}{$key_value->($1)}xmsge;
+
+ return $raw;
+}
+
+1;
+
+__END__
@@ -0,0 +1,13 @@
+=head1 AUTHOR
+
+[%AUTHOR%] <[%EMAIL%]>.
+
+=head1 COPYRIGHT
+
+Copyright [%YEAR%] [%AUTHOR%]. All rights reserved.
+
+=head1 LICENSE
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself, either Perl version [%PERL%] or,
+at your option, any later version of Perl 5 you may have available.
@@ -0,0 +1,5 @@
+
+B<WARNING>! This is the monolithic version of [%MODULE%]
+generated with an automatic build tool. If you experience problems
+with this version, please install and use the supported standard
+version. This version is B<NOT SUPPORTED>.
@@ -0,0 +1,8 @@
+use Build;
+my $mb = Build->new;
+
+[%METHODS%];
+
+$mb->create_build_script;
+
+1;
@@ -0,0 +1,18 @@
+use Build::Spec qw( mm_spec );
+use ExtUtils::MakeMaker;
+
+my %spec = mm_spec;
+
+[%HOOK%]
+
+WriteMakefile(
+ NAME => $spec{module_name},
+ VERSION_FROM => $spec{VERSION_FROM},
+ PREREQ_PM => $spec{PREREQ_PM},
+ PL_FILES => {},
+ ($] >= 5.005 ? (
+ AUTHOR => $spec{dist_author},
+ ABSTRACT => $spec{ABSTRACT},
+ EXE_FILES => $spec{EXE_FILES},
+ ) : ()),
+);
@@ -0,0 +1,5 @@
+my $eok = eval <<'THIS_IS_SOME_IDENTIFIER';
+[%HOOK%]
+THIS_IS_SOME_IDENTIFIER
+
+die "Error compiling initialization_hook: $@\n" if $@;
@@ -0,0 +1,6 @@
+#!/usr/bin/env perl
+# This file was created automatically
+use 5.006;
+use strict;
+use warnings;
+use lib qw( builder/lib );
@@ -11,7 +11,7 @@ use constant DRIVER_FAIL_MSG => q{Operating system identified as: '%s'. }
. q{Falling back to compatibility mode};
use constant YEAR_DIFF => 1900;
-$VERSION = '0.7802';
+$VERSION = '0.7803';
my %LOAD_MODULE; # cache
my %UNAME; # cache
@@ -149,8 +149,8 @@ Sys::Info::Base - Base class for Sys::Info
=head1 DESCRIPTION
-This document describes version C<0.7802> of C<Sys::Info::Base>
-released on C<31 July 2011>.
+This document describes version C<0.7803> of C<Sys::Info::Base>
+released on C<10 May 2013>.
Includes some common methods.
@@ -199,12 +199,11 @@ Burak Gursoy <burak@cpan.org>.
=head1 COPYRIGHT
-Copyright 2006 - 2011 Burak Gursoy. All rights reserved.
+Copyright 2006 - 2013 Burak Gursoy. All rights reserved.
=head1 LICENSE
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself, either Perl version 5.12.3 or,
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself, either Perl version 5.16.2 or,
at your option, any later version of Perl 5 you may have available.
-
=cut
@@ -5,7 +5,7 @@ use vars qw( $VERSION @EXPORT_OK %EXPORT_TAGS );
use Carp qw( croak );
use base qw( Exporter );
-$VERSION = '0.7802';
+$VERSION = '0.7803';
BEGIN {
if ( ! defined &OSID ) {
@@ -103,8 +103,8 @@ Sys::Info::Constants - Constants for Sys::Info
=head1 DESCRIPTION
-This document describes version C<0.7802> of C<Sys::Info::Constants>
-released on C<31 July 2011>.
+This document describes version C<0.7803> of C<Sys::Info::Constants>
+released on C<10 May 2013>.
This module defines all the constants used inside C<Sys::Info> and it's
subclasses.
@@ -151,12 +151,11 @@ Burak Gursoy <burak@cpan.org>.
=head1 COPYRIGHT
-Copyright 2006 - 2011 Burak Gursoy. All rights reserved.
+Copyright 2006 - 2013 Burak Gursoy. All rights reserved.
=head1 LICENSE
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself, either Perl version 5.12.3 or,
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself, either Perl version 5.16.2 or,
at your option, any later version of Perl 5 you may have available.
-
=cut
@@ -8,7 +8,7 @@ use Sys::Info::Constants qw( OSID );
use Carp qw( croak );
use base __PACKAGE__->load_subclass('Sys::Info::Driver::%s::Device::CPU');
-$VERSION = '0.7802';
+$VERSION = '0.7803';
BEGIN {
# define aliases
@@ -115,8 +115,8 @@ Example:
=head1 DESCRIPTION
-This document describes version C<0.7802> of C<Sys::Info::Device::CPU>
-released on C<31 July 2011>.
+This document describes version C<0.7803> of C<Sys::Info::Device::CPU>
+released on C<10 May 2013>.
Collects and returns information about the Central Processing Unit
(CPU) on the host machine.
@@ -222,12 +222,11 @@ Burak Gursoy <burak@cpan.org>.
=head1 COPYRIGHT
-Copyright 2006 - 2011 Burak Gursoy. All rights reserved.
+Copyright 2006 - 2013 Burak Gursoy. All rights reserved.
=head1 LICENSE
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself, either Perl version 5.12.3 or,
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself, either Perl version 5.16.2 or,
at your option, any later version of Perl 5 you may have available.
-
=cut
@@ -7,7 +7,7 @@ use Carp qw( croak );
use base qw( Sys::Info::Base );
use Sys::Info::Constants qw( OSID );
-$VERSION = '0.7802';
+$VERSION = '0.7803';
BEGIN {
MK_ACCESSORS: {
@@ -73,8 +73,8 @@ or
=head1 DESCRIPTION
-This document describes version C<0.7802> of C<Sys::Info::Device>
-released on C<31 July 2011>.
+This document describes version C<0.7803> of C<Sys::Info::Device>
+released on C<10 May 2013>.
This is an interface to the available devices such as the C<CPU>.
@@ -98,12 +98,11 @@ Burak Gursoy <burak@cpan.org>.
=head1 COPYRIGHT
-Copyright 2006 - 2011 Burak Gursoy. All rights reserved.
+Copyright 2006 - 2013 Burak Gursoy. All rights reserved.
=head1 LICENSE
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself, either Perl version 5.12.3 or,
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself, either Perl version 5.16.2 or,
at your option, any later version of Perl 5 you may have available.
-
=cut
@@ -3,7 +3,7 @@ use strict;
use warnings;
use vars qw( $VERSION );
-$VERSION = '0.7802';
+$VERSION = '0.7803';
1;
@@ -27,12 +27,11 @@ Burak Gursoy <burak@cpan.org>.
=head1 COPYRIGHT
-Copyright 2006 - 2011 Burak Gursoy. All rights reserved.
+Copyright 2006 - 2013 Burak Gursoy. All rights reserved.
=head1 LICENSE
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself, either Perl version 5.12.3 or,
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself, either Perl version 5.16.2 or,
at your option, any later version of Perl 5 you may have available.
-
=cut
@@ -0,0 +1,398 @@
+package Sys::Info::Helper;
+use 5.006;
+use strict;
+use warnings;
+use vars qw( $VERSION @EXPORT );
+use base qw(Exporter);
+use File::Spec::Functions qw( catdir catfile );
+use File::Path;
+use File::Basename;
+use Cwd;
+use Carp qw( croak );
+use Data::Dumper;
+use Text::Template::Simple;
+
+$VERSION = '0.7803';
+@EXPORT = qw( new_driver );
+
+sub new {
+ my($class, @args) = @_;
+ my $self = {
+ @args % 2 ? () : @args,
+ };
+ bless $self, $class;
+ return $self;
+}
+
+sub new_driver {
+ my $os = shift || croak 'OS name?';
+ my $you = shift || 'Your Name';
+ my $self = __PACKAGE__->new( os => $os, you => $you );
+ my $mb = catdir qw( lib Sys Info Driver );
+ my %file = (
+ catfile( $mb, "$os.pm" ) => $self->_template( 'base' ),
+ catfile( $mb, $os, 'OS.pm' ) => $self->_template( 'os' ),
+ catfile( $mb, $os, 'Device.pm' ) => $self->_template( 'device' ),
+ catfile( $mb, $os, 'Device', 'CPU.pm') => $self->_template( 'cpu' ),
+ catfile( qw( t 01-basic.t ) ) => $self->_template( 't' ),
+ 'Changes' => $self->_template( 'changes' ),
+ 'README' => $self->_template( 'readme' ),
+ );
+ $file{MANIFEST} = $self->_manifest( \%file );
+ return print Dumper( \%file );
+}
+
+sub _write_files {}
+
+sub _manifest {
+ my($self, $file) = @_;
+ my @list = keys %{ $file };
+ return join "\n", map { s{\\}{/}xmsg; $_ } sort @list;
+}
+
+sub _template {
+ my($self, $target) = @_;
+ my $meth = '_template_' . $target;
+ croak "$target is not a valid target" if ! $self->can( $meth );
+ my $id = $self->{os};
+ my $you = $self->{you};
+ my $date = localtime time;
+ my $year = (localtime time)[5] + 1900;
+ my $perlv = $];
+ my $tmp = $self->$meth();
+ $tmp =~ s{<%ID%>}{$id}xmsg;
+ $tmp =~ s{<%DATE%>}{$date}xmsg;
+ $tmp =~ s{<%YEAR%>}{$year}xmsg;
+ $tmp =~ s{<%PERLV%>}{$perlv}xmsg;
+ $tmp =~ s{<%YOU%>}{$you}xmsg;
+ return $tmp;
+}
+
+sub _template_readme {
+ my $self = shift;
+ return <<'TEMPLATE';
+Sys::Info::Driver::<%ID%>
+========================
+
+<%ID%> driver for Sys::Info.
+
+Read the module's POD for documentation.
+See the tests for examples.
+
+INSTALLATION
+
+To install this module type the following:
+
+ perl Makefile.PL
+ make
+ make test
+ make install
+
+or under Windows:
+
+ perl Makefile.PL
+ nmake
+ nmake test
+ nmake install
+
+COPYRIGHT
+
+Copyright (c) <%YEAR%> <%YOU%>. All rights reserved.
+
+LICENSE
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself, either Perl version <%PERLV%> or,
+at your option, any later version of Perl 5 you may have available.
+TEMPLATE
+}
+
+sub _template_changes {
+ my $self = shift;
+ return <<'TEMPLATE';
+Revision history for Perl extension Sys::Info::Driver::<%ID%>.
+
+0.10 <%DATE%>
+ => Initial release.
+
+TEMPLATE
+}
+
+sub _template_device {
+ my $self = shift;
+ return <<'TEMPLATE';
+package Sys::Info::Driver::<%ID%>::Device;
+use strict;
+use warnings;
+use vars qw( $VERSION );
+
+$VERSION = '0.10';
+
+1;
+
+__END__
+
+=head1 NAME
+
+Sys::Info::Driver::<%ID%>::Device - Base class for <%ID%> device drivers
+
+=head1 SYNOPSIS
+
+ use base qw( Sys::Info::Driver::<%ID%>::Device );
+
+=head1 DESCRIPTION
+
+This document describes version C<0.7803> of C<Sys::Info::Helper>
+released on C<10 May 2013>.
+
+Base class for <%ID%> device drivers.
+
+=head1 AUTHOR
+
+Burak Gursoy <burak@cpan.org>.
+
+=head1 COPYRIGHT
+
+Copyright 2006 - 2013 Burak Gursoy. All rights reserved.
+
+=head1 LICENSE
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself, either Perl version 5.16.2 or,
+at your option, any later version of Perl 5 you may have available.
+=cut
+
+TEMPLATE
+}
+
+sub _template_base {
+ my $self = shift;
+ return <<'TEMPLATE';
+package Sys::Info::Driver::<%ID%>;
+use strict;
+use warnings;
+use vars qw( $VERSION );
+
+$VERSION = '0.10';
+
+1;
+
+__END__
+
+=head1 NAME
+
+Sys::Info::Driver::<%ID%> - <%ID%> driver for Sys::Info
+
+=head1 SYNOPSIS
+
+ use Sys::Info::Driver::<%ID%>;
+
+=head1 DESCRIPTION
+
+This is the main module in the C<<%ID%>> driver collection.
+
+=cut
+TEMPLATE
+}
+
+sub _template_cpu {
+ my $self = shift;
+ return <<'TEMPLATE';
+package Sys::Info::Driver::<%ID%>::Device::CPU;
+use strict;
+use warnings;
+use vars qw($VERSION);
+use base qw(Sys::Info::Base);
+
+$VERSION = '0.10';
+
+sub identify { }
+
+sub bitness { }
+
+sub load { }
+
+1;
+
+__END__
+
+=head1 NAME
+
+Sys::Info::Driver::<%ID%>::Device::CPU - <%ID%> CPU Device Driver
+
+=head1 SYNOPSIS
+
+-
+
+=head1 DESCRIPTION
+
+Identifies the CPU.
+
+=head1 METHODS
+
+=head2 identify
+
+See identify in L<Sys::Info::Device::CPU>.
+
+=head2 load
+
+See load in L<Sys::Info::Device::CPU>.
+
+=head2 bitness
+
+See bitness in L<Sys::Info::Device::CPU>.
+
+=head1 SEE ALSO
+
+L<Sys::Info>, L<Sys::Info::Device::CPU>.
+
+=cut
+TEMPLATE
+}
+
+sub _template_t {
+ my $self = shift;
+ return <<'TEMPLATE';
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::Sys::Info;
+
+driver_ok('<%ID%>');
+TEMPLATE
+}
+
+sub _template_os {
+ my $self = shift;
+ return <<'TEMPLATE';
+package Sys::Info::Driver::<%ID%>::OS;
+use strict;
+use warnings;
+use vars qw( $VERSION );
+use base qw( Sys::Info::Base );
+
+$VERSION = '0.10';
+
+sub init {
+ my $self = shift;
+ # initialize here, if necessary
+ return;
+}
+
+sub logon_server {}
+
+sub edition { }
+
+sub tz { }
+
+sub meta { }
+
+sub tick_count { }
+
+sub name { }
+
+sub version { }
+
+sub build { }
+
+sub uptime { }
+
+sub is_root { }
+
+sub login_name { }
+
+sub node_name { }
+
+sub domain_name { }
+
+sub fs { }
+
+sub bitness { }
+
+1;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Sys::Info::Driver::<%ID%>::OS - <%ID%> backend
+
+=head1 SYNOPSIS
+
+-
+
+=head1 DESCRIPTION
+
+-
+
+=head1 METHODS
+
+Please see L<Sys::Info::OS> for definitions of these methods and more.
+
+=head2 build
+
+=head2 domain_name
+
+=head2 edition
+
+=head2 fs
+
+=head2 is_root
+
+=head2 login_name
+
+=head2 logon_server
+
+=head2 meta
+
+=head2 name
+
+=head2 node_name
+
+=head2 tick_count
+
+=head2 tz
+
+=head2 uptime
+
+=head2 version
+
+=head2 bitness
+
+=head1 SEE ALSO
+
+L<Sys::Info>, L<Sys::Info::OS>.
+=cut
+
+TEMPLATE
+}
+
+1;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Sys::Info::Helper - Helps to create new Sys::Info drivers.
+
+=head1 SYNOPSIS
+
+=head1 DESCRIPTION
+
+=head1 METHODS
+
+=head2 new
+
+=head1 FUNCTIONS
+
+=head2 new_driver
+
+=head1 SEE ALSO
+
+L<Sys::Info>.
+
+=cut
@@ -25,7 +25,7 @@ BEGIN {
*LC_CTYPE = sub () {} if $@ || ! $eok;
}
-$VERSION = '0.7802';
+$VERSION = '0.7803';
BEGIN {
CREATE_SYNONYMS_AND_UTILITY_METHODS: {
@@ -160,8 +160,8 @@ Example:
=head1 DESCRIPTION
-This document describes version C<0.7802> of C<Sys::Info::OS>
-released on C<31 July 2011>.
+This document describes version C<0.7803> of C<Sys::Info::OS>
+released on C<10 May 2013>.
Supplies detailed operating system information.
@@ -388,14 +388,13 @@ Burak Gursoy <burak@cpan.org>.
=head1 COPYRIGHT
-Copyright 2006 - 2011 Burak Gursoy. All rights reserved.
+Copyright 2006 - 2013 Burak Gursoy. All rights reserved.
=head1 LICENSE
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself, either Perl version 5.12.3 or,
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself, either Perl version 5.16.2 or,
at your option, any later version of Perl 5 you may have available.
-
=cut
use Socket;
@@ -1,43 +0,0 @@
-#!/usr/bin/env perl -w
-use strict;
-use warnings;
-use Test::More;
-use constant NEW_PERL => 5.008;
-use constant MIN_TPV => 1.26;
-use constant MIN_PSV => 3.05;
-
-my(@errors, $eok);
-$eok = eval { require Test::Pod; 1; };
-push @errors, 'Test::Pod is required for testing POD' if $@ || ! $eok;
-$eok = eval { require Pod::Simple; 1; };
-push @errors, 'Pod::Simple is required for testing POD' if $@ || ! $eok;
-
-if ( not @errors ) {
- my $tpv = Test::Pod->VERSION;
- my $psv = Pod::Simple->VERSION;
-
- if ( $tpv < MIN_TPV ) {
- push @errors, 'Upgrade Test::Pod to 1.26 to run this test. '
- ."Detected version is: $tpv";
- }
-
- if ( $psv < MIN_PSV ) {
- push @errors, 'Upgrade Pod::Simple to 3.05 to run this test. '
- ."Detected version is: $psv";
- }
-}
-
-if ( $] < NEW_PERL ) {
- # Any older perl does not have Encode.pm. Thus, Pod::Simple
- # can not handle utf8 encoding and it will die, the tests
- # will fail. This skip part, skips an inevitable failure.
- push @errors, '"=encoding utf8" directives in Pods don\'t work '
- .'with legacy perl.';
-}
-
-if ( @errors ) {
- plan skip_all => "Errors detected: @errors";
-}
-else {
- Test::Pod::all_pod_files_ok();
-}
@@ -1,20 +0,0 @@
-#!/usr/bin/env perl -w
-use strict;
-use warnings;
-use Test::More;
-
-# build tool runs the whole test suite on the monolithic version.
-# Don't bother testing it if exists
-plan skip_all => 'Skipping for monolith build test' if $ENV{AUTHOR_TESTING_MONOLITH_BUILD};
-
-my $eok = eval 'use Test::Pod::Coverage;1;';
-my $e = $@ || ! $eok;
-
-eval {
- $e ? plan( skip_all => 'Test::Pod::Coverage required for testing pod coverage' )
- : all_pod_coverage_ok();
- 1;
-} or do {
- diag( "Some error happened in somewhere, which I don't care: $@" );
- ok( 1, 'Fake test' );
-}
@@ -0,0 +1,42 @@
+#!/usr/bin/env perl -w
+use strict;
+use warnings;
+
+use constant NEW_PERL => 5.008;
+use constant MIN_TPV => 1.26;
+use constant MIN_PSV => 3.05;
+
+use Test::More;
+
+my @errors;
+
+eval {
+ require Test::Pod;
+ require Pod::Simple;
+
+ my $tpv = Test::Pod->VERSION;
+ my $psv = Pod::Simple->VERSION;
+
+ if ( $tpv < MIN_TPV ) {
+ push @errors, "Test::Pod >= 1.26 (you have $tpv) is needed for this test.";
+ }
+
+ if ( $psv < MIN_PSV ) {
+ push @errors, "Pod::Simple >= 3.05 (you have $psv) is needed for this test.";
+ }
+
+ 1;
+} or do {
+ push @errors, 'Test::Pod & Pod::Simple are required for testing POD';
+};
+
+if ( $] < NEW_PERL ) {
+ # Legacy perl does not have Encode.pm. Thus, Pod::Simple
+ # can not handle utf8 encoding and it will die, the tests
+ # will fail.
+ push @errors, q{"=encoding utf8" directives in Pods don't work with legacy perl.};
+}
+
+@errors ? plan( skip_all => "Errors detected: @errors" )
+ : Test::Pod::all_pod_files_ok()
+ ;
@@ -0,0 +1,27 @@
+#!/usr/bin/env perl -w
+use strict;
+use warnings;
+use Test::More;
+
+# build tool runs the whole test suite on the monolithic version.
+# Don't bother testing it if exists
+if ( $ENV{AUTHOR_TESTING_MONOLITH_BUILD} ) {
+ plan( skip_all => 'Skipping for monolith build test' );
+}
+
+eval {
+ require Test::Pod::Coverage;
+ 1;
+} or do {
+ diag("Error loading Test::Pod::Coverage: $@");
+ plan( skip_all => 'Test::Pod::Coverage required for testing pod coverage' );
+ exit;
+};
+
+eval {
+ Test::Pod::Coverage::all_pod_coverage_ok();
+ 1;
+} or do {
+ diag( "Some error happened in somewhere, which I don't care: $@" );
+ ok( 1, 'Fake test' );
+};