=head1 NAME

makeppbuiltin -- Stand-alone access to builtin commands in makepp

=for vc $Id: makeppbuiltin.pod,v 1.13 2011/06/23 15:39:49 pfeiffer Exp $

=head1 DESCRIPTION

=for genindex '[-$][-?\w<>]+' makeppbuiltin.pod

B<?:>E<nbsp>L<-?|/_>,E<nbsp>
B<A:>E<nbsp>L<-A|/a_filename>,
  L<--args-file|/a_filename>,
  L<--arguments-file|/a_filename>,E<nbsp>
B<D:>E<nbsp>L<$I<DIRECTNAME>FLAGS|/_directnameflags>,E<nbsp>
B<H:>E<nbsp>L<-h|/_>,
  L<--help|/_>,E<nbsp>
B<I:>E<nbsp>L<-I|/i_directory>,
  L<--include|/i_directory>,
  L<--include-dir|/i_directory>,E<nbsp>
B<M:>E<nbsp>L<-M|/m_module_arg>,
  L<$MAKEPPBUILTINFLAGS|/_makeppbuiltinflags>,
  L<--module|/m_module_arg>,E<nbsp>
B<V:>E<nbsp>L<-V|/v>,
  L<--version|/v>

B<makeppbuiltin> S<[ I<metaoption> ... ]> I<command> -?|--help

B<mppb> S<[ I<metaoption> ... ]> I<command> -?|--help

B<makeppbuiltin> S<[ I<metaoption> ... ]> I<command> S<[ I<option> ... ]> S<[ I<argument> ... ]>

B<mppb> S<[ I<metaoption> ... ]> I<command> S<[ I<option> ... ]> S<[ I<argument> ... ]>

or

ln makeppbuiltin I<command>

I<command> -?|--help

I<command> S<[ I<option> ... ]> S<[ I<argument> ... ]>

This command allows you to call the L<builtin commands|makepp_builtins> makepp
provides, from outside makepp as well.  This could be necessary if you've
installed things with Makeppfile targets that use C<&install>, but there is no
corresponding C<&uninstall> target.  Or you need a feature not usually found
in the Unix counterparts like C<ln -r>.  That's what this command is for.

The commands get a simple additional C<--help> option, which their builtin
counterparts lack.  This works by parsing the command's option declaration.
It cannot however find out, what other arguments the command expects.

The metaoptions allow loading your own command or helper functions, but only
if it comes from a module.  Valid options are:

=over

=item -A I<filename>

=item --args-file=I<filename>

=item --arguments-file=I<filename>

Read the file and parse it as possibly quoted whitespace- and/or newline-separated options.

=item -?

=item -h

=item --help

Print out a brief summary of the options.

=item -I I<directory>

=item --include=I<directory>

=item --include-dir=I<directory>

Add I<directory> to Perl load path C<@INC>.

=item -M I<module[=arg,...]>

=item --module=I<module[=arg,...]>

Load module and import any functions it exports.

=item -V

=item --version

Print out the version number.

=back

=head1 DIRECT CALL

If you like to call such a command more frequently, you can call it directly,
by linking C<makeppbuiltin> to the name of that command.  The name of the
builtin can occur anywhere within the file-name without directory.  So any of
the following links would invoke the builtin C<template> command (but the last
would need to be escaped from the Shell):

=over 4

=item template

=item template.pl

=item makepptemplate

=item templatepp

=item &template

=back

=head1 DIFFERENCES

There are a few notable differences between the usual call within a Makeppfile
rule, and a stand-alone call:

=over 4

=item Syntax

Builtin commands are not parsed by the Shell within makepp.  There are subtle
differences in how makepp quotes work, e.g. dollar signs are expanded by
makepp even within single quotes, and need to be doubled to escape them.
Various characters, like C<*>, C<&> or C<|> are not special to makepp and need
not be escaped.

B<Difference:> To start the command stand-alone you are probably using a Shell.
Here you must adapt such special cases to the syntactical requirements of the
Shell.

=item Variables and Functions

Before makepp executes the rule actions, they will already have undergone
expression expansion of makepp variables and functions.

B<Difference:> When called from the Shell, you will instead get unprotected
Shell variables and expressions expanded, before the comand is called.

=item Perl Code

Each Makeppfile lives in its own (anonymous) Perl package.  Anything you do
therein is available when running builtin commands.  For example, you can set
variables or define functions, and use them within the Perl code of those
commands that accept it.

B<Difference:> In stand-alone usage there is no such context.  Everything you
need, must be in the Perl code you pass the command, or in modules you use.

=back

=head1 ENVIRONMENT

Makeppbuiltin looks at the following environment variables:

=over 4

=item $MAKEPPBUILTINFLAGS

Any flags in this environment variable are interpreted as command line options
before any explicit options.  Quotes are interpreted like in makefiles.

=item $I<DIRECTNAME>FLAGS

This variable is used instead of C<$MAKEPPBUILTINFLAGS> when makeppbuiltin is
linked to I<directname> as explained under L<DIRECT CALL>.

=back

=head1 AUTHOR

Daniel Pfeiffer (occitan@esperanto.org)
