File Coverage

blib/lib/Test/Prereq/Build.pm
Criterion Covered Total %
statement 38 43 88.3
branch 0 2 0.0
condition n/a
subroutine 11 15 73.3
pod 5 6 83.3
total 54 66 81.8


line stmt bran cond sub pod time code
1             package Test::Prereq::Build;
2 3     3   3016 use strict;
  3         3  
  3         89  
3              
4 3     3   12 use parent qw(Test::Prereq);
  3         3  
  3         23  
5 3     3   245 use vars qw($VERSION @EXPORT);
  3         4  
  3         134  
6              
7 3     3   10 use warnings;
  3         9  
  3         65  
8 3     3   8 no warnings;
  3         3  
  3         105  
9              
10             =encoding utf8
11              
12             =head1 NAME
13              
14             Test::Prereq::Build - test prerequisites in Module::Build scripts
15              
16             =head1 SYNOPSIS
17              
18             use Test::Prereq::Build;
19             prereq_ok();
20              
21             =cut
22              
23             $VERSION = '2.001_002';
24              
25 3     3   1409 use Module::Build;
  3         154498  
  3         162  
26              
27             my $Test = __PACKAGE__->builder;
28              
29             =head1 METHODS
30              
31             If you have problems, send me your F.
32              
33             This module overrides methods in C to make it work with
34             C.
35              
36             This module does not have any public methods. See L.
37              
38             To make everything work out with C, this module overrides
39             some methods to do nothing.
40              
41             =over 4
42              
43             =item create_build_script
44              
45             =item add_build_element
46              
47             =item args
48              
49             =item notes
50              
51             =back
52              
53             =head1 AUTHOR
54              
55             brian d foy, C<< >>
56              
57             =head1 COPYRIGHT AND LICENSE
58              
59             Copyright © 2002-2015, brian d foy . All rights reserved.
60              
61             This program is free software; you can redistribute it and/or modify
62             it under the same terms as Perl itself.
63              
64             =cut
65              
66              
67             sub import
68             {
69 2     2   11 my $self = shift;
70 2         5 my $caller = caller;
71 3     3   18 no strict 'refs';
  3         4  
  3         594  
72 2         2 *{$caller.'::prereq_ok'} = \&prereq_ok;
  2         10  
73              
74 2         10 $Test->exported_to($caller);
75 2         18 $Test->plan(@_);
76             }
77              
78             sub prereq_ok
79             {
80 0 0   0 1 0 $Test->plan( tests => 1 ) unless $Test->has_plan;
81 0         0 __PACKAGE__->_prereq_check( @_ );
82             }
83              
84 1     1   4 sub _master_file { 'Build.PL' }
85              
86             # override Module::Build
87             sub Module::Build::new {
88 1     1 0 3 my $class = shift;
89              
90 1         14 my %hash = @_;
91              
92             my @requires = sort grep $_ ne 'perl', (
93 1         5 keys %{ $hash{requires} },
94 1         2 keys %{ $hash{build_requires} },
95 1         4 keys %{ $hash{configure_requires} },
96 1         1 keys %{ $hash{recommends} },
  1         11  
97             );
98              
99 1         4 @Test::Prereq::prereqs = @requires;
100              
101             # intercept further calls to this object
102 1         7 return bless {}, __PACKAGE__;
103             }
104              
105             # fake Module::Build methods
106 1     1 1 29 sub create_build_script { 1 };
107 0     0 1   sub add_build_element { 1 };
108 0     0 1   sub args { 1 };
109 0     0 1   sub notes { 1 };
110              
111             1;