Manual Pages for UNIX Darwin command on man ExtUtils::MM_Any
MyWebUniversity

Manual Pages for UNIX Darwin command on man ExtUtils::MM_Any

ExtUtils::MMAny(3pm) Perl Programmers Reference Guide ExtUtils::MMAny(3pm)

NAME

ExtUtils::MMAny - Platform-agnostic MM methods

SYNOPSIS

FOR INTERNAL USE ONLY! package ExtUtils::MMSomeOS;

# Temporarily, you have to subclass both. Put MMAny first.

require ExtUtils::MMAny; require ExtUtils::MMUnix; @ISA = qw(ExtUtils::MMAny ExtUtils::Unix);

DESCRIPTION

FFOORR IINNTTEERRNNAALL UUSSEE OONNLLYY!! ExtUtils::MMAny is a superclass for the ExtUtils::MM* set of modules.

It contains methods which are either inherently cross-platform or are

written in a cross-platform manner.

Subclass off of ExtUtils::MMAny and ExtUtils::MMUnix. This is a tem-

porary solution. TTHHIISS MMAAYY BBEE TTEEMMPPOORRAARRYY!! MMEETTHHOODDSS Any methods marked Abstract must be implemented by subclasses.

CCrroossss-ppllaattffoorrmm hheellppeerr mmeetthhooddss

These are methods which help writing cross-platform code.

osflavor Abstract

my @osflavor = $mm->osflavor;

@osflavor is the style of operating system this is, usually corre-

sponding to the MM*.pm file we're using. The first element of @osflavor is the major family (ie. Unix, Windows, VMS, OS/2, etc...) and the rest are sub families. Some examples: Cygwin98 ('Unix', 'Cygwin', 'Cygwin9x') Windows NT ('Win32', 'WinNT') Win98 ('Win32', 'Win9x') Linux ('Unix', 'Linux') MacOS X ('Unix', 'Darwin', 'MacOS', 'MacOS X') OS/2 ('OS/2')

This is used to write code for styles of operating system. See osfla-

voris() for use. osflavoris

my $isthisflavor = $mm->osflavoris($thisflavor);

my $isthisflavor = $mm->osflavoris(@oneoftheseflavors);

Checks to see if the current operating system is one of the given fla-

vors. This is useful for code like:

if( $mm->osflavoris('Unix') ) {

$out = `foo 2>&1`;

} else {

$out = `foo`;

} splitcommand

my @cmds = $MM->splitcommand($cmd, @args);

Most OS have a maximum command length they can execute at once. Large

modules can easily generate commands well past that limit. Its neces-

sary to split long commands up into a series of shorter commands. "splitcommand" will return a series of @cmds each processing part of the args. Collectively they will process all the arguments. Each individual line in @cmds will not be longer than the

$self->maxexeclen being careful to take into account macro expansion.

$cmd should include any switches and repeated initial arguments.

If no @args are given, no @cmds will be returned. Pairs of arguments will always be preserved in a single command, this is a heuristic for things like pmtoblib and pod2man which work on pairs of arguments. This makes things like this safe:

$self->splitcommand($cmd, %pod2man);

echo

my @commands = $MM->echo($text);

my @commands = $MM->echo($text, $file);

my @commands = $MM->echo($text, $file, $appending);

Generates a set of @commands which print the $text to a $file.

If $file is not given, output goes to STDOUT.

If $appending is true the $file will be appended to rather than over-

written. wraplist

my $args = $mm->wraplist(@list);

Takes an array of items and turns them into a well-formatted list of

arguments. In most cases this is simply something like: FOO \ BAR \ BAZ cd Abstract

my $subdircmd = $MM->cd($subdir, @cmds);

This will generate a make fragment which runs the @cmds in the given

$dir. The rough equivalent to this, except cross platform.

cd $subdir && $cmd

Currently $dir can only go down one level. "foo" is fine. "foo/bar"

is not. "../foo" is right out.

The resulting $subdircmd has no leading tab nor trailing newline.

This makes it easier to embed in a make string. For example.

my $make = sprintf <<'CODE', $subdircmd;

foo :

$(ECHO) what

%s

$(ECHO) mouche

CODE oneliner Abstract

my $oneliner = $MM->oneliner($perlcode);

my $oneliner = $MM->oneliner($perlcode, \@switches);

This will generate a perl one-liner safe for the particular platform

you're on based on the given $perlcode and @switches (a -e is assumed)

suitable for using in a make target. It will use the proper shell quoting and escapes.

$(PERLRUN) will be used as perl.

Any newlines in $perlcode will be escaped. Leading and trailing new-

lines will be stripped. Makes this idiom much easier:

my $code = $MM->oneliner(<<'CODE', [...switches...]);

some code here another line here CODE Usage might be something like:

