Navigation Menu

Skip to content

Commit

Permalink
improve ojo to enable subroutine signatures automatically on Perl 5.20+
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Oct 31, 2017
1 parent c746560 commit 0dca85a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions Changes
Expand Up @@ -2,6 +2,7 @@
7.51 2017-10-31
- Added -signatures flag to Mojo::Base and Mojolicious::Lite.
- Added support for new HTTP status code.
- Improved ojo to enable subroutine signatures automatically on Perl 5.20+.

7.50 2017-10-30
- Deprecated error and finish events in Mojo::IOLoop::Delay. Since there is no
Expand Down
6 changes: 6 additions & 0 deletions lib/ojo.pm
Expand Up @@ -17,6 +17,7 @@ sub import {
# Mojolicious::Lite
my $caller = caller;
eval "package $caller; use Mojolicious::Lite; 1" or die $@;
Mojo::Base->import(-strict, $] < 5.020 ? () : (-signatures));
my $ua = $caller->app->ua;
$ua->server->app->hook(around_action => sub { local $_ = $_[1]; $_[0]() });

Expand Down Expand Up @@ -71,6 +72,11 @@ Every L<ojo> one-liner is also a L<Mojolicious::Lite> application.
$ perl -Mojo -E 'get "/" => {inline => "%= time"}; app->start' get /
On Perl 5.20+ L<subroutine signatures|perlsub/"Signatures"> will be enabled
automatically.
$ perl -Mojo -E 'a(sub ($c) { $c->render(text => 'Hello!') })->start' get /
If it is not already defined, the C<MOJO_LOG_LEVEL> environment variable will
be set to C<fatal>.
Expand Down

0 comments on commit 0dca85a

Please sign in to comment.