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