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