Skip to content

Commit

Permalink
added command recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Aug 21, 2011
1 parent 89e14c4 commit 139f89e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Changes
@@ -1,5 +1,8 @@
This file documents the revision history for Perl extension Mojolicious.

1.87 2011-08-22 00:00:00
- Improved documentation.

1.86 2011-08-21 00:00:00
- Deprecated camel case command modules and lowercased all the
built-in ones.
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious.pm
Expand Up @@ -34,7 +34,7 @@ has static => sub { Mojolicious::Static->new };
has types => sub { Mojolicious::Types->new };

our $CODENAME = 'Smiling Face With Sunglasses';
our $VERSION = '1.86';
our $VERSION = '1.87';

# "These old doomsday devices are dangerously unstable.
# I'll rest easier not knowing where they are."
Expand Down
25 changes: 25 additions & 0 deletions lib/Mojolicious/Guides/Cookbook.pod
Expand Up @@ -502,6 +502,31 @@ variable to take advantage of multiple cpu cores and run tests parallel.
The C<j5> allows 5 tests to run at the same time, which makes for example the
L<Mojolicious> test suite finish 3 times as fast on a dual core laptop!

=head2 Adding Commands To Mojolicious

By now you've propably used many of the built-in commands described in
L<Mojolicious::Commands>, but did you know that you can just add new ones and
that they will be picked up automatically by the command line interface?

package Mojolicious::Command::echo;
use Mojo::Base 'Mojo::Command';

sub run {
my ($self, $whatever) = @_;
print "Echo: $whatever";
}

1;

There are many more useful methods and attributes in L<Mojo::Command> that
you can use or overload.

$ mojo echo test123
Echo: test123

$ ./myapp.pl echo test123
Echo: test123

=head2 Running Code Against Your Application

Ever thought about running a quick oneliner against your L<Mojolicious>
Expand Down

0 comments on commit 139f89e

Please sign in to comment.