Mojo::Command - Command Base Class
use base 'Mojo::Command'; sub run { my $self = shift; $self->render_to_rel_file('foo_bar', 'foo/bar.txt'); } 1; __DATA__ @@ foo_bar % for (1 .. 5) { Hello World! % }
Mojo::Command is an abstract base class for commands.
Mojo::Command implements the following attributes.
description
my $description = $command->description; $command = $command->description('Foo!');
quiet
my $quiet = $command->quiet; $command = $command->quiet(1);
usage
my $usage = $command->usage; $command = $command->usage('Foo!');
Mojo::Command inherits all methods from Mojo::Base and implements the following new ones.
chmod_file
$command = $command->chmod_file('/foo/bar.txt', 0644);
chmod_rel_file
$command = $command->chmod_rel_file('foo/bar.txt', 0644);
class_to_file
my $file = $command->class_to_file('Foo::Bar');
class_to_path
my $path = $command->class_to_path('Foo::Bar');
create_dir
$command = $command->create_dir('/foo/bar/baz');
create_rel_dir
$command = $command->create_rel_dir('foo/bar/baz');
get_all_data
my $all = $command->get_all_data; my $all = $command->get_all_data('Some::Class');
get_data
my $data = $command->get_data('foo_bar'); my $data = $command->get_data('foo_bar', 'Some::Class');
help
$command->help;
rel_dir
my $path = $command->rel_dir('foo/bar');
rel_file
my $path = $command->rel_file('foo/bar.txt');
render_data
my $data = $command->render_data('foo_bar', @arguments);
render_to_file
$command = $command->render_to_file('foo_bar', '/foo/bar.txt');
render_to_rel_file
$command = $command->render_to_rel_file('foo_bar', 'foo/bar.txt'); $command = $command->render_to_rel_file('foo_bar', 'foo/bar.txt');
run
$command = $command->run(@ARGV);
write_file
$command = $command->write_file('/foo/bar.txt', 'Hello World!');
write_rel_file
$command = $command->write_rel_file('foo/bar.txt', 'Hello World!');
Mojolicious, Mojolicious::Book, http://mojolicious.org.
To install Mojolicious, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojolicious
CPAN shell
perl -MCPAN -e shell install Mojolicious
For more information on module installation, please visit the detailed CPAN module installation guide.