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