NAME

Mojo::Script - Script Base Class

SYNOPSIS

use base 'Mojo::Script';

sub run {
    my $self = shift;
    my $data = $self->render_data('foo_bar');
    $self->write_file('/foo/bar.txt', $data);
}

1;
__DATA__
__foo_bar__
% for (1 .. 5) {
    Hello World!
% }

DESCRIPTION

Mojo::Script is a generic base class for scripts.

ATTRIBUTES

description

my $description = $script->description;
$script         = $script->description('Foo!');

quiet

my $quiet = $script->quiet;
$script   = $script->quiet(1);

METHODS

Mojo::Script inherits all methods from Mojo::Base and implements the following new ones.

chmod_file

$script = $script->chmod_file('/foo/bar.txt', 0644);

cwd_dir

my $path = $script->cwd_dir(qw/foo bar/);

cwd_file

my $path = $script->cwd_file(qw/foo bar.html/);

get_data

my $data = $script->get_data('foo_bar');

make_dir

$script = $script->make_dir('/foo/bar/baz');

render_data

my $data = $script->render_data('foo_bar', @arguments);

run

$script = $script->run(@ARGV);

write_file

$script = $script->write_file('/foo/bar.txt', 'Hello World!');