File Coverage

blib/lib/Module/Install/With.pm
Criterion Covered Total %
statement 12 20 60.0
branch n/a
condition 0 6 0.0
subroutine 4 12 33.3
pod 5 8 62.5
total 21 46 45.6


line stmt bran cond sub pod time code
1             package Module::Install::With;
2              
3             # See POD at end for docs
4              
5 1     1   1515 use strict;
  1         3  
  1         30  
6 1     1   6 use Module::Install::Base ();
  1         5  
  1         20  
7              
8 1     1   5 use vars qw{$VERSION @ISA $ISCORE};
  1         1  
  1         79  
9             BEGIN {
10 1     1   4 $VERSION = '1.21';
11 1         16 @ISA = 'Module::Install::Base';
12 1         305 $ISCORE = 1;
13             }
14              
15             =pod
16              
17             =head1 NAME
18              
19             Module::Install::With - find environnement for Module::Install
20              
21             =cut
22              
23             #####################################################################
24             # Installer Target
25              
26             # Are we targeting ExtUtils::MakeMaker (running as Makefile.PL)
27             sub eumm {
28 0     0 0   !! ($0 =~ /Makefile.PL$/i);
29             }
30              
31             # You should not be using this, but we'll keep the hook anyways
32             sub mb {
33 0     0 0   !! ($0 =~ /Build.PL$/i);
34             }
35              
36              
37              
38              
39              
40             #####################################################################
41             # Testing and Configuration Contexts
42              
43             =pod
44              
45             =head2 interactive
46              
47             The C<interactive> function tests for an install that has a user present
48             (or at least, one in which it is reasonable for us to present prompts
49             and other similar types of things).
50              
51             Returns true if in an interactive environment, or false otherwise.
52              
53             =cut
54              
55             sub interactive {
56             # Treat things interactively ONLY based on input
57 0   0 0 1   !! (-t STDIN and ! automated_testing());
58             }
59              
60             =pod
61              
62             =head2 automated_testing
63              
64             Are we currently running in an automated testing environment, such as
65             CPAN Testers.
66              
67             This is primarily a cleaner and more human-readable equivalent of
68             checking $ENV{AUTOMATED_TESTING} yourself, but may be improved in line
69             with best practices at a later date.
70              
71             =cut
72              
73             sub automated_testing {
74 0     0 1   !! $ENV{AUTOMATED_TESTING};
75             }
76              
77             =pod
78              
79             =head2 release_testing
80              
81             Are we currently running in an release testing environment. That is,
82             are we in the process of running in a potential highly-intensive and
83             high dependency bloat testing process prior to packaging a module for
84             release.
85              
86             This is primarily a cleaner and more human-readable equivalent of
87             checking $ENV{RELEASE_TESTING} yourself, but may be improved in line
88             with best practices at a later date.
89              
90             =cut
91              
92             sub release_testing {
93 0     0 1   !! $ENV{RELEASE_TESTING};
94             }
95              
96             sub author_context {
97 0     0 0   !! $Module::Install::AUTHOR;
98             }
99              
100              
101              
102              
103              
104             #####################################################################
105             # Operating System Convenience
106              
107             =pod
108              
109             =head2 win32
110              
111             The C<win32> function tests if the Makefile.PL is currently running in a
112             native Microsoft Windows Perl, such as ActivePerl or Strawberry Perl.
113              
114             This is primarily a cleaner and more human-readable equivalent of
115             checking C<$^O eq 'MSWin32'> yourself, but may be improved in line
116             with best practices at a later date.
117              
118             =cut
119              
120             sub win32 {
121 0     0 1   !! ($^O eq 'MSWin32');
122             }
123              
124             =pod
125              
126             =head2 winlike
127              
128             The C<winlike> function tests if the Makefile.PL is currently running
129             in a Microsoft Windows Perl, under either cygwin or a native Win32 Perl.
130              
131             This is primarily a cleaner and more human-readable equivalent of
132             checking C<$^O eq 'MSWin32' or $^O eq 'cygwin'>yourself, but may be
133             improved in line with best practices at a later date.
134              
135             =cut
136              
137             sub winlike {
138 0   0 0 1   !! ($^O eq 'MSWin32' or $^O eq 'cygwin');
139             }
140              
141             1;
142              
143             =pod
144              
145             =head1 SEE ALSO
146              
147             L<Module::Install>
148              
149             =head1 AUTHORS
150              
151             Adam Kennedy E<lt>adamk@cpan.orgE<gt>
152              
153             =head1 COPYRIGHT
154              
155             Copyright 2007 - 2012 Adam Kennedy.
156              
157             This program is free software; you can redistribute
158             it and/or modify it under the same terms as Perl itself.
159              
160             The full text of the license can be found in the
161             LICENSE file included with this module.
162              
163             =cut