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