NAME

ExtUtils::Builder::Action - The ExtUtils::Builder Action role

VERSION

version 0.004

SYNOPSIS

$_->execute for @actions;

open my $script, '>', 'foo.sh';
print $script shell_quote(@{$_}) for map { $_->to_command } @actions;

DESCRIPTION

Actions are the cornerstone of the ExtUtils::Builder framework. They provide an interface between build tools (ExtUtils::MakeMaker, Module::Build) and building extensions. This allows both sides to be completely independent from each other. It is a flexible abstraction around pieces of work, this work can be a piece of perl code, an external command, a mix of those or possibly other things.

OVERVIEW

An action can be consumed in many ways. It can be executed, which is often the simplest way to deal with them. It can be serialized to commands that can be passed on to system or strings that can be evalled. If a consumer can deal with multiple of these, the preference method can be used to choose between options. On composite actions, flatten can be called to retrieve the constituent actions, on primitive actions it's just an identity operator. This is particularly useful before calling preference, because different sub-actions are likely to have different preferences.

METHODS

execute(%arguments)

Execute this action immediately. This may throw an exception on errors, but doesn't otherwise return anything. %arguments may be used by the command.

  • logger

    This is a callback subref that messages may be written to while executing

  • quiet

    If true, this suppresses logging.

to_command(%options)

Convert the action into a set of platform appropriate commands. It returns a list of array-refs, each array-ref being an individual command that can be passes to system or equivalent. %options can influence how something is serialized in action-type specific ways, but shouldn't fundamentally affect the action that is performed. All options are optional.

perl

This contains the path to the current perl interpreter.

config

This should contain an ExtUtils::Config object, or equivalent.

to_code(%options)

This returns a list of strings that can be evalled to sub-refs. %options can influence how something is serialized in action-type specific ways, but shouldn't fundamentally affect the action that is performed.

to_code_hash(%options)

This returns a list of hashes that can be used to create Action::Code objects.

preference(@possibilities)

This action returns the favored out of @possibilities. Valid values are execute, code, command, flatten. If no arguments are given, the favorite from all valid values is given.

flatten

This action returns all actions behind this action. It may return itself, it may return a long list of actions, it may even return an empty list.

AUTHOR

Leon Timmermans <fawaka@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Leon Timmermans.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.