# an echo emulation

$oneliner = $MM->oneliner('print "Foo\n"');

$make = '$oneliner > somefile';

All dollar signs must be doubled in the $perlcode if you expect them

to be interpreted normally, otherwise it will be considered a make macro. Also remember to quote make macros else it might be used as a bareword. For example:

# Assign the value of the $(VERSIONFROM) make macro to $vf.

$oneliner = $MM->oneliner('$$vf = "$(VERSIONFROM)"');

Its currently very simple and may be expanded sometime in the figure to include more flexible code and switches. quoteliteral Abstract

my $safetext = $MM->quoteliteral($text);

This will quote $text so it is interpreted literally in the shell.

For example, on Unix this would escape any single-quotes in $text and

put single-quotes around the whole thing.

escapenewlines Abstract

my $escapedtext = $MM->escapenewlines($text);

Shell escapes newlines in $text.

maxexeclen Abstract

my $maxexeclen = $MM->maxexeclen;

Calculates the maximum command size the OS can exec. Effectively, this is the max size of a shell command line. TTaarrggeettss These are methods which produce make targets. alltarget Generate the default target 'all'. blibdirstarget

my $makefrag = $mm->blibdirstarget;

Creates the blibdirs target which creates all the directories we use in blib/. The blibdirs.ts target is deprecated. Depend on blibdirs instead. clean (o) Defines the clean target. cleansubdirstarget

my $makefrag = $MM->cleansubdirstarget;

Returns the cleansubdirs target. This is used by the clean target to call clean on any subdirectories which contain Makefiles. dirtarget

my $makefrag = $mm->dirtarget(@directories);

Generates targets to create the specified directories and set its per-

mission to 0755. Because depending on a directory to just ensure it exists doesn't work too well (the modified time changes too often) dirtarget() creates a .exists file in the created directory. It is this you should depend

on. For portability purposes you should use the $(DIRFILESEP) macro

rather than a '/' to seperate the directory from the file.

yourdirectory$(DIRFILESEP).exists

distdir Defines the scratch directory target that will hold the distribution

before tar-ing (or shar-ing).

disttest

Defines a target that produces the distribution in the scratchdirec-

tory, and runs 'perl Makefile.PL; make ;make test' in that subdirec-

tory. dynamic (o) Defines the dynamic target. makemakerdflttarget

my $makefrag = $mm->makemakerdflttarget

Returns a make fragment with the makemakerdeflttarget specified. This target is the first target in the Makefile, is the default target and simply points off to 'all' just in case any make variant gets confused or something gets snuck in before the real 'all' target. manifypodstarget

my $manifypodstarget = $self->manifypodstarget;

Generates the manifypods target. This target generates man pages from all POD files in MAN1PODS and MAN3PODS. metafiletarget

my $target = $mm->metafiletarget;

Generate the metafile target.

Writes the file META.yml YAML encoded meta-data about the module in the

distdir. The format follows Module::Build's as closely as possible. Additionally, we include: versionfrom installdirs distmetatarget

my $makefrag = $mm->distmetatarget;

Generates the distmeta target to add META.yml to the MANIFEST in the distdir. realclean (o) Defines the realclean target. realcleansubdirstarget

my $makefrag = $MM->realcleansubdirstarget;

Returns the realcleansubdirs target. This is used by the realclean target to call realclean on any subdirectories which contain Makefiles. signaturetarget

my $target = $mm->signaturetarget;

Generate the signature target.

Writes the file SIGNATURE with "cpansign -s".

distsignaturetarget

my $makefrag = $mm->distsignaturetarget;

Generates the distsignature target to add SIGNATURE to the MANIFEST in the distdir. specialtargets

my $makefrag = $mm->specialtargets

Returns a make fragment containing any targets which have special mean-

ing to make. For example, .SUFFIXES and .PHONY. IInniitt mmeetthhooddss Methods which help initialize the MakeMaker object and macros. initINST

$mm->initINST;

Called by initmain. Sets up all INST* variables except those related to XS code. Those are handled in initxs. initINSTALL

$mm->initINSTALL;

Called by initmain. Sets up all INSTALL* variables (except INSTALLDIRS) and *PREFIX. initINSTALLfromPREFIX

$mm->initINSTALLfromPREFIX;

initfromINSTALLBASE

$mm->initfromINSTALLBASE

initVERSION Abstract

$mm->initVERSION

Initialize macros representing versions of MakeMaker and other tools MAKEMAKER: path to the MakeMaker module. MMVERSION: ExtUtils::MakeMaker Version

MMREVISION: ExtUtils::MakeMaker version control revision (for back-

wards compat) VERSION: version of your module VERSIONMACRO: which macro represents the version (usually 'VERSION') VERSIONSYM: like version but safe for use as an RCS revision number

