use strict;
use vars qw($VERSION @ISA);
-$VERSION = 0.04;
+$VERSION = 0.05;
@ISA = qw(File::Spec);
use Config;
These are methods which are by their nature cross-platform and should
always be cross-platform.
+=over 4
+
+=item os_flavor_is
+
+ $mm->os_flavor_is($this_flavor);
+ $mm->os_flavor_is(@one_of_these_flavors);
+
+Checks to see if the current operating system is one of the given flavors.
+
+This is useful for code like:
+
+ if( $mm->os_flavor_is('Unix') ) {
+ $out = `foo 2>&1`;
+ }
+ else {
+ $out = `foo`;
+ }
+
+=cut
+
+sub os_flavor_is {
+ my $self = shift;
+ my %flavors = map { ($_ => 1) } $self->os_flavor;
+ return (grep { $flavors{$_} } @_) ? 1 : 0;
+}
+
+=back
+
=head2 File::Spec wrappers
ExtUtils::MM_Any is a subclass of File::Spec. The methods noted here
sub init_VERSION {
my($self) = shift;
- $self->{MAKEMAKER} = $INC{'ExtUtils/MakeMaker.pm'};
+ $self->{MAKEMAKER} = $ExtUtils::MakeMaker::Filename;
$self->{MM_VERSION} = $ExtUtils::MakeMaker::VERSION;
$self->{MM_REVISION}= $ExtUtils::MakeMaker::Revision;
$self->{VERSION_FROM} ||= '';
CMD
}
+ $manify .= "\t\$(NOECHO) \$(NOOP)\n" unless @man_cmds;
$manify .= join '', map { "$_\n" } @man_cmds;
return $manify;
sub metafile_target {
my $self = shift;
+ return <<'MAKE_FRAG' if $self->{NO_META};
+metafile:
+ $(NOECHO) $(NOOP)
+MAKE_FRAG
+
my $prereq_pm = '';
while( my($mod, $ver) = each %{$self->{PREREQ_PM}} ) {
$prereq_pm .= sprintf " %-30s %s\n", "$mod:", $ver;
sub metafile_addtomanifest_target {
my $self = shift;
+ return <<'MAKE_FRAG' if $self->{NO_META};
+metafile_addtomanifest:
+ $(NOECHO) $(NOOP)
+MAKE_FRAG
+
my $add_meta = $self->oneliner(<<'CODE', ['-MExtUtils::Manifest=maniadd']);
-maniadd({q{META.yml} => q{Module meta-data in YAML}});
+maniadd({q{META.yml} => q{Module meta-data (added by MakeMaker)}});
CODE
return sprintf <<'MAKE_FRAG', $add_meta;
Macro Description
- NOOP
- NOECHO
+ NOOP Do nothing
+ NOECHO Tell make not to display the command itself
MAKEFILE
FIRST_MAKEFILE
SHELL Program used to run
shell commands
+ ECHO Print text adding a newline on the end
RM_F Remove a file
RM_RF Remove a directory
TOUCH Update a file's timestamp
return '';
}
+=item os_flavor
+
+ my @os_flavor = $mm->os_flavor;
+
+@os_flavor is the style of operating system this is, usually
+corresponding to the MM_*.pm file we're using.
+
+The first element of @os_flavor is the major family (ie. Unix,
+Windows, VMS, OS/2, MacOS, etc...) and the rest are sub families.
+
+Some examples:
+
+ Cygwin98 ('Unix', 'Cygwin', 'Cygwin9x')
+ Windows NT ('Win32', 'WinNT')
+ Win98 ('Win32', 'Win9x')
+ Linux ('Unix', 'Linux')
+ MacOS Classic ('MacOS', 'MacOS Classic')
+ MacOS X ('Unix', 'Darwin', 'MacOS', 'MacOS X')
+ OS/2 ('OS/2')
+
+This is used to write code for styles of operating system.
+See os_flavor_is() for use.
+
=back