MakeMaker core sync 5.54_01 -> 5.55_02
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / MM_Any.pm
1 package ExtUtils::MM_Any;
2
3 use strict;
4 use vars qw($VERSION @ISA);
5 $VERSION = 0.04;
6
7 use Config;
8 use File::Spec;
9
10
11 =head1 NAME
12
13 ExtUtils::MM_Any - Platform agnostic MM methods
14
15 =head1 SYNOPSIS
16
17   FOR INTERNAL USE ONLY!
18
19   package ExtUtils::MM_SomeOS;
20
21   # Temporarily, you have to subclass both.  Put MM_Any first.
22   require ExtUtils::MM_Any;
23   require ExtUtils::MM_Unix;
24   @ISA = qw(ExtUtils::MM_Any ExtUtils::Unix);
25
26 =head1 DESCRIPTION
27
28 B<FOR INTERNAL USE ONLY!>
29
30 ExtUtils::MM_Any is a superclass for the ExtUtils::MM_* set of
31 modules.  It contains methods which are either inherently
32 cross-platform or are written in a cross-platform manner.
33
34 Subclass off of ExtUtils::MM_Any I<and> ExtUtils::MM_Unix.  This is a
35 temporary solution.
36
37 B<THIS MAY BE TEMPORARY!>
38
39 =head1 Inherently Cross-Platform Methods
40
41 These are methods which are by their nature cross-platform and should
42 always be cross-platform.
43
44 =head2 File::Spec wrappers  B<DEPRECATED>
45
46 The following methods are deprecated wrappers around File::Spec
47 functions.  They exist from before File::Spec did and in fact are from
48 which File::Spec sprang.
49
50 They are all deprecated.  Please use File::Spec directly.
51
52 =over 4
53
54 =item canonpath
55
56 =cut
57
58 sub canonpath {
59     shift;
60     return File::Spec->canonpath(@_);;
61 }
62
63 =item catdir
64
65 =cut
66
67 sub catdir {
68     shift;
69     return File::Spec->catdir(@_);
70 }
71
72 =item catfile
73
74 =cut
75
76 sub catfile {
77     shift;
78     return File::Spec->catfile(@_);
79 }
80
81 =item curdir
82
83 =cut
84
85 my $Curdir = File::Spec->curdir;
86 sub curdir {
87     return $Curdir;
88 }
89
90 =item file_name_is_absolute
91
92 =cut
93
94 sub file_name_is_absolute {
95     shift;
96     return File::Spec->file_name_is_absolute(@_);
97 }
98
99 =item path
100
101 =cut
102
103 sub path {
104     return File::Spec->path();
105 }
106
107 =item rootdir
108
109 =cut
110
111 my $Rootdir = File::Spec->rootdir;
112 sub rootdir {
113     return $Rootdir;
114 }
115
116 =item updir
117
118 =cut
119
120 my $Updir = File::Spec->updir;
121 sub updir {
122     return $Updir;
123 }
124
125 =back
126
127 =head1 Thought To Be Cross-Platform Methods
128
129 These are methods which are thought to be cross-platform by virtue of
130 having been written in a way to avoid incompatibilities.
131
132 =over 4
133
134 =item test_via_harness
135
136   my $command = $mm->test_via_harness($perl, $tests);
137
138 Returns a $command line which runs the given set of $tests with
139 Test::Harness and the given $perl.
140
141 Used on the t/*.t files.
142
143 =cut
144
145 sub test_via_harness {
146     my($self, $perl, $tests) = @_;
147
148     return qq{\t$perl "-MExtUtils::Command::MM" }.
149            qq{"-e" "test_harness(\$(TEST_VERBOSE), '\$(INST_LIB)', '\$(INST_ARCHLIB)')" $tests\n};
150 }
151
152 =item test_via_script
153
154   my $command = $mm->test_via_script($perl, $script);
155
156 Returns a $command line which just runs a single test without
157 Test::Harness.  No checks are done on the results, they're just
158 printed.
159
160 Used for test.pl, since they don't always follow Test::Harness
161 formatting.
162
163 =cut
164
165 sub test_via_script {
166     my($self, $perl, $script) = @_;
167     return qq{\t$perl "-I\$(INST_LIB)" "-I\$(INST_ARCHLIB)" $script\n};
168 }
169
170 =back
171
172 =head1 AUTHOR
173
174 Michael G Schwern <schwern@pobox.com> with code from ExtUtils::MM_Unix
175 and ExtUtils::MM_Win32.
176
177
178 =cut
179
180 1;