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