View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Daisuke Maki > Canella-0.05 > Canella::DSL



Annotate this POD


View/Report Bugs


Canolla::DSL - DSL For Canolla File


    use Canolla::DSL;


call $task_name [, $task_name ...]

Executes the given task name


Returns the current task object.


Returns the current remote object, if available

get $name

Return the variable of the parameter pointed by $name. Parameters can be set by calling set(), or by specifying them from the canella command line.

on_finish \&code

Executes the given \&code at the end of the task.

TODO: Currently this does not run the commands remotely even when you set on_finish() inside remote().

TODO: Order of execution is not guaranteed. Need to either fix it or document it

role $name, @spec;

    role 'www' => (
        hosts => [ qw(host1 host2 host3) ]

    role 'www' => (
        hosts => sub { ... dynamically load hosts },

    role 'www' => (
        hosts => ...,
        params => { ... local parameters ... }

remote \&code, $host

Specifies that within the given block \&code, run() commands are run on the host specified by $host

run @cmd

Executes @cmd. If called inside a remote() block, the command will be executed on the remote host. Otherwise it will be executed locally

run_local @cmd

Executes @cmd, but always do so on the local machine, regardless of context.

scp_get @args

Calls Net::OpenSSH::scp_get on the currently connected host. Must be called inside a remote() block

scp_put @args

Calls Net::OpenSSH::scp_put on the currently connected host. Must be called inside a remote() block

set $name, $value

Sets the parameter $name to point to $value

sudo \&code

All run() requests will be executed with a "sudo" appended.

    remote {
        sudo { run "ls" };
    } $host;

is equivalent to ssh $host 'sudo ls'

doc $section, $string

Register a document (POD) section for this deploy file, which will be displayed in 'help' mode.

Section name "SYNOPSIS" is treated differently: it is displayed at the top. All other sections are appended later in the displayed message.

task $name, \&code or task $name, %args

Declare a new task. There's no notion of hierarchical tasks, but you can always declare them by hand:

    task "setup:perl" => sub { ... };
    task "setup:nginx" => sub { ... };

In the second form, you can pass more parameters to the task:

code => \&code

Required. The task code.

description => $description

Optional parameter to set description/documentation for this task, which will be used for help and dump modes

syntax highlighting: