20dfcf
From e6cefdf6744b6068273a7f24956bb20fe82d4007 Mon Sep 17 00:00:00 2001
20dfcf
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
20dfcf
Date: Mon, 18 Apr 2016 14:46:20 +0200
20dfcf
Subject: [PATCH] Provide ExtUtils::MM methods as standalone
20dfcf
 ExtUtils::MM::Utils
20dfcf
MIME-Version: 1.0
20dfcf
Content-Type: text/plain; charset=UTF-8
20dfcf
Content-Transfer-Encoding: 8bit
20dfcf
20dfcf
If you cannot afford depending on ExtUtils::MakeMaker, you can
20dfcf
depend on ExtUtils::MM::Utils instead.
20dfcf
20dfcf
<https://bugzilla.redhat.com/show_bug.cgi?id=1129443>
20dfcf
20dfcf
Signed-off-by: Petr Písař <ppisar@redhat.com>
20dfcf
---
20dfcf
 MANIFEST                 |  1 +
20dfcf
 lib/ExtUtils/MM/Utils.pm | 68 ++++++++++++++++++++++++++++++++++++++++++++++++
20dfcf
 2 files changed, 69 insertions(+)
20dfcf
 create mode 100644 lib/ExtUtils/MM/Utils.pm
20dfcf
20dfcf
diff --git a/MANIFEST b/MANIFEST
20dfcf
index 452c152..6d05775 100644
20dfcf
--- a/MANIFEST
20dfcf
+++ b/MANIFEST
20dfcf
@@ -41,6 +41,7 @@ lib/ExtUtils/MakeMaker/version/vpp.pm
20dfcf
 lib/ExtUtils/Mkbootstrap.pm
20dfcf
 lib/ExtUtils/Mksymlists.pm
20dfcf
 lib/ExtUtils/MM.pm
20dfcf
+lib/ExtUtils/MM/Utils.pm
20dfcf
 lib/ExtUtils/MM_AIX.pm
20dfcf
 lib/ExtUtils/MM_Any.pm
20dfcf
 lib/ExtUtils/MM_BeOS.pm
20dfcf
diff --git a/lib/ExtUtils/MM/Utils.pm b/lib/ExtUtils/MM/Utils.pm
20dfcf
new file mode 100644
20dfcf
index 0000000..6bbc0d8
20dfcf
--- /dev/null
20dfcf
+++ b/lib/ExtUtils/MM/Utils.pm
20dfcf
@@ -0,0 +1,68 @@
20dfcf
+package ExtUtils::MM::Utils;
20dfcf
+
20dfcf
+require 5.006;
20dfcf
+
20dfcf
+use strict;
20dfcf
+use vars qw($VERSION);
20dfcf
+$VERSION = '7.11_06';
20dfcf
+$VERSION = eval $VERSION;  ## no critic [BuiltinFunctions::ProhibitStringyEval]
20dfcf
+
20dfcf
+=head1 NAME
20dfcf
+
20dfcf
+ExtUtils::MM::Utils - ExtUtils::MM methods without dependency on ExtUtils::MakeMaker
20dfcf
+
20dfcf
+=head1 SYNOPSIS
20dfcf
+
20dfcf
+    require ExtUtils::MM::Utils;
20dfcf
+    MM->maybe_command($file);
20dfcf
+
20dfcf
+=head1 DESCRIPTION
20dfcf
+
20dfcf
+This is a collection of L<ExtUtils::MM> subroutines that are used by many
20dfcf
+other modules but that do not need full-featured L<ExtUtils::MakeMaker>. The
20dfcf
+issue with L<ExtUtils::MakeMaker> is it pulls in Perl header files and that is
20dfcf
+an overkill for small subroutines.
20dfcf
+
20dfcf
+An example is the L<IPC::Cmd> that caused installing GCC just because of
20dfcf
+three-line I<maybe_command()> from L<ExtUtils::MM_Unix>.
20dfcf
+
20dfcf
+The intentions is to use L<ExtUtils::MM::Utils> instead of
20dfcf
+L<ExtUtils::MakeMaker> for these trivial methods. You can still call them via
20dfcf
+L<MM> class name.
20dfcf
+
20dfcf
+=head1 METHODS
20dfcf
+
20dfcf
+=over 4
20dfcf
+
20dfcf
+=item maybe_command
20dfcf
+
20dfcf
+Returns true, if the argument is likely to be a command.
20dfcf
+
20dfcf
+=cut
20dfcf
+
20dfcf
+if (!exists $INC{'ExtUtils/MM.pm'}) {
20dfcf
+    *MM::maybe_command = *ExtUtils::MM::maybe_command = \&maybe_command;
20dfcf
+}
20dfcf
+
20dfcf
+sub maybe_command {
20dfcf
+    my($self,$file) = @_;
20dfcf
+    return $file if -x $file && ! -d $file;
20dfcf
+    return;
20dfcf
+}
20dfcf
+
20dfcf
+1;
20dfcf
+
20dfcf
+=back
20dfcf
+
20dfcf
+=head1 BUGS
20dfcf
+
20dfcf
+These methods are copied from L<ExtUtils::MM_Unix>. Other operating systems
20dfcf
+are not supported yet. The reason is this
20dfcf
+L
20dfcf
+distributions|https://bugzilla.redhat.com/show_bug.cgi?id=1129443>.
20dfcf
+
20dfcf
+=head1 SEE ALSO
20dfcf
+
20dfcf
+L<ExtUtils::MakeMaker>, L<ExtUtils::MM>
20dfcf
+
20dfcf
+=cut
20dfcf
-- 
20dfcf
2.5.5
20dfcf