{
    "mode": "perldoc",
    "parameter": "ExtUtils::MM_Any",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/ExtUtils%3A%3AMM_Any/json",
    "generated": "2026-06-10T20:51:26Z",
    "synopsis": "FOR INTERNAL USE ONLY!\npackage ExtUtils::MMSomeOS;\n# Temporarily, you have to subclass both.  Put MMAny first.\nrequire ExtUtils::MMAny;\nrequire ExtUtils::MMUnix;\n@ISA = qw(ExtUtils::MMAny ExtUtils::Unix);",
    "sections": {
        "NAME": {
            "content": "ExtUtils::MMAny - Platform-agnostic MM methods\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "FOR INTERNAL USE ONLY!\n\npackage ExtUtils::MMSomeOS;\n\n# Temporarily, you have to subclass both.  Put MMAny first.\nrequire ExtUtils::MMAny;\nrequire ExtUtils::MMUnix;\n@ISA = qw(ExtUtils::MMAny ExtUtils::Unix);\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "FOR INTERNAL USE ONLY!\n\nExtUtils::MMAny is a superclass for the ExtUtils::MM* set of modules. It contains methods\nwhich are either inherently cross-platform or are written in a cross-platform manner.\n\nSubclass off of ExtUtils::MMAny *and* ExtUtils::MMUnix. This is a temporary solution.\n\nTHIS MAY BE TEMPORARY!\n",
            "subsections": []
        },
        "METHODS": {
            "content": "Any methods marked *Abstract* must be implemented by subclasses.\n",
            "subsections": [
                {
                    "name": "Cross-platform helper methods",
                    "content": "These are methods which help writing cross-platform code.\n\nosflavor  *Abstract*\nmy @osflavor = $mm->osflavor;\n\n@osflavor is the style of operating system this is, usually corresponding to the MM*.pm file\nwe're using.\n\nThe first element of @osflavor is the major family (ie. Unix, Windows, VMS, OS/2, etc...) and\nthe rest are sub families.\n\nSome examples:\n\nCygwin98       ('Unix',  'Cygwin', 'Cygwin9x')\nWindows        ('Win32')\nWin98          ('Win32', 'Win9x')\nLinux          ('Unix',  'Linux')\nMacOS X        ('Unix',  'Darwin', 'MacOS', 'MacOS X')\nOS/2           ('OS/2')\n\nThis is used to write code for styles of operating system. See osflavoris() for use.\n\nosflavoris\nmy $isthisflavor = $mm->osflavoris($thisflavor);\nmy $isthisflavor = $mm->osflavoris(@oneoftheseflavors);\n\nChecks to see if the current operating system is one of the given flavors.\n\nThis is useful for code like:\n\nif( $mm->osflavoris('Unix') ) {\n$out = `foo 2>&1`;\n}\nelse {\n$out = `foo`;\n}\n\ncanloadxs\nmy $canloadxs = $self->canloadxs;\n\nReturns true if we have the ability to load XS.\n\nThis is important because miniperl, used to build XS modules in the core, can not load XS.\n\ncanrun\nuse ExtUtils::MM;\nmy $runnable = MM->canrun($Config{make});\n\nIf called in a scalar context it will return the full path to the binary you asked for if it was\nfound, or \"undef\" if it was not.\n\nIf called in a list context, it will return a list of the full paths to instances of the binary\nwhere found in \"PATH\", or an empty list if it was not found.\n\nCopied from IPC::Cmd, but modified into a method (and removed $INSTANCES capability).\n\ncanredirecterror\n$useredirect = MM->canredirecterror;\n\nTrue if on an OS where qx operator (or backticks) can redirect \"STDERR\" onto \"STDOUT\".\n\nismaketype\nmy $isdmake = $self->ismaketype('dmake');\n\nReturns true if \"$self->make\" is the given type; possibilities are:\n\ngmake    GNU make\ndmake\nnmake\nbsdmake  BSD pmake-derived\n\ncandepspace\nmy $candepspace = $self->candepspace;\n\nReturns true if \"make\" can handle (probably by quoting) dependencies that contain a space.\nCurrently known true for GNU make, false for BSD pmake derivative.\n\nquotedep\n$text = $mm->quotedep($text);\n\nMethod that protects Makefile single-value constants (mainly filenames), so that make will still\ntreat them as single values even if they inconveniently have spaces in. If the make program\nbeing used cannot achieve such protection and the given text would need it, throws an exception.\n\nsplitcommand\nmy @cmds = $MM->splitcommand($cmd, @args);\n\nMost OS have a maximum command length they can execute at once. Large modules can easily\ngenerate commands well past that limit. Its necessary to split long commands up into a series of\nshorter commands.\n\n\"splitcommand\" will return a series of @cmds each processing part of the args. Collectively\nthey will process all the arguments. Each individual line in @cmds will not be longer than the\n$self->maxexeclen being careful to take into account macro expansion.\n\n$cmd should include any switches and repeated initial arguments.\n\nIf no @args are given, no @cmds will be returned.\n\nPairs of arguments will always be preserved in a single command, this is a heuristic for things\nlike pmtoblib and pod2man which work on pairs of arguments. This makes things like this safe:\n\n$self->splitcommand($cmd, %pod2man);\n\nmaketype\nReturns a suitable string describing the type of makefile being written.\n\nstashmeta\nmy @recipelines = $MM->stashmeta($text, $file);\n\nGenerates a set of @recipelines which will result in the literal $text ending up in literal\n$file when the recipe is executed. Call it once, with all the text you want in $file. Make\nmacros will not be expanded, so the locations will be fixed at configure-time, not at\nbuild-time.\n\necho\nmy @commands = $MM->echo($text);\nmy @commands = $MM->echo($text, $file);\nmy @commands = $MM->echo($text, $file, \\%opts);\n\nGenerates a set of @commands which print the $text to a $file.\n\nIf $file is not given, output goes to STDOUT.\n\nIf $opts{append} is true the $file will be appended to rather than overwritten. Default is to\noverwrite.\n\nIf $opts{allowvariables} is true, make variables of the form \"$(...)\" will not be escaped.\nOther \"$\" will. Default is to escape all \"$\".\n\nExample of use:\n\nmy $make = join '', map \"\\t$\\n\", $MM->echo($text, $file);\n\nwraplist\nmy $args = $mm->wraplist(@list);\n\nTakes an array of items and turns them into a well-formatted list of arguments. In most cases\nthis is simply something like:\n\nFOO \\\nBAR \\\nBAZ\n\nmaketextfilter\nmy $filtermaketext = $mm->maketextfilter($maketext);\n\nThe text of the Makefile is run through this method before writing to disk. It allows systems a\nchance to make portability fixes to the Makefile.\n\nBy default it does nothing.\n\nThis method is protected and not intended to be called outside of MakeMaker.\n\ncd  *Abstract*\nmy $subdircmd = $MM->cd($subdir, @cmds);\n\nThis will generate a make fragment which runs the @cmds in the given $dir. The rough equivalent\nto this, except cross platform.\n\ncd $subdir && $cmd\n\nCurrently $dir can only go down one level. \"foo\" is fine. \"foo/bar\" is not. \"../foo\" is right\nout.\n\nThe resulting $subdircmd has no leading tab nor trailing newline. This makes it easier to embed\nin a make string. For example.\n\nmy $make = sprintf <<'CODE', $subdircmd;\nfoo :\n$(ECHO) what\n%s\n$(ECHO) mouche\nCODE\n\noneliner  *Abstract*\nmy $oneliner = $MM->oneliner($perlcode);\nmy $oneliner = $MM->oneliner($perlcode, \\@switches);\n\nThis will generate a perl one-liner safe for the particular platform you're on based on the\ngiven $perlcode and @switches (a -e is assumed) suitable for using in a make target. It will\nuse the proper shell quoting and escapes.\n\n$(PERLRUN) will be used as perl.\n\nAny newlines in $perlcode will be escaped. Leading and trailing newlines will be stripped.\nMakes this idiom much easier:\n\nmy $code = $MM->oneliner(<<'CODE', [...switches...]);\nsome code here\nanother line here\nCODE\n\nUsage might be something like:\n\n# an echo emulation\n$oneliner = $MM->oneliner('print \"Foo\\n\"');\n$make = '$oneliner > somefile';\n\nDollar signs in the $perlcode will be protected from make using the \"quoteliteral\" method,\nunless they are recognised as being a make variable, \"$(varname)\", in which case they will be\nleft for make to expand. Remember to quote make macros else it might be used as a bareword. For\nexample:\n\n# Assign the value of the $(VERSIONFROM) make macro to $vf.\n$oneliner = $MM->oneliner('$vf = \"$(VERSIONFROM)\"');\n\nIts currently very simple and may be expanded sometime in the figure to include more flexible\ncode and switches.\n\nquoteliteral  *Abstract*\nmy $safetext = $MM->quoteliteral($text);\nmy $safetext = $MM->quoteliteral($text, \\%options);\n\nThis will quote $text so it is interpreted literally in the shell.\n\nFor example, on Unix this would escape any single-quotes in $text and put single-quotes around\nthe whole thing.\n\nIf $options{allowvariables} is true it will leave '$(FOO)' make variables untouched. If false\nthey will be escaped like any other \"$\". Defaults to true.\n\nescapedollarsigns\nmy $escapedtext = $MM->escapedollarsigns($text);\n\nEscapes stray \"$\" so they are not interpreted as make variables.\n\nIt lets by \"$(...)\".\n\nescapealldollarsigns\nmy $escapedtext = $MM->escapealldollarsigns($text);\n\nEscapes all \"$\" so they are not interpreted as make variables.\n\nescapenewlines  *Abstract*\nmy $escapedtext = $MM->escapenewlines($text);\n\nShell escapes newlines in $text.\n\nmaxexeclen  *Abstract*\nmy $maxexeclen = $MM->maxexeclen;\n\nCalculates the maximum command size the OS can exec. Effectively, this is the max size of a\nshell command line.\n\nmake\nmy $make = $MM->make;\n\nReturns the make variant we're generating the Makefile for. This attempts to do some\nnormalization on the information from %Config or the user.\n"
                },
                {
                    "name": "Targets",
                    "content": "These are methods which produce make targets.\n\nalltarget\nGenerate the default target 'all'.\n\nblibdirstarget\nmy $makefrag = $mm->blibdirstarget;\n\nCreates the blibdirs target which creates all the directories we use in blib/.\n\nThe blibdirs.ts target is deprecated. Depend on blibdirs instead.\n\nclean (o)\nDefines the clean target.\n\ncleansubdirstarget\nmy $makefrag = $MM->cleansubdirstarget;\n\nReturns the cleansubdirs target. This is used by the clean target to call clean on any\nsubdirectories which contain Makefiles.\n\ndirtarget\nmy $makefrag = $mm->dirtarget(@directories);\n\nGenerates targets to create the specified directories and set its permission to PERMDIR.\n\nBecause depending on a directory to just ensure it exists doesn't work too well (the modified\ntime changes too often) dirtarget() creates a .exists file in the created directory. It is this\nyou should depend on. For portability purposes you should use the $(DIRFILESEP) macro rather\nthan a '/' to separate the directory from the file.\n\nyourdirectory$(DIRFILESEP).exists\n\ndistdir\nDefines the scratch directory target that will hold the distribution before tar-ing (or\nshar-ing).\n\ndisttest\nDefines a target that produces the distribution in the scratch directory, and runs 'perl\nMakefile.PL; make ;make test' in that subdirectory.\n\nxsdlsymsarg\nReturns command-line arg(s) to linker for file listing dlsyms to export. Defaults to returning\nempty string, can be overridden by e.g. AIX.\n\nxsdlsymsext\nReturns file-extension for \"xsmakedlsyms\" method's output file, including any \".\" character.\n\nxsdlsymsextra\nReturns any extra text to be prepended to the $extra argument of \"xsmakedlsyms\".\n\nxsdlsymsiterator\nIterates over necessary shared objects, calling \"xsmakedlsyms\" method for each with\nappropriate arguments.\n\nxsmakedlsyms\n$self->xsmakedlsyms(\n\\%attribs, # hashref from %attribs in caller\n\"$self->{BASEEXT}.def\", # output file for Makefile target\n'Makefile.PL', # dependency\n$self->{NAME}, # shared object's \"name\"\n$self->{DLBASE}, # last ::-separated part of name\n$attribs{DLFUNCS} || $self->{DLFUNCS} || {}, # various params\n$attribs{FUNCLIST} || $self->{FUNCLIST} || [],\n$attribs{IMPORTS} || $self->{IMPORTS} || {},\n$attribs{DLVARS} || $self->{DLVARS} || [],\n# optional extra param that will be added as param to Mksymlists\n);\n\nUtility method that returns Makefile snippet to call \"Mksymlists\".\n\ndynamic (o)\nDefines the dynamic target.\n\nmakemakerdflttarget\nmy $makefrag = $mm->makemakerdflttarget\n\nReturns a make fragment with the makemakerdeflttarget specified. This target is the first\ntarget in the Makefile, is the default target and simply points off to 'all' just in case any\nmake variant gets confused or something gets snuck in before the real 'all' target.\n\nmanifypodstarget\nmy $manifypodstarget = $self->manifypodstarget;\n\nGenerates the manifypods target. This target generates man pages from all POD files in MAN1PODS\nand MAN3PODS.\n\nmetafiletarget\nmy $target = $mm->metafiletarget;\n\nGenerate the metafile target.\n\nWrites the file META.yml (YAML encoded meta-data) and META.json (JSON encoded meta-data) about\nthe module in the distdir. The format follows Module::Build's as closely as possible.\n\nmetafiledata\nmy $metadatahashref = $mm->metafiledata(\\%metaadd, \\%metamerge);\n\nReturns the data which MakeMaker turns into the META.yml file and the META.json file. It is\nalways in version 2.0 of the format.\n\nValues of %metaadd will overwrite any existing metadata in those keys. %metamerge will be\nmerged with them.\n\nmetafilefile\nmy $metayml = $mm->metafilefile(@metadatapairs);\n\nTurns the @metadatapairs into YAML.\n\nThis method does not implement a complete YAML dumper, being limited to dump a hash with values\nwhich are strings, undef's or nested hashes and arrays of strings. No quoting/escaping is done.\n\ndistmetatarget\nmy $makefrag = $mm->distmetatarget;\n\nGenerates the distmeta target to add META.yml and META.json to the MANIFEST in the distdir.\n\nmymeta\nmy $mymeta = $mm->mymeta;\n\nGenerate MYMETA information as a hash either from an existing CPAN Meta file (META.json or\nMETA.yml) or from internal data.\n\nwritemymeta\n$self->writemymeta( $mymeta );\n\nWrite MYMETA information to MYMETA.json and MYMETA.yml.\n\nrealclean (o)\nDefines the realclean target.\n\nrealcleansubdirstarget\nmy $makefrag = $MM->realcleansubdirstarget;\n\nReturns the realcleansubdirs target. This is used by the realclean target to call realclean on\nany subdirectories which contain Makefiles.\n\nsignaturetarget\nmy $target = $mm->signaturetarget;\n\nGenerate the signature target.\n\nWrites the file SIGNATURE with \"cpansign -s\".\n\ndistsignaturetarget\nmy $makefrag = $mm->distsignaturetarget;\n\nGenerates the distsignature target to add SIGNATURE to the MANIFEST in the distdir.\n\nspecialtargets\nmy $makefrag = $mm->specialtargets\n\nReturns a make fragment containing any targets which have special meaning to make. For example,\n.SUFFIXES and .PHONY.\n"
                },
                {
                    "name": "Init methods",
                    "content": "Methods which help initialize the MakeMaker object and macros.\n\ninitABSTRACT\n$mm->initABSTRACT\n\ninitINST\n$mm->initINST;\n\nCalled by initmain. Sets up all INST* variables except those related to XS code. Those are\nhandled in initxs.\n\ninitINSTALL\n$mm->initINSTALL;\n\nCalled by initmain. Sets up all INSTALL* variables (except INSTALLDIRS) and *PREFIX.\n\ninitINSTALLfromPREFIX\n$mm->initINSTALLfromPREFIX;\n\ninitfromINSTALLBASE\n$mm->initfromINSTALLBASE\n\ninitVERSION  *Abstract*\n$mm->initVERSION\n\nInitialize macros representing versions of MakeMaker and other tools\n\nMAKEMAKER: path to the MakeMaker module.\n\nMMVERSION: ExtUtils::MakeMaker Version\n\nMMREVISION: ExtUtils::MakeMaker version control revision (for backwards compat)\n\nVERSION: version of your module\n\nVERSIONMACRO: which macro represents the version (usually 'VERSION')\n\nVERSIONSYM: like version but safe for use as an RCS revision number\n\nDEFINEVERSION: -D line to set the module version when compiling\n\nXSVERSION: version in your .xs file. Defaults to $(VERSION)\n\nXSVERSIONMACRO: which macro represents the XS version.\n\nXSDEFINEVERSION: -D line to set the xs version when compiling.\n\nCalled by initmain.\n\ninittools\n$MM->inittools();\n\nInitializes the simple macro definitions used by toolsother() and places them in the $MM\nobject. These use conservative cross platform versions and should be overridden with platform\nspecific versions for performance.\n\nDefines at least these macros.\n\nMacro             Description\n\nNOOP              Do nothing\nNOECHO            Tell make not to display the command itself\n\nSHELL             Program used to run shell commands\n\nECHO              Print text adding a newline on the end\nRMF              Remove a file\nRMRF             Remove a directory\nTOUCH             Update a file's timestamp\nTESTF            Test for a file's existence\nTESTS            Test the size of a file\nCP                Copy a file\nCPNONEMPTY       Copy a file if it is not empty\nMV                Move a file\nCHMOD             Change permissions on a file\nFALSE             Exit with non-zero\nTRUE              Exit with zero\n\nUMASKNULL        Nullify umask\nDEVNULL          Suppress all command output\n\ninitothers\n$MM->initothers();\n\nInitializes the macro definitions having to do with compiling and linking used by toolsother()\nand places them in the $MM object.\n\nIf there is no description, its the same as the parameter to WriteMakefile() documented in\nExtUtils::MakeMaker.\n\ntoolsother\nmy $makefrag = $MM->toolsother;\n\nReturns a make fragment containing definitions for the macros initothers() initializes.\n\ninitDIRFILESEP  *Abstract*\n$MM->initDIRFILESEP;\nmy $dirfilesep = $MM->{DIRFILESEP};\n\nInitializes the DIRFILESEP macro which is the separator between the directory and filename in a\nfilepath. ie. / on Unix, \\ on Win32 and nothing on VMS.\n\nFor example:\n\n# instead of $(INSTARCHAUTODIR)/extralibs.ld\n$(INSTARCHAUTODIR)$(DIRFILESEP)extralibs.ld\n\nSomething of a hack but it prevents a lot of code duplication between MM* variants.\n\nDo not use this as a separator between directories. Some operating systems use different\nseparators between subdirectories as between directories and filenames (for example:\nVOLUME:[dir1.dir2]file on VMS).\n\ninitlinker  *Abstract*\n$mm->initlinker;\n\nInitialize macros which have to do with linking.\n\nPERLARCHIVE: path to libperl.a equivalent to be linked to dynamic extensions.\n\nPERLARCHIVEAFTER: path to a library which should be put on the linker command line *after* the\nexternal libraries to be linked to dynamic extensions. This may be needed if the linker is\none-pass, and Perl includes some overrides for C RTL functions, such as malloc().\n\nEXPORTLIST: name of a file that is passed to linker to define symbols to be exported.\n\nSome OSes do not need these in which case leave it blank.\n\ninitplatform\n$mm->initplatform\n\nInitialize any macros which are for platform specific use only.\n\nA typical one is the version number of your OS specific module. (ie. MMUnixVERSION or\nMMVMSVERSION).\n\ninitMAKE\n$mm->initMAKE\n\nInitialize MAKE from either a MAKE environment variable or $Config{make}.\n"
                },
                {
                    "name": "Tools",
                    "content": "A grab bag of methods to generate specific macros and commands.\n\nmanifypods\nDefines targets and routines to translate the pods into manpages and put them into the INST*\ndirectories.\n\nPOD2MANmacro\nmy $pod2manmacro = $self->POD2MANmacro\n\nReturns a definition for the POD2MAN macro. This is a program which emulates the pod2man\nutility. You can add more switches to the command by simply appending them on the macro.\n\nTypical usage:\n\n$(POD2MAN) --section=3 --permrw=$(PERMRW) podfile1 manpage1 ...\n\ntestviaharness\nmy $command = $mm->testviaharness($perl, $tests);\n\nReturns a $command line which runs the given set of $tests with Test::Harness and the given\n$perl.\n\nUsed on the t/*.t files.\n\ntestviascript\nmy $command = $mm->testviascript($perl, $script);\n\nReturns a $command line which just runs a single test without Test::Harness. No checks are done\non the results, they're just printed.\n\nUsed for test.pl, since they don't always follow Test::Harness formatting.\n\ntoolautosplit\nDefines a simple perl call that runs autosplit. May be deprecated by pmtoblib soon.\n\narchcheck\nmy $archok = $mm->archcheck(\n$INC{\"Config.pm\"},\nFile::Spec->catfile($Config{archlibexp}, \"Config.pm\")\n);\n\nA sanity check that what Perl thinks the architecture is and what Config thinks the architecture\nis are the same. If they're not it will return false and show a diagnostic message.\n\nWhen building Perl it will always return true, as nothing is installed yet.\n\nThe interface is a bit odd because this is the result of a quick refactoring. Don't rely on it.\n"
                },
                {
                    "name": "File::Spec wrappers",
                    "content": "ExtUtils::MMAny is a subclass of File::Spec. The methods noted here override File::Spec.\n\ncatfile\nFile::Spec <= 0.83 has a bug where the file part of catfile is not canonicalized. This override\nfixes that bug.\n"
                },
                {
                    "name": "Misc",
                    "content": "Methods I can't really figure out where they should go yet.\n\nfindtests\nmy $test = $mm->findtests;\n\nReturns a string suitable for feeding to the shell to return all tests in t/*.t.\n\nfindtestsrecursive\nmy $tests = $mm->findtestsrecursive;\n\nReturns a string suitable for feeding to the shell to return all tests in t/ but recursively.\nEquivalent to\n\nmy $tests = $mm->findtestsrecursivein('t');\n\nfindtestsrecursivein\nmy $tests = $mm->findtestsrecursivein($dir);\n\nReturns a string suitable for feeding to the shell to return all tests in $dir recursively.\n\nextracleanfiles\nmy @filestoclean = $MM->extracleanfiles;\n\nReturns a list of OS specific files to be removed in the clean target in addition to the usual\nset.\n\ninstallvars\nmy @installvars = $mm->installvars;\n\nA list of all the INSTALL* variables without the INSTALL prefix. Useful for iteration or\nbuilding related variable sets.\n\nlibscan\nmy $wanted = $self->libscan($path);\n\nTakes a path to a file or dir and returns an empty string if we don't want to include this file\nin the library. Otherwise it returns the the $path unchanged.\n\nMainly used to exclude version control administrative directories and base-level README.pod from\ninstallation.\n\nplatformconstants\nmy $makefrag = $mm->platformconstants\n\nReturns a make fragment defining all the macros initialized in initplatform() rather than put\nthem in constants().\n\npostconstants (o)\nReturns an empty string per default. Dedicated to overrides from within Makefile.PL after all\nconstants have been defined.\n\npostinitialize (o)\nReturns an empty string per default. Used in Makefile.PLs to add some chunk of text to the\nMakefile after the object is initialized.\n\npostamble (o)\nReturns an empty string. Can be used in Makefile.PLs to write some text to the Makefile at the\nend.\n"
                }
            ]
        },
        "AUTHOR": {
            "content": "Michael G Schwern <schwern@pobox.com> and the denizens of makemaker@perl.org with code from\nExtUtils::MMUnix and ExtUtils::MMWin32.\n",
            "subsections": []
        }
    },
    "summary": "ExtUtils::MMAny - Platform-agnostic MM methods",
    "flags": [],
    "examples": [],
    "see_also": []
}