Skip to content

Commit

Permalink
Import of EGILES/Test-Compile-0.17_02 from CPAN.
Browse files Browse the repository at this point in the history
gitpan-cpan-distribution: Test-Compile
gitpan-cpan-version:      0.17_02
gitpan-cpan-path:         EGILES/Test-Compile-0.17_02.tar.gz
gitpan-cpan-author:       EGILES
gitpan-cpan-maturity:     developer
  • Loading branch information
egiles authored and Gitpan committed Oct 26, 2014
1 parent 645f5eb commit 0a25cbe
Show file tree
Hide file tree
Showing 9 changed files with 100 additions and 62 deletions.
11 changes: 2 additions & 9 deletions Build.PL
Expand Up @@ -5,19 +5,12 @@ use warnings;

use Module::Build;

my $repo = "github.com/egiles/test-compile";
my $meta1 = "http://$repo";
my $meta2 = {
type => "git",
web => $meta1,
url => "git://$repo.git",
};

my $build = Module::Build->new (
module_name => 'Test::Compile',
abstract_from => 'lib/Test/Compile.pm',
dist_author => 'Evan Giles <egiles@cpan.org>',
license => 'perl',
configure_requires => { 'Module::Build' => 0.38 },
requires => {
'perl' => '5.6.0',
'UNIVERSAL::require' => 0,
Expand All @@ -28,7 +21,7 @@ my $build = Module::Build->new (
create_makefile_pl => 'traditional',
meta_merge => {
resources => {
repository => Module::Build->can("metafile2") ? $meta2 : $meta1,
repository => "http://github.com/egiles/test-compile",
}
},
add_to_cleanup => [ 'Makefile.PL', 'META.yml' ],
Expand Down
6 changes: 1 addition & 5 deletions Changes
@@ -1,16 +1,12 @@
Revision history for Perl extension Test-Compile


0.17_01 DEV RELEASE (Evan Giles <egiles@cpan.org>)
- Add some temporary debug

0.17 2012.02.25 (Evan Giles <egiles@cpan.org>)
- Another few tests for taint logic

0.16_1 2012.02.23 (Evan Giles <egiles@cpan.org>)
- Reapply patches from Nicholas Bamber (rt55837 & rt72557)

0.16 2012.02.21 (Evan Giles <egiles@cpan.org>)
0.16 2012.02.21 (Evan Giles <egiles@cpan.org>)
- Skip tests if there are not files to test (rt69297)
- Handle taint mode correctly (rt55837)
- Add 'blib/lib' to the search path for scripts (rt72557)
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST
Expand Up @@ -10,6 +10,7 @@ t/03-pl-file-ok.t
t/04-pl-file-ok-vms.t
t/10-find-files.t
t/10-taint.t
t/11.lib.t
t/20-internal-check-syntax.t
t/25-internal-is-in-taint-mode.t
t/30-suppress-stderr.t
Expand All @@ -31,3 +32,4 @@ xt/author/08_synopsis.t
xt/author/10_has_version.t
xt/author/99-version.t
xt/author/perlcriticrc
META.json
48 changes: 48 additions & 0 deletions META.json
@@ -0,0 +1,48 @@
{
"abstract" : "Check whether Perl module files compile correctly",
"author" : [
"Evan Giles <egiles@cpan.org>"
],
"dynamic_config" : 1,
"generated_by" : "Module::Build version 0.38, CPAN::Meta::Converter version 2.110440",
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : "2"
},
"name" : "Test-Compile",
"prereqs" : {
"configure" : {
"requires" : {
"Module::Build" : "0.38"
}
},
"runtime" : {
"recommends" : {
"Devel::CheckOS" : 0
},
"requires" : {
"UNIVERSAL::require" : 0,
"perl" : "v5.6.0"
}
}
},
"provides" : {
"Test::Compile" : {
"file" : "lib/Test/Compile.pm",
"version" : "0.17_02"
}
},
"release_status" : "testing",
"resources" : {
"license" : [
"http://dev.perl.org/licenses/"
],
"repository" : {
"url" : "http://github.com/egiles/test-compile"
}
},
"version" : "0.17_02"
}
38 changes: 20 additions & 18 deletions META.yml
@@ -1,25 +1,27 @@
---
name: Test-Compile
version: 0.17_01
abstract: 'Check whether Perl module files compile correctly'
author:
- 'Evan Giles <egiles@cpan.org>'
abstract: Check whether Perl module files compile correctly
license: perl
resources:
license: http://dev.perl.org/licenses/
repository: http://github.com/egiles/test-compile
requires:
UNIVERSAL::require: 0
perl: v5.6.0
recommends:
Devel::CheckOS: 0
build_requires: {}
configure_requires:
Module::Build: 0.340201
provides:
Test::Compile:
file: lib/Test/Compile.pm
version: 0.17_01
generated_by: Module::Build version 0.340201
Module::Build: 0.38
dynamic_config: 1
generated_by: 'Module::Build version 0.38, CPAN::Meta::Converter version 2.110440'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
name: Test-Compile
provides:
Test::Compile:
file: lib/Test/Compile.pm
version: 0.17_02
recommends:
Devel::CheckOS: 0
requires:
UNIVERSAL::require: 0
perl: v5.6.0
resources:
license: http://dev.perl.org/licenses/
repository: http://github.com/egiles/test-compile
version: 0.17_02
22 changes: 11 additions & 11 deletions Makefile.PL
@@ -1,15 +1,15 @@
# Note: this file was auto-generated by Module::Build::Compat version 0.340201
require 5.6.0;
# Note: this file was auto-generated by Module::Build::Compat version 0.3800
require 5.006000;
use ExtUtils::MakeMaker;
WriteMakefile
(
'NAME' => 'Test::Compile',
'VERSION_FROM' => 'lib/Test/Compile.pm',
'PREREQ_PM' => {
'UNIVERSAL::require' => 0
},
'INSTALLDIRS' => 'site',
'EXE_FILES' => [],
'PL_FILES' => {}
)
'NAME' => 'Test::Compile',
'VERSION_FROM' => 'lib/Test/Compile.pm',
'PREREQ_PM' => {
'UNIVERSAL::require' => 0
},
'INSTALLDIRS' => 'site',
'EXE_FILES' => [],
'PL_FILES' => {}
)
;
26 changes: 8 additions & 18 deletions lib/Test/Compile.pm
Expand Up @@ -8,16 +8,9 @@ use Test::Builder;
use File::Spec;
use UNIVERSAL::require;

our $VERSION = '0.17_01';
our $VERSION = '0.17_02';
my $Test = Test::Builder->new;

BEGIN {
my $f = __FILE__;
my $p = __PACKAGE__;
my $v = "0.17_01";
print STDERR "\nCompiling $p ($v) from $f\n";
}

sub import {
my $self = shift;
my $caller = caller;
Expand Down Expand Up @@ -48,7 +41,6 @@ sub pm_file_ok {
sub pl_file_ok {
my $file = shift;
my $name = @_ ? shift : "Compile test for $file";
my $verbose = shift;

# don't "use Devel::CheckOS" because Test::Compile is included by
# Module::Install::StandardTests, and we don't want to have to ship
Expand All @@ -64,7 +56,7 @@ sub pl_file_ok {
}
}

my $ok = _run_in_subprocess(sub{_check_syntax($file,0)},$verbose);
my $ok = _run_in_subprocess(sub{_check_syntax($file,0)});

$Test->ok($ok, $name);
$Test->diag("$file does not compile") unless $ok;
Expand Down Expand Up @@ -118,7 +110,7 @@ sub all_pl_files {
}

sub _run_in_subprocess {
my ($closure,$verbose) = @_;
my ($closure) = @_;

my $pid = fork();
if ( ! defined($pid) ) {
Expand All @@ -127,9 +119,7 @@ sub _run_in_subprocess {
wait();
return ($? ? 0 : 1);
} else {
if ( !$verbose ) {
close(STDERR);
}
close(STDERR);
my $rv = $closure->();
exit ($rv ? 0 : 1);
}
Expand Down Expand Up @@ -192,14 +182,14 @@ sub _pl_starting_points {
}

sub _is_in_taint_mode {
my ($file) = @_;

open(my $f, "<", $file) or die "could not open $file";
my $shebang = <$f>;
my $file = shift;
open(FILE, $file) or die "could not open $file";
my $shebang = <FILE>;
my $taint = "";
if ($shebang =~ /^#![\/\w]+\s+\-w?([tT])/) {
$taint = $1;
}
close FILE;
return $taint;
}

Expand Down
7 changes: 7 additions & 0 deletions t/11.lib.t
@@ -0,0 +1,7 @@
#!perl -w
use strict;
use warnings;
use Test::More tests => 1;
use Test::Compile;
pl_file_ok('t/scripts/lib.pl', 'lib.pl compiles');

2 changes: 1 addition & 1 deletion t/40-lib.t
Expand Up @@ -8,5 +8,5 @@ use Test::Compile;
use Test::More ;
plan skip_all => "Distribution hasn't been built yet" unless -d "blib/lib";

pl_file_ok('t/scripts/lib.pl', 'lib.pl compiles', "verbose");
pl_file_ok('t/scripts/lib.pl', 'lib.pl compiles');
done_testing();

0 comments on commit 0a25cbe

Please sign in to comment.