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