DEFINEVERSION: -D line to set the module version when compiling

XSVERSION: version in your .xs file. Defaults to $(VERSION)

XSVERSIONMACRO: which macro represents the XS version.

XSDEFINEVERSION: -D line to set the xs version when compiling.

Called by initmain. initothers Abstract

$MM->initothers();

Initializes the macro definitions used by toolsother() and places them

in the $MM object.

If there is no description, its the same as the parameter to WriteMake-

file() documented in ExtUtils::MakeMaker. Defines at least these macros. Macro Description NOOP Do nothing NOECHO Tell make not to display the command itself MAKEFILE FIRSTMAKEFILE MAKEFILEOLD MAKEAPERLFILE File used by MAKEAPERL SHELL Program used to run shell commands ECHO Print text adding a newline on the end RMF Remove a file RMRF Remove a directory TOUCH Update a file's timestamp TESTF Test for a file's existence CP Copy a file MV Move a file CHMOD Change permissions on a file UMASKNULL Nullify umask DEVNULL Supress all command output initDIRFILESEP Abstract

$MM->initDIRFILESEP;

my $dirfilesep = $MM->{DIRFILESEP};

Initializes the DIRFILESEP macro which is the seperator between the directory and filename in a filepath. ie. / on Unix, \ on Win32 and nothing on VMS. For example:

# instead of $(INSTARCHAUTODIR)/extralibs.ld

$(INSTARCHAUTODIR)$(DIRFILESEP)extralibs.ld

Something of a hack but it prevents a lot of code duplication between MM* variants. Do not use this as a seperator between directories. Some operating systems use different seperators between subdirectories as between directories and filenames (for example: VOLUME:[dir1.dir2]file on VMS). initlinker Abstract

$mm->initlinker;

Initialize macros which have to do with linking. PERLARCHIVE: path to libperl.a equivalent to be linked to dynamic extensions. PERLARCHIVEAFTER: path to a library which should be put on the linker command line after the external libraries to be linked to dynamic

extensions. This may be needed if the linker is one-pass, and Perl

includes some overrides for C RTL functions, such as malloc(). EXPORTLIST: name of a file that is passed to linker to define symbols to be exported. Some OSes do not need these in which case leave it blank. initplatform

$mm->initplatform

Initialize any macros which are for platform specific use only. A typical one is the version number of your OS specific mocule. (ie. MMUnixVERSION or MMVMSVERSION). TToooollss A grab bag of methods to generate specific macros and commands. manifypods Defines targets and routines to translate the pods into manpages and put them into the INST* directories. POD2MANmacro

my $pod2manmacro = $self->POD2MANmacro

Returns a definition for the POD2MAN macro. This is a program which emulates the pod2man utility. You can add more switches to the command by simply appending them on the macro. Typical usage:

$(POD2MAN) -section=3 -permrw=$(PERMRW) podfile1 manpage1 ...

testviaharness

my $command = $mm->testviaharness($perl, $tests);

Returns a $command line which runs the given set of $tests with

Test::Harness and the given $perl.

Used on the t/*.t files. testviascript

my $command = $mm->testviascript($perl, $script);

Returns a $command line which just runs a single test without

Test::Harness. No checks are done on the results, they're just printed.

Used for test.pl, since they don't always follow Test::Harness format-

ting. toolautosplit Defines a simple perl call that runs autosplit. May be deprecated by pmtoblib soon. FFiillee::::SSppeecc wwrraappppeerrss ExtUtils::MMAny is a subclass of File::Spec. The methods noted here override File::Spec. catfile File::Spec <= 0.83 has a bug where the file part of catfile is not canonicalized. This override fixes that bug. MMiisscc Methods I can't really figure out where they should go yet. findtests

my $test = $mm->findtests;

Returns a string suitable for feeding to the shell to return all tests in t/*.t. extracleanfiles

my @filestoclean = $MM->extracleanfiles;

Returns a list of OS specific files to be removed in the clean target in addition to the usual set. installvars

my @installvars = $mm->installvars;

A list of all the INSTALL* variables without the INSTALL prefix. Use-

ful for iteration or building related variable sets. libscan

my $wanted = $self->libscan($path);

Takes a path to a file or dir and returns an empty string if we don't want to include this file in the library. Otherwise it returns the the

$path unchanged.

Mainly used to exclude version control administrative directories from installation. platformconstants

my $makefrag = $mm->platformconstants

Returns a make fragment defining all the macros initialized in initplatform() rather than put them in constants(). AUTHOR

Michael G Schwern and the denizens of make-

maker@perl.org with code from ExtUtils::MMUnix and ExtUtils::MMWin32.

perl v5.8.8 2001-09-21 ExtUtils::MMAny(3pm)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™