NAME
Mojo::Script - Script Base Class
SYNOPSIS
use base 'Mojo::Script';
sub run {
my $self = shift;
$self->render_to_relative_file('foo_bar', 'foo/bar.txt');
}
1;
__DATA__
__foo_bar__
% for (1 .. 5) {
Hello World!
% }
DESCRIPTION
Mojo::Script is a 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);
chmod_rel_file
chmod_relative_file
$script = $script->chmod_rel_file('foo/bar.txt', 0644);
$script = $script->chmod_relative_file('foo/bar.txt', 0644);
class_to_file
my $file = $script->class_to_file('Foo::Bar');
class_to_path
my $path = $script->class_to_path('Foo::Bar');
create_dir
create_directory
$script = $script->create_dir('/foo/bar/baz');
$script = $script->create_direcory('/foo/bar/baz');
create_rel_dir
create_relative_directory
$script = $script->create_rel_dir('foo/bar/baz');
$script = $script->create_relative_direcory('foo/bar/baz');
get_data
my $data = $script->get_data('foo_bar');
rel_dir
relative_directory
my $path = $script->rel_dir('foo/bar');
my $path = $script->relative_directory('foo/bar');
rel_file
relative_file
my $path = $script->rel_file('foo/bar.txt');
my $path = $script->relative_file('foo/bar.txt');
render_data
my $data = $script->render_data('foo_bar', @arguments);
render_to_file
$script = $script->render_to_file('foo_bar', '/foo/bar.txt');
render_to_rel_file
render_to_relative_file
$script = $script->render_to_rel_file('foo_bar', 'foo/bar.txt');
$script = $script->render_to_relative_file('foo_bar', 'foo/bar.txt');
run
$script = $script->run(@ARGV);
write_file
$script = $script->write_file('/foo/bar.txt', 'Hello World!');
write_rel_file
write_relative_file
$script = $script->write_rel_file('foo/bar.txt', 'Hello World!');
$script = $script->write_relative_file('foo/bar.txt', 'Hello World!');