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