Skip to content

Commit

Permalink
better AUTOLOAD examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Oct 30, 2014
1 parent f03f916 commit 7d3d069
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/Mojolicious.pm
Expand Up @@ -674,8 +674,12 @@ Note that application helpers are always called with a new default controller
object, so they can't depend on or change controller state, which includes
request, response and stash.
# Call helper
$app->log->debug($app->dumper({foo => 'bar'}));
# Longer version
$app->log->debug($app->build_controller->helpers->dumper({foo => 'bar'}));
=head1 BUNDLED FILES
The L<Mojolicious> distribution includes a few files with different licenses
Expand Down
4 changes: 4 additions & 0 deletions lib/Mojolicious/Controller.pm
Expand Up @@ -1016,9 +1016,13 @@ helpers provided by L</"app"> on L<Mojolicious::Controller> objects. This
includes all helpers from L<Mojolicious::Plugin::DefaultHelpers> and
L<Mojolicious::Plugin::TagHelpers>.
# Call helpers
$c->layout('green');
$c->title('Welcome!');
# Longer version
$c->helpers->layout('green');
=head1 SEE ALSO
L<Mojolicious>, L<Mojolicious::Guides>, L<http://mojolicio.us>.
Expand Down
4 changes: 4 additions & 0 deletions lib/Mojolicious/Validator/Validation.pm
Expand Up @@ -249,10 +249,14 @@ In addition to the L</"ATTRIBUTES"> and L</"METHODS"> above, you can also call
validation checks provided by L</"validator"> on
L<Mojolicious::Validator::Validation> objects, similar to L</"check">.
# Call validation checks
$validation->required('foo')->size(2, 5)->like(qr/^[A-Z]/);
$validation->optional('bar')->equal_to('foo');
$validation->optional('baz')->in(qw(test 123));
# Longer version
$validation->required('foo')->check('size', 2,5)->check('like', qr/^[A-Z]/);
=head1 SEE ALSO
L<Mojolicious>, L<Mojolicious::Guides>, L<http://mojolicio.us>.
Expand Down

0 comments on commit 7d3d069

Please sign in to comment.