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