Hello community,
here is the log from the commit of package perl-Mojolicious for
openSUSE:Factory checked in at 2020-12-11 20:16:46
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Mojolicious (Old)
and /work/SRC/openSUSE:Factory/.perl-Mojolicious.new.2328 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Mojolicious"
Fri Dec 11 20:16:46 2020 rev:149 rq:854826 version:8.67
Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Mojolicious/perl-Mojolicious.changes
2020-12-01 14:24:02.829675139 +0100
+++
/work/SRC/openSUSE:Factory/.perl-Mojolicious.new.2328/perl-Mojolicious.changes
2020-12-11 20:16:48.716662032 +0100
@@ -1,0 +2,14 @@
+Sun Dec 6 03:08:01 UTC 2020 - Tina Müller <[email protected]>
+
+- updated to 8.67
+ see /usr/share/doc/packages/perl-Mojolicious/Changes
+
+ 8.67 2020-12-04
+ - Deprecated Mojolicious::Routes::Route::route in favor of
Mojolicious::Routes::Route::any.
+ - Deprecated Mojolicious::Routes::Route::over in favor of
Mojolicious::Routes::Route::requires.
+ - Deprecated Mojolicious::Routes::Route::via in favor of
Mojolicious::Routes::Route::methods.
+ - Deprecated Mojolicious::Routes::Route::detour.
+ - Added methods and requires methods to Mojolicious::Routes::Route.
+ - Improved Mojolicious::Commands to throw an exception for invalid
commands.
+
+-------------------------------------------------------------------
Old:
----
Mojolicious-8.66.tar.gz
New:
----
Mojolicious-8.67.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Mojolicious.spec ++++++
--- /var/tmp/diff_new_pack.IZYKWs/_old 2020-12-11 20:16:49.272662263 +0100
+++ /var/tmp/diff_new_pack.IZYKWs/_new 2020-12-11 20:16:49.284662267 +0100
@@ -17,7 +17,7 @@
Name: perl-Mojolicious
-Version: 8.66
+Version: 8.67
Release: 0
%define cpan_name Mojolicious
Summary: Real-time web framework
++++++ Mojolicious-8.66.tar.gz -> Mojolicious-8.67.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.66/Changes new/Mojolicious-8.67/Changes
--- old/Mojolicious-8.66/Changes 2020-11-30 10:37:34.000000000 +0100
+++ new/Mojolicious-8.67/Changes 2020-12-04 21:45:30.000000000 +0100
@@ -1,4 +1,12 @@
+8.67 2020-12-04
+ - Deprecated Mojolicious::Routes::Route::route in favor of
Mojolicious::Routes::Route::any.
+ - Deprecated Mojolicious::Routes::Route::over in favor of
Mojolicious::Routes::Route::requires.
+ - Deprecated Mojolicious::Routes::Route::via in favor of
Mojolicious::Routes::Route::methods.
+ - Deprecated Mojolicious::Routes::Route::detour.
+ - Added methods and requires methods to Mojolicious::Routes::Route.
+ - Improved Mojolicious::Commands to throw an exception for invalid commands.
+
8.66 2020-11-28
- Deprecated logging to "log/$mode.log" (if a log directory exists) in
Mojolicious. The default will simply be STDERR
in the future.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.66/META.json
new/Mojolicious-8.67/META.json
--- old/Mojolicious-8.66/META.json 2020-11-30 11:40:54.000000000 +0100
+++ new/Mojolicious-8.67/META.json 2020-12-05 17:45:02.000000000 +0100
@@ -63,6 +63,6 @@
"web" : "https://webchat.freenode.net/#mojo"
}
},
- "version" : "8.66",
+ "version" : "8.67",
"x_serialization_backend" : "JSON::PP version 4.05"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.66/META.yml
new/Mojolicious-8.67/META.yml
--- old/Mojolicious-8.66/META.yml 2020-11-30 11:40:54.000000000 +0100
+++ new/Mojolicious-8.67/META.yml 2020-12-05 17:45:02.000000000 +0100
@@ -34,5 +34,5 @@
homepage: https://mojolicious.org
license: http://www.opensource.org/licenses/artistic-license-2.0
repository: https://github.com/mojolicious/mojo.git
-version: '8.66'
+version: '8.67'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.66/lib/Mojolicious/Command/routes.pm
new/Mojolicious-8.67/lib/Mojolicious/Command/routes.pm
--- old/Mojolicious-8.66/lib/Mojolicious/Command/routes.pm 2020-11-30
10:38:28.000000000 +0100
+++ new/Mojolicious-8.67/lib/Mojolicious/Command/routes.pm 2020-12-05
17:02:05.000000000 +0100
@@ -27,15 +27,15 @@
# Flags
my @flags;
- push @flags, @{$route->over || []} ? 'C' : '.';
- push @flags, (my $partial = $route->partial) ? 'D' : '.';
+ push @flags, @{$route->requires || []} ? 'C' : '.';
+ push @flags, (my $partial = $route->partial) ? 'P' : '.';
push @flags, $route->inline ? 'U' : '.';
push @flags, $route->is_websocket ? 'W' : '.';
push @$row, join('', @flags) if $verbose;
# Methods
- my $via = $route->via;
- push @$row, !$via ? '*' : uc join ',', @$via;
+ my $methods = $route->methods;
+ push @$row, !$methods ? '*' : uc join ',', @$methods;
# Name
my $name = $route->name;
@@ -73,7 +73,7 @@
-m, --mode <name> Operating mode for your application, defaults to the
value of MOJO_MODE/PLACK_ENV or "development"
-v, --verbose Print additional details about routes, flags indicate
- C=Conditions, D=Detour, U=Under and W=WebSocket
+ C=Conditions, P=Partial, U=Under and W=WebSocket
=head1 DESCRIPTION
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.66/lib/Mojolicious/Commands.pm
new/Mojolicious-8.67/lib/Mojolicious/Commands.pm
--- old/Mojolicious-8.66/lib/Mojolicious/Commands.pm 2020-11-30
10:38:30.000000000 +0100
+++ new/Mojolicious-8.67/lib/Mojolicious/Commands.pm 2020-12-05
17:02:06.000000000 +0100
@@ -57,6 +57,8 @@
return $command->run(@args);
}
+ elsif ($name) { die qq{Invalid command "$name".\n} }
+
# Hide list for tests
return 1 if $ENV{HARNESS_ACTIVE};
@@ -73,6 +75,7 @@
$command =~ s/(?<!^)_/-/g;
push @rows, [" $command", $all{$class}];
}
+
return print $self->message, tablify(\@rows), $self->hint;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.66/lib/Mojolicious/Guides/Cookbook.pod
new/Mojolicious-8.67/lib/Mojolicious/Guides/Cookbook.pod
--- old/Mojolicious-8.66/lib/Mojolicious/Guides/Cookbook.pod 2020-11-10
21:28:04.000000000 +0100
+++ new/Mojolicious-8.67/lib/Mojolicious/Guides/Cookbook.pod 2020-12-05
16:18:45.000000000 +0100
@@ -580,8 +580,7 @@
get '/' => {text => 'Hello World!'};
# Connect application with web server and start accepting connections
- my $daemon
- = Mojo::Server::Daemon->new(app => app, listen => ['http://*:8080']);
+ my $daemon = Mojo::Server::Daemon->new(app => app, listen =>
['http://*:8080']);
$daemon->start;
# Call "one_tick" repeatedly from the alien environment
@@ -1153,7 +1152,9 @@
say 'Title: ', $res->dom->at('head > title')->text;
# Extract headings
- $res->dom('h1, h2, h3')->each(sub ($dom, $i) { say 'Heading: ',
$dom->all_text });
+ $res->dom('h1, h2, h3')->each(sub ($dom, $i) {
+ say 'Heading: ', $dom->all_text;
+ });
# Visit all nodes recursively to extract more than just text
for my $n ($res->dom->descendant_nodes->each) {
@@ -1259,8 +1260,7 @@
my $tx3 = $ua->post('http://search.example.com' => form => {q => 'test'});
# Send "multipart/form-data" content via PUT
- my $tx4 = $ua->put(
- 'upload.example.com' => form => {test => {content => 'Hello World!'}});
+ my $tx4 = $ua->put('upload.example.com' => form => {test => {content =>
'Hello World!'}});
# Send custom multipart content via PUT
my $tx5 = $ua->put('api.example.com' => multipart => ['Hello', 'World!']);
@@ -1294,8 +1294,7 @@
# Upload file via POST and "multipart/form-data"
my $ua = Mojo::UserAgent->new;
- $ua->post('example.com/upload' =>
- form => {image => {file => '/home/sri/hello.png'}});
+ $ua->post('example.com/upload' => form => {image => {file =>
'/home/sri/hello.png'}});
And once again you don't have to worry about memory usage, all data will be
streamed directly from the file.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.66/lib/Mojolicious/Guides/Routing.pod
new/Mojolicious-8.67/lib/Mojolicious/Guides/Routing.pod
--- old/Mojolicious-8.66/lib/Mojolicious/Guides/Routing.pod 2020-10-01
15:18:43.000000000 +0200
+++ new/Mojolicious-8.67/lib/Mojolicious/Guides/Routing.pod 2020-12-05
16:22:15.000000000 +0100
@@ -662,19 +662,19 @@
=head2 Conditions
Conditions such as C<headers>, C<agent> and C<host> from
L<Mojolicious::Plugin::HeaderCondition> can be applied to any
-route with the method L<Mojolicious::Routes::Route/"over">, and allow even
more powerful route constructs.
+route with the method L<Mojolicious::Routes::Route/"requires">, and allow even
more powerful route constructs.
# / (Origin: http://perl.org)
- $r->get('/')->over(headers => {Origin => qr/perl\.org/})->to('foo#bar');
+ $r->get('/')->requires(headers => {Origin => qr/perl\.org/})->to('foo#bar');
# / (Firefox)
- $r->get('/')->over(agent => qr/Firefox/)->to('browser-test#firefox');
+ $r->get('/')->requires(agent => qr/Firefox/)->to('browser-test#firefox');
# / (Internet Explorer)
- $r->get('/')->over(agent => qr/Internet Explorer/)->to('browser-test#ie');
+ $r->get('/')->requires(agent => qr/Internet
Explorer/)->to('browser-test#ie');
# http://docs.mojolicious.org/Mojolicious
- $r->get('/')->over(host => 'docs.mojolicious.org')->to('perldoc#index');
+ $r->get('/')->requires(host => 'docs.mojolicious.org')->to('perldoc#index');
Just be aware that conditions are too complex for the routing cache, which
normally speeds up recurring requests, and
can therefore reduce performance.
@@ -836,7 +836,7 @@
});
# /maybe (25% chance)
- $r->get('/maybe')->over(random => 4)->to('foo#bar');
+ $r->get('/maybe')->requires(random => 4)->to('foo#bar');
Use whatever request information you need.
@@ -852,7 +852,7 @@
});
# /hello?to=world&test=1
- $r->get('/hello')->over(query => {test => 1, to => 'world'})->to('foo#bar');
+ $r->get('/hello')->requires(query => {test => 1, to =>
'world'})->to('foo#bar');
=head2 Condition plugins
@@ -891,8 +891,7 @@
$self->plugin('WerewolfCondition');
# /hideout (keep them out for 4 days after full moon)
- $self->routes->get('/hideout')->over(werewolf => 4)
- ->to(controller => 'foo', action => 'bar');
+ $self->routes->get('/hideout')->requires(werewolf => 4)->to(controller =>
'foo', action => 'bar');
}
1;
@@ -934,12 +933,11 @@
1;
-With the method L<Mojolicious::Routes::Route/"detour"> which is very similar
to L<Mojolicious::Routes::Route/"to">, you
-can allow the route to partially match and use only the remaining path in the
embedded application, the base path will
-be passed along in the C<path> stash value.
+With the attribute L<Mojolicious::Routes::Route/"partial">, you can allow the
route to partially match and use only the
+remaining path in the embedded application, the base path will be passed along
in the C<path> stash value.
# /foo/*
- $r->any('/foo')->detour('bar#', name => 'Mojo');
+ $r->any('/foo')->partial(1)->to('bar#', name => 'Mojo');
A minimal embeddable application is nothing more than a subclass of
L<Mojolicious>, containing a C<handler> method
accepting L<Mojolicious::Controller> objects.
@@ -970,7 +968,7 @@
sub register ($self, $app, $conf) {
# Automatically add route
- $app->routes->any('/foo')->detour(app => EmbeddedApp::app());
+ $app->routes->any('/foo')->partial(1)->to(app => EmbeddedApp::app());
}
package EmbeddedApp;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.66/lib/Mojolicious/Guides/Testing.pod
new/Mojolicious-8.67/lib/Mojolicious/Guides/Testing.pod
--- old/Mojolicious-8.66/lib/Mojolicious/Guides/Testing.pod 2020-08-19
22:42:12.000000000 +0200
+++ new/Mojolicious-8.67/lib/Mojolicious/Guides/Testing.pod 2020-12-05
16:21:11.000000000 +0100
@@ -135,8 +135,7 @@
You can access the user agent directly if you want to make web requests
without triggering test assertions:
- my $tx = $t->ua->post(
- 'https://duckduckgo.com/html' => form => {q => 'hypnotoad'});
+ my $tx = $t->ua->post('https://duckduckgo.com/html' => form => {q =>
'hypnotoad'});
$tx->result->dom->find('a.result__a')->each(sub { say $_->text });
See L<Mojo::UserAgent> for the complete API and return values.
@@ -193,8 +192,7 @@
1..3
ok
All tests successful.
- Files=1, Tests=3, 0 wallclock secs ( 0.03 usr 0.01 sys + 0.33 cusr 0.07
- csys = 0.44 CPU)
+ Files=1, Tests=3, 0 wallclock secs ( 0.03 usr 0.01 sys + 0.33 cusr 0.07
csys = 0.44 CPU)
Result: PASS
The boilerplate test file looks like this:
@@ -267,8 +265,7 @@
my $t = Test::Mojo->new('MyApp');
- is_deeply $t->app->basic_auth(bif => "Bif's Passwerdd"),
- {Authorization => 'Basic YmlmOkJpZidzIFBhc3N3ZXJkZA=='},
+ is_deeply $t->app->basic_auth(bif => "Bif's Passwerdd"), {Authorization =>
'Basic YmlmOkJpZidzIFBhc3N3ZXJkZA=='},
'correct header value';
Any aspect of the application (helpers, plugins, routes, etc.) can be
introspected from L<Test::Mojo> through the
@@ -321,8 +318,7 @@
(except for the callback argument). This allows us to set headers and build
query strings for authentic test
situations:
- $t->get_ok('/internal/personnel' => {Authorization => 'Token
secret-password'}
- => form => {q => 'Professor Plum'});
+ $t->get_ok('/internal/personnel' => {Authorization => 'Token
secret-password'} => form => {q => 'Professor Plum'});
which generates the following request:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.66/lib/Mojolicious/Guides/Tutorial.pod
new/Mojolicious-8.67/lib/Mojolicious/Guides/Tutorial.pod
--- old/Mojolicious-8.66/lib/Mojolicious/Guides/Tutorial.pod 2020-11-28
18:47:21.000000000 +0100
+++ new/Mojolicious-8.67/lib/Mojolicious/Guides/Tutorial.pod 2020-12-05
15:06:05.000000000 +0100
@@ -783,8 +783,7 @@
post '/upload' => sub ($c) {
# Check file size
- return $c->render(text => 'File is too big.', status => 200)
- if $c->req->is_limit_exceeded;
+ return $c->render(text => 'File is too big.', status => 200) if
$c->req->is_limit_exceeded;
# Process uploaded file
return $c->redirect_to('form') unless my $example = $c->param('example');
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.66/lib/Mojolicious/Guides.pod
new/Mojolicious-8.67/lib/Mojolicious/Guides.pod
--- old/Mojolicious-8.66/lib/Mojolicious/Guides.pod 2020-11-09
20:04:57.000000000 +0100
+++ new/Mojolicious-8.67/lib/Mojolicious/Guides.pod 2020-12-05
04:27:27.000000000 +0100
@@ -157,7 +157,7 @@
=back
-=head1 SPIN-OFFS
+=head1 FULL-STACK
These modules are not part of the L<Mojolicious> distribution, but have been
designed to be used with it and are being
developed under the same umbrella.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojolicious-8.66/lib/Mojolicious/Plugin/HeaderCondition.pm
new/Mojolicious-8.67/lib/Mojolicious/Plugin/HeaderCondition.pm
--- old/Mojolicious-8.66/lib/Mojolicious/Plugin/HeaderCondition.pm
2020-11-30 10:38:24.000000000 +0100
+++ new/Mojolicious-8.67/lib/Mojolicious/Plugin/HeaderCondition.pm
2020-12-05 17:02:00.000000000 +0100
@@ -40,14 +40,14 @@
# Mojolicious
$app->plugin('HeaderCondition');
$app->routes->get('/:controller/:action')
- ->over(headers => {Referer => qr/example\.com/});
+ ->requires(headers => {Referer => qr/example\.com/});
# Mojolicious::Lite
plugin 'HeaderCondition';
get '/' => (headers => {Referer => qr/example\.com/}) => sub {...};
# All headers need to match
- $app->routes->get('/:controller/:action')->over(headers => {
+ $app->routes->get('/:controller/:action')->requires(headers => {
'X-Secret-Header' => 'Foo',
Referer => qr/example\.com/
});
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.66/lib/Mojolicious/Plugin/Mount.pm
new/Mojolicious-8.67/lib/Mojolicious/Plugin/Mount.pm
--- old/Mojolicious-8.66/lib/Mojolicious/Plugin/Mount.pm 2020-11-30
10:38:25.000000000 +0100
+++ new/Mojolicious-8.67/lib/Mojolicious/Plugin/Mount.pm 2020-12-05
17:02:01.000000000 +0100
@@ -14,8 +14,8 @@
my $host;
($host, $path) = ($1 ? qr/^(?:.*\.)?\Q$2\E$/i : qr/^\Q$2\E$/i, $3) if $path
=~ m!^(\*\.)?([^/]+)(/.*)?$!;
- my $route = $app->routes->route($path)->detour(app => $embed);
- return $host ? $route->over(host => $host) : $route;
+ my $route = $app->routes->any($path)->partial(1)->to(app => $embed);
+ return $host ? $route->requires(host => $host) : $route;
}
1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.66/lib/Mojolicious/Routes/Match.pm
new/Mojolicious-8.67/lib/Mojolicious/Routes/Match.pm
--- old/Mojolicious-8.66/lib/Mojolicious/Routes/Match.pm 2020-11-30
10:38:30.000000000 +0100
+++ new/Mojolicious-8.67/lib/Mojolicious/Routes/Match.pm 2020-12-05
17:02:06.000000000 +0100
@@ -43,11 +43,11 @@
$captures = $self->{captures};
# Method
- my $methods = $r->via;
+ my $methods = $r->methods;
return undef if $methods && !grep { $_ eq $options->{method} } @$methods;
# Conditions
- if (my $over = $r->over) {
+ if (my $over = $r->requires) {
my $conditions = $self->{conditions} ||= $self->root->conditions;
for (my $i = 0; $i < @$over; $i += 2) {
return undef unless my $condition = $conditions->{$over->[$i]};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.66/lib/Mojolicious/Routes/Route.pm
new/Mojolicious-8.67/lib/Mojolicious/Routes/Route.pm
--- old/Mojolicious-8.66/lib/Mojolicious/Routes/Route.pm 2020-11-30
10:38:29.000000000 +0100
+++ new/Mojolicious-8.67/lib/Mojolicious/Routes/Route.pm 2020-12-05
17:02:06.000000000 +0100
@@ -34,7 +34,11 @@
sub delete { shift->_generate_route(DELETE => @_) }
-sub detour { shift->partial(1)->to(@_) }
+# DEPRECATED!
+sub detour {
+ Mojo::Util::deprecated 'Mojolicious::Routes::Route::detour is DEPRECATED';
+ shift->partial(1)->to(@_);
+}
sub find { shift->_index->{shift()} }
@@ -52,6 +56,14 @@
sub is_websocket { !!shift->{websocket} }
+sub methods {
+ my $self = shift;
+ return $self->{methods} unless @_;
+ my $methods = [map uc($_), @{ref $_[0] ? $_[0] : [@_]}];
+ $self->{methods} = $methods if @$methods;
+ return $self;
+}
+
sub name {
my $self = shift;
return $self->{name} unless @_;
@@ -61,17 +73,11 @@
sub options { shift->_generate_route(OPTIONS => @_) }
+# DEPRECATED!
sub over {
- my $self = shift;
-
- # Routes with conditions can't be cached
- return $self->{over} unless @_;
- my $conditions = ref $_[0] eq 'ARRAY' ? $_[0] : [@_];
- return $self unless @$conditions;
- $self->{over} = $conditions;
- $self->root->cache->max_keys(0);
-
- return $self;
+ Mojo::Util::deprecated
+ 'Mojolicious::Routes::Route::over is DEPRECATED in favor of
Mojolicious::Routes::Route::requires';
+ shift->requires(@_);
}
sub parse {
@@ -100,12 +106,23 @@
sub root { shift->_chain->[0] }
+sub requires {
+ my $self = shift;
+
+ # Routes with conditions can't be cached
+ return $self->{over} unless @_;
+ my $conditions = ref $_[0] eq 'ARRAY' ? $_[0] : [@_];
+ return $self unless @$conditions;
+ $self->{over} = $conditions;
+ $self->root->cache->max_keys(0);
+
+ return $self;
+}
+
+# DEPRECATED!
sub route {
- my $self = shift;
- my $route = $self->add_child(__PACKAGE__->new->parse(@_))->children->[-1];
- my $format = $self->pattern->constraints->{format};
- $route->pattern->constraints->{format} //= 0 if defined $format && !$format;
- return $route;
+ Mojo::Util::deprecated 'Mojolicious::Routes::Route::route is DEPRECATED in
favor of Mojolicious::Routes::Route::any';
+ shift->_route(@_);
}
sub suggested_method {
@@ -113,7 +130,7 @@
my %via;
for my $route (@{$self->_chain}) {
- next unless my @via = @{$route->via || []};
+ next unless my @via = @{$route->methods || []};
%via = map { $_ => 1 } keys %via ? grep { $via{$_} } @via : @via;
}
@@ -151,12 +168,11 @@
sub under { shift->_generate_route(under => @_) }
+# DEPRECATED!
sub via {
- my $self = shift;
- return $self->{via} unless @_;
- my $methods = [map uc($_), @{ref $_[0] ? $_[0] : [@_]}];
- $self->{via} = $methods if @$methods;
- return $self;
+ Mojo::Util::deprecated
+ 'Mojolicious::Routes::Route::via is DEPRECATED in favor of
Mojolicious::Routes::Route::methods';
+ shift->methods(@_);
}
sub websocket {
@@ -196,8 +212,8 @@
elsif (ref $arg eq 'HASH') { %defaults = (%defaults, %$arg) }
}
- my $route = $self->route($pattern,
@constraints)->over(\@conditions)->to(\%defaults);
- $methods eq 'under' ? $route->inline(1) : $route->via($methods);
+ my $route = $self->_route($pattern,
@constraints)->requires(\@conditions)->to(\%defaults);
+ $methods eq 'under' ? $route->inline(1) : $route->methods($methods);
return defined $name ? $route->name($name) : $route;
}
@@ -216,6 +232,14 @@
return {%auto, %custom};
}
+sub _route {
+ my $self = shift;
+ my $route = $self->add_child(__PACKAGE__->new->parse(@_))->children->[-1];
+ my $format = $self->pattern->constraints->{format};
+ $route->pattern->constraints->{format} //= 0 if defined $format && !$format;
+ return $route;
+}
+
1;
=encoding utf8
@@ -351,16 +375,6 @@
# Route with destination
$r->delete('/user')->to('user#remove');
-=head2 detour
-
- $r = $r->detour(action => 'foo');
- $r = $r->detour('controller#action');
- $r = $r->detour(Mojolicious->new, foo => 'bar');
- $r = $r->detour('MyApp', {foo => 'bar'});
-
-Set default parameters for this route and allow partial matching to simplify
application embedding, takes the same
-arguments as L</"to">.
-
=head2 find
my $route = $r->find('foo');
@@ -411,6 +425,18 @@
Check if this route is a WebSocket.
+=head2 methods
+
+ my $methods = $r->methods;
+ $r = $r->methods('GET');
+ $r = $r->methods('GET', 'POST');
+ $r = $r->methods(['GET', 'POST']);
+
+Restrict HTTP methods this route is allowed to handle, defaults to no
restrictions.
+
+ # Route with two methods and destination
+ $r->any('/foo')->methods('GET', 'POST')->to('foo#bar');
+
=head2 name
my $name = $r->name;
@@ -439,19 +465,6 @@
# Route with destination
$r->options('/user')->to('user#overview');
-=head2 over
-
- my $over = $r->over;
- $r = $r->over(foo => 1);
- $r = $r->over(foo => 1, bar => {baz => 'yada'});
- $r = $r->over([foo => 1, bar => {baz => 'yada'}]);
-
-Activate conditions for this route. Note that this automatically disables the
routing cache, since conditions are too
-complex for caching.
-
- # Route with condition and destination
- $r->get('/foo')->over(host => qr/mojolicious\.org/)->to('foo#bar');
-
=head2 parse
$r = $r->parse('/:action');
@@ -521,7 +534,7 @@
$r->find('foo')->remove;
# Reattach route to new parent
- $r->route('/foo')->add_child($r->find('bar')->remove);
+ $r->any('/foo')->add_child($r->find('bar')->remove);
=head2 render
@@ -535,14 +548,18 @@
The L<Mojolicious::Routes> object this route is a descendant of.
-=head2 route
+=head2 requires
- my $route = $r->route;
- my $route = $r->route('/:action');
- my $route = $r->route('/:action', action => qr/\w+/);
- my $route = $r->route(format => 0);
+ my $requires = $r->requires;
+ $r = $r->requires(foo => 1);
+ $r = $r->requires(foo => 1, bar => {baz => 'yada'});
+ $r = $r->requires([foo => 1, bar => {baz => 'yada'}]);
-Low-level generator for routes matching all HTTP request methods, returns a
L<Mojolicious::Routes::Route> object.
+Activate conditions for this route. Note that this automatically disables the
routing cache, since conditions are too
+complex for caching.
+
+ # Route with condition and destination
+ $r->get('/foo')->requires(host => qr/mojolicious\.org/)->to('foo#bar');
=head2 suggested_method
@@ -594,18 +611,6 @@
$auth->get('/show')->to('#show');
$auth->post('/create')->to('#create');
-=head2 via
-
- my $methods = $r->via;
- $r = $r->via('GET');
- $r = $r->via('GET', 'POST');
- $r = $r->via(['GET', 'POST']);
-
-Restrict HTTP methods this route is allowed to handle, defaults to no
restrictions.
-
- # Route with two methods and destination
- $r->route('/foo')->via('GET', 'POST')->to('foo#bar');
-
=head2 websocket
my $route = $r->websocket;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.66/lib/Mojolicious/Routes.pm
new/Mojolicious-8.67/lib/Mojolicious/Routes.pm
--- old/Mojolicious-8.66/lib/Mojolicious/Routes.pm 2020-11-30
10:38:29.000000000 +0100
+++ new/Mojolicious-8.67/lib/Mojolicious/Routes.pm 2020-12-05
17:02:05.000000000 +0100
@@ -212,7 +212,7 @@
# Simple route
my $r = Mojolicious::Routes->new;
- $r->route('/')->to(controller => 'blog', action => 'welcome');
+ $r->any('/')->to(controller => 'blog', action => 'welcome');
# More advanced routes
my $blog = $r->under('/blog');
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojolicious-8.66/lib/Mojolicious/resources/templates/mojo/debug.html.ep
new/Mojolicious-8.67/lib/Mojolicious/resources/templates/mojo/debug.html.ep
--- old/Mojolicious-8.66/lib/Mojolicious/resources/templates/mojo/debug.html.ep
2020-10-28 01:23:19.000000000 +0100
+++ new/Mojolicious-8.67/lib/Mojolicious/resources/templates/mojo/debug.html.ep
2020-12-04 18:54:14.000000000 +0100
@@ -353,7 +353,7 @@
<pre><%= ' ' x $depth %><%= $pattern %></pre>
</td>
<td class="striped value">
- <pre><%= uc(join ',', @{$route->via || []}) || '*' %></pre>
+ <pre><%= uc(join ',', @{$route->methods || []}) || '*' %></pre>
</td>
<td class="striped value">
% my $name = $route->name;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.66/lib/Mojolicious.pm
new/Mojolicious-8.67/lib/Mojolicious.pm
--- old/Mojolicious-8.66/lib/Mojolicious.pm 2020-11-30 10:38:05.000000000
+0100
+++ new/Mojolicious-8.67/lib/Mojolicious.pm 2020-12-05 17:04:44.000000000
+0100
@@ -64,7 +64,7 @@
has validator => sub { Mojolicious::Validator->new };
our $CODENAME = 'Supervillain';
-our $VERSION = '8.66';
+our $VERSION = '8.67';
sub BUILD_DYNAMIC {
my ($class, $method, $dyn_methods) = @_;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.66/t/mojo/morbo.t
new/Mojolicious-8.67/t/mojo/morbo.t
--- old/Mojolicious-8.66/t/mojo/morbo.t 2020-10-24 13:03:56.000000000 +0200
+++ new/Mojolicious-8.67/t/mojo/morbo.t 2020-12-05 17:07:58.000000000 +0100
@@ -17,111 +17,128 @@
use Mojo::Server::Morbo;
use Mojo::UserAgent;
use Socket qw(SO_REUSEPORT SOL_SOCKET);
+use Time::HiRes qw(sleep);
-# Prepare script
+# Start
my $dir = tempdir;
my $script = $dir->child('myapp.pl');
my $subdir = $dir->child('test', 'stuff')->make_path;
my $morbo = Mojo::Server::Morbo->new();
$morbo->backend->watch([$subdir, $script]);
is_deeply $morbo->backend->modified_files, [], 'no files have changed';
+my $started = $dir->child('started1.txt');
$script->spurt(<<EOF);
use Mojolicious::Lite;
+use Mojo::File qw(path);
+use Mojo::IOLoop;
app->log->level('fatal');
+Mojo::IOLoop->next_tick(sub { path('$started')->touch });
+
get '/hello' => {text => 'Hello Morbo!'};
app->start;
EOF
-
-# Start
my $port = Mojo::IOLoop::Server->generate_port;
my $prefix = curfile->dirname->dirname->sibling('script');
my $pid = open my $server, '-|', $^X, "$prefix/morbo", '-l',
"http://127.0.0.1:$port", $script;
-sleep 1 while !_port($port);
-
-# Application is alive
+sleep 0.1 while !_port($port);
my $ua = Mojo::UserAgent->new;
-my $tx = $ua->get("http://127.0.0.1:$port/hello");
-ok $tx->is_finished, 'transaction is finished';
-is $tx->res->code, 200, 'right status';
-is $tx->res->body, 'Hello Morbo!', 'right content';
-
-# Same result
-$tx = $ua->get("http://127.0.0.1:$port/hello");
-ok $tx->is_finished, 'transaction is finished';
-is $tx->res->code, 200, 'right status';
-is $tx->res->body, 'Hello Morbo!', 'right content';
-# Update script without changing size
-my ($size, $mtime) = (stat $script)[7, 9];
-$script->spurt(<<EOF);
+subtest 'Basics' => sub {
+ my $tx = $ua->get("http://127.0.0.1:$port/hello");
+ ok $tx->is_finished, 'transaction is finished';
+ is $tx->res->code, 200, 'right status';
+ is $tx->res->body, 'Hello Morbo!', 'right content';
+
+ $tx = $ua->get("http://127.0.0.1:$port/hello");
+ ok $tx->is_finished, 'transaction is finished';
+ is $tx->res->code, 200, 'right status';
+ is $tx->res->body, 'Hello Morbo!', 'right content';
+};
+
+subtest 'Update script without changing size' => sub {
+ my ($size, $mtime) = (stat $script)[7, 9];
+ $started = $started->sibling('started2.txt');
+ $script->spurt(<<EOF);
use Mojolicious::Lite;
+use Mojo::File qw(path);
+use Mojo::IOLoop;
app->log->level('fatal');
+Mojo::IOLoop->next_tick(sub { path('$started')->touch });
+
get '/hello' => {text => 'Hello World!'};
app->start;
EOF
-is_deeply $morbo->backend->modified_files, [$script], 'file has changed';
-ok((stat $script)[9] > $mtime, 'modify time has changed');
-is((stat $script)[7], $size, 'still equal size');
-sleep 3;
-
-# Application has been reloaded
-$tx = $ua->get("http://127.0.0.1:$port/hello");
-ok $tx->is_finished, 'transaction is finished';
-is $tx->res->code, 200, 'right status';
-is $tx->res->body, 'Hello World!', 'right content';
-
-# Same result
-$tx = $ua->get("http://127.0.0.1:$port/hello");
-ok $tx->is_finished, 'transaction is finished';
-is $tx->res->code, 200, 'right status';
-is $tx->res->body, 'Hello World!', 'right content';
+ is_deeply $morbo->backend->modified_files, [$script], 'file has changed';
+ ok((stat $script)[9] > $mtime, 'modify time has changed');
+ is((stat $script)[7], $size, 'still equal size');
+ sleep 0.1 until -f $started;
+
+ # Application has been reloaded
+ my $tx = $ua->get("http://127.0.0.1:$port/hello");
+ ok $tx->is_finished, 'transaction is finished';
+ is $tx->res->code, 200, 'right status';
+ is $tx->res->body, 'Hello World!', 'right content';
+
+ # Same result
+ $tx = $ua->get("http://127.0.0.1:$port/hello");
+ ok $tx->is_finished, 'transaction is finished';
+ is $tx->res->code, 200, 'right status';
+ is $tx->res->body, 'Hello World!', 'right content';
+};
-# Update script without changing mtime
-($size, $mtime) = (stat $script)[7, 9];
-is_deeply $morbo->backend->modified_files, [], 'no files have changed';
-$script->spurt(<<'EOF');
+subtest 'Update script without changing mtime' => sub {
+ my ($size, $mtime) = (stat $script)[7, 9];
+ is_deeply $morbo->backend->modified_files, [], 'no files have changed';
+ $started = $started->sibling('started3.txt');
+ $script->spurt(<<"EOF");
use Mojolicious::Lite;
+use Mojo::File qw(path);
+use Mojo::IOLoop;
app->log->level('fatal');
-my $message = 'Failed!';
-hook before_server_start => sub { $message = 'Hello!' };
+Mojo::IOLoop->next_tick(sub { path('$started')->touch });
+
+my \$message = 'Failed!';
+hook before_server_start => sub { \$message = 'Hello!' };
-get '/hello' => sub { shift->render(text => $message) };
+get '/hello' => sub { shift->render(text => \$message) };
app->start;
EOF
-utime $mtime, $mtime, $script;
-is_deeply $morbo->backend->modified_files, [$script], 'file has changed';
-ok((stat $script)[9] == $mtime, 'modify time has not changed');
-isnt((stat $script)[7], $size, 'size has changed');
-sleep 3;
-
-# Application has been reloaded again
-$tx = $ua->get("http://127.0.0.1:$port/hello");
-ok $tx->is_finished, 'transaction is finished';
-is $tx->res->code, 200, 'right status';
-is $tx->res->body, 'Hello!', 'right content';
-
-# Same result
-$tx = $ua->get("http://127.0.0.1:$port/hello");
-ok $tx->is_finished, 'transaction is finished';
-is $tx->res->code, 200, 'right status';
-is $tx->res->body, 'Hello!', 'right content';
-
-# New file(s)
-is_deeply $morbo->backend->modified_files, [], 'directory has not changed';
-my @new = map { $subdir->child("$_.txt") } qw/test testing/;
-$_->spurt('whatever') for @new;
-is_deeply $morbo->backend->modified_files, \@new, 'two files have changed';
-$subdir->child('.hidden.txt')->spurt('whatever');
-is_deeply $morbo->backend->modified_files, [], 'directory has not changed
again';
+ utime $mtime, $mtime, $script;
+ is_deeply $morbo->backend->modified_files, [$script], 'file has changed';
+ ok((stat $script)[9] == $mtime, 'modify time has not changed');
+ isnt((stat $script)[7], $size, 'size has changed');
+ sleep 0.1 until -f $started;
+
+ # Application has been reloaded again
+ my $tx = $ua->get("http://127.0.0.1:$port/hello");
+ ok $tx->is_finished, 'transaction is finished';
+ is $tx->res->code, 200, 'right status';
+ is $tx->res->body, 'Hello!', 'right content';
+
+ # Same result
+ $tx = $ua->get("http://127.0.0.1:$port/hello");
+ ok $tx->is_finished, 'transaction is finished';
+ is $tx->res->code, 200, 'right status';
+ is $tx->res->body, 'Hello!', 'right content';
+};
+
+subtest 'New file(s)' => sub {
+ is_deeply $morbo->backend->modified_files, [], 'directory has not changed';
+ my @new = map { $subdir->child("$_.txt") } qw/test testing/;
+ $_->spurt('whatever') for @new;
+ is_deeply $morbo->backend->modified_files, \@new, 'two files have changed';
+ $subdir->child('.hidden.txt')->spurt('whatever');
+ is_deeply $morbo->backend->modified_files, [], 'directory has not changed
again';
+};
subtest 'Broken symlink' => sub {
plan skip_all => 'Symlink support required!' unless eval { symlink '', ''; 1
};
@@ -138,17 +155,16 @@
# Stop
kill 'INT', $pid;
-sleep 1 while _port($port);
+sleep 0.1 while _port($port);
-# Custom backend
-{
+subtest 'Custom backend' => sub {
local $ENV{MOJO_MORBO_BACKEND} = 'TestBackend';
local $ENV{MOJO_MORBO_TIMEOUT} = 2;
my $test_morbo = Mojo::Server::Morbo->new;
isa_ok $test_morbo->backend, 'Mojo::Server::Morbo::Backend::TestBackend',
'right backend';
is_deeply $test_morbo->backend->modified_files, ['always_changed'], 'always
changes';
is $test_morbo->backend->watch_timeout, 2, 'right timeout';
-}
+};
subtest 'SO_REUSEPORT' => sub {
plan skip_all => 'SO_REUSEPORT support required!' unless eval {
_reuse_port() };
@@ -162,14 +178,13 @@
'SO_REUSEPORT socket option';
};
-# Abstract methods
-eval { Mojo::Server::Morbo::Backend->modified_files };
-like $@, qr/Method "modified_files" not implemented by subclass/, 'right
error';
+subtest 'Abstract methods' => sub {
+ eval { Mojo::Server::Morbo::Backend->modified_files };
+ like $@, qr/Method "modified_files" not implemented by subclass/, 'right
error';
+};
sub _port { IO::Socket::INET->new(PeerAddr => '127.0.0.1', PeerPort => shift) }
-sub _reuse_port {
- IO::Socket::INET->new(Listen => 1, LocalPort =>
Mojo::IOLoop::Server->generate_port, ReusePort => 1);
-}
+sub _reuse_port { IO::Socket::INET->new(Listen => 1, LocalPort =>
Mojo::IOLoop::Server->generate_port, ReusePort => 1) }
done_testing();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.66/t/mojolicious/commands.t
new/Mojolicious-8.67/t/mojolicious/commands.t
--- old/Mojolicious-8.66/t/mojolicious/commands.t 2020-11-17
18:03:37.000000000 +0100
+++ new/Mojolicious-8.67/t/mojolicious/commands.t 2020-12-05
16:49:01.000000000 +0100
@@ -94,15 +94,11 @@
}
like $buffer, qr/Usage: APPLICATION COMMAND
\[OPTIONS\].*_test2-command.*cgi.*test-comm/s, 'right output';
-# Commands starting with a dash are not allowed
-$buffer = '';
-{
- open my $handle, '>', \$buffer;
- local *STDOUT = $handle;
+subtest 'Commands starting with a dash are not allowed' => sub {
local $ENV{HARNESS_ACTIVE} = 0;
- $app->start('-test2-command');
-}
-like $buffer, qr/Usage: APPLICATION COMMAND
\[OPTIONS\].*_test2-command.*cgi.*test-comm/s, 'right output';
+ eval { $app->start('-test2-command') };
+ like $@, qr/Invalid command "-test2-command"\./, 'not allowed';
+};
# Do not pick up options for detected environments
{
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.66/t/mojolicious/dispatch.t
new/Mojolicious-8.67/t/mojolicious/dispatch.t
--- old/Mojolicious-8.66/t/mojolicious/dispatch.t 2020-10-24
13:04:26.000000000 +0200
+++ new/Mojolicious-8.67/t/mojolicious/dispatch.t 2020-12-05
16:49:04.000000000 +0100
@@ -107,8 +107,8 @@
my $d = $c->app->routes;
ok $d, 'initialized';
$d->namespaces(['Test']);
-$d->route('/')->over([])->to(controller => 'foo', action => 'home');
-$d->route('/foo/<capture>')->to(controller => 'foo', action => 'bar');
+$d->any('/')->requires([])->to(controller => 'foo', action => 'home');
+$d->any('/foo/<capture>')->to(controller => 'foo', action => 'bar');
# Cache
$c = $app->build_controller;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.66/t/mojolicious/embedded_lite_app.t
new/Mojolicious-8.67/t/mojolicious/embedded_lite_app.t
--- old/Mojolicious-8.66/t/mojolicious/embedded_lite_app.t 2020-10-24
13:04:28.000000000 +0200
+++ new/Mojolicious-8.67/t/mojolicious/embedded_lite_app.t 2020-12-05
16:49:06.000000000 +0100
@@ -89,23 +89,23 @@
get '/hello' => 'works';
-get('/bye' => {name => 'second embedded'})->detour('MyTestApp::Test1');
+get('/bye' => {name => 'second embedded'})->partial(1)->to('MyTestApp::Test1');
-get('/bar' => {name => 'third embedded'})->detour(app => 'MyTestApp::Test1');
+get('/bar' => {name => 'third embedded'})->partial(1)->to(app =>
'MyTestApp::Test1');
-get('/baz')->detour('test1#', name => 'fourth embedded');
+get('/baz')->partial(1)->to('test1#', name => 'fourth embedded');
get('/yada')->to('test1#', name => 'fifth embedded');
get('/yada/yada/yada')->to('test1#', path => '/yada', name => 'sixth
embedded');
-get('/basic')->detour(MyTestApp::Basic->new, test => 'lalala');
+get('/basic')->partial(1)->to(MyTestApp::Basic->new, test => 'lalala');
get '/third/*path' => {app => 'MyTestApp::Test2', name => 'third embedded',
path => '/'};
-app->routes->route('/hello')->detour(TestApp::app())->to(name => 'embedded');
+app->routes->any('/hello')->partial(1)->to(TestApp::app())->to(name =>
'embedded');
-get('/just' => {name => 'working'})->detour('EmbeddedTestApp');
+get('/just' => {name => 'working'})->partial(1)->to('EmbeddedTestApp');
get '/host' => {text => 'main application!'};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.66/t/mojolicious/group_lite_app.t
new/Mojolicious-8.67/t/mojolicious/group_lite_app.t
--- old/Mojolicious-8.66/t/mojolicious/group_lite_app.t 2020-10-24
13:04:30.000000000 +0200
+++ new/Mojolicious-8.67/t/mojolicious/group_lite_app.t 2020-12-05
16:49:08.000000000 +0100
@@ -30,7 +30,7 @@
$c->render(text => $c->session('expiration'));
};
-under('/missing' => sub {1})->route->to('does_not_exist#not_at_all');
+under('/missing' => sub {1})->any->to('does_not_exist#not_at_all');
under '/suspended' => sub {
my $c = shift;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojolicious-8.66/t/mojolicious/lib/MojoliciousTest.pm
new/Mojolicious-8.67/t/mojolicious/lib/MojoliciousTest.pm
--- old/Mojolicious-8.66/t/mojolicious/lib/MojoliciousTest.pm 2020-06-14
18:18:32.000000000 +0200
+++ new/Mojolicious-8.67/t/mojolicious/lib/MojoliciousTest.pm 2020-12-04
22:00:06.000000000 +0100
@@ -49,7 +49,7 @@
$self->routes->add_shortcut(
fun => sub {
my ($r, $append) = @_;
- $r->route("/fun$append");
+ $r->any("/fun$append");
}
);
@@ -60,91 +60,91 @@
# /plugin/upper_case
# /plugin/camel_case (plugins loaded correctly)
my $r = $self->routes;
- $r->route('/plugin/upper_case')->to('foo#plugin_upper_case');
- $r->route('/plugin/camel_case')->to('foo#plugin_camel_case');
+ $r->any('/plugin/upper_case')->to('foo#plugin_upper_case');
+ $r->any('/plugin/camel_case')->to('foo#plugin_camel_case');
# /exceptional/*
- $r->route('/exceptional/:action')->to('exceptional#');
+ $r->any('/exceptional/:action')->to('exceptional#');
# /exceptional_too/*
-
$r->route('/exceptional_too')->inline(1)->to('exceptional#this_one_might_die')->route('/:action');
+
$r->any('/exceptional_too')->inline(1)->to('exceptional#this_one_might_die')->any('/:action');
# /fun/time
$r->fun('/time')->to('foo#fun');
# /happy/fun/time
- $r->route('/happy')->fun('/time')->to('foo#fun');
+ $r->any('/happy')->fun('/time')->to('foo#fun');
# /fun/joy
$r->fun('/joy')->to('foo#joy');
# /stash_config
- $r->route('/stash_config')->to(controller => 'foo', action => 'config',
config => {test => 123});
+ $r->any('/stash_config')->to(controller => 'foo', action => 'config', config
=> {test => 123});
# /test4 (named route for url_for)
- $r->route('/test4/:something')->to('foo#something', something =>
23)->name('something');
+ $r->any('/test4/:something')->to('foo#something', something =>
23)->name('something');
# /somethingtest (refer to another route with url_for)
$r->put('/somethingtest')->to('foo#something');
# /something_missing (refer to a non-existing route with url_for)
- $r->route('/something_missing')->to('foo#url_for_missing');
+ $r->any('/something_missing')->to('foo#url_for_missing');
# /test3 (no class, just a namespace)
- $r->route('/test3')->to(namespace => 'MojoliciousTestController', action =>
'index');
+ $r->any('/test3')->to(namespace => 'MojoliciousTestController', action =>
'index');
# /test2 (different namespace test)
- $r->route('/test2')->to(namespace => 'MojoliciousTest2', controller =>
'Foo', action => 'test');
+ $r->any('/test2')->to(namespace => 'MojoliciousTest2', controller => 'Foo',
action => 'test');
# /test5 (only namespace test)
- $r->route('/test5')->to(namespace => 'MojoliciousTest2::Foo', action =>
'test');
+ $r->any('/test5')->to(namespace => 'MojoliciousTest2::Foo', action =>
'test');
# /test6 (no namespace test)
- $r->route('/test6')->to(namespace => '', controller =>
'mojolicious_test2-foo', action => 'test');
+ $r->any('/test6')->to(namespace => '', controller =>
'mojolicious_test2-foo', action => 'test');
# /test7 (controller class shortcut)
- $r->route('/test7')->to('Foo::Bar#test');
+ $r->any('/test7')->to('Foo::Bar#test');
# /test8 (controller class)
- $r->route('/test8')->to(controller => 'Foo::Bar', action => 'test');
+ $r->any('/test8')->to(controller => 'Foo::Bar', action => 'test');
# /test9 (controller in development namespace)
- $r->route('/test9')->to('bar#index');
+ $r->any('/test9')->to('bar#index');
# /test10 (controller in both namespaces)
- $r->route('/test10')->to('baz#index');
+ $r->any('/test10')->to('baz#index');
# /withblock (template with blocks)
- $r->route('/withblock')->to('foo#withBlock');
+ $r->any('/withblock')->to('foo#withBlock');
# /staged (authentication with intermediate destination)
- my $b = $r->route('/staged')->inline(1)->to('foo#stage1', return => 1);
- $b->route->to(action => 'stage2');
+ my $b = $r->any('/staged')->inline(1)->to('foo#stage1', return => 1);
+ $b->any->to(action => 'stage2');
# /suspended (suspended intermediate destination)
-
$r->route('/suspended')->inline(1)->to('foo#suspended')->route->inline(1)->to('foo#suspended')->route->to('foo#fun');
+
$r->any('/suspended')->inline(1)->to('foo#suspended')->any->inline(1)->to('foo#suspended')->any->to('foo#fun');
# /longpoll (long polling)
- $r->route('/longpoll')->to('foo#longpoll');
+ $r->any('/longpoll')->to('foo#longpoll');
# /shortcut/act
# /shortcut/ctrl
# /shortcut/ctrl-act (shortcuts to controller#action)
- $r->route('/shortcut/ctrl-act')->to('foo#config', config => {test =>
'ctrl-act'});
- $r->route('/shortcut/ctrl')->to('foo#', action => 'config', config => {test
=> 'ctrl'});
- $r->route('/shortcut/act')->to('#config', controller => 'foo', config =>
{test => 'act'});
+ $r->any('/shortcut/ctrl-act')->to('foo#config', config => {test =>
'ctrl-act'});
+ $r->any('/shortcut/ctrl')->to('foo#', action => 'config', config => {test =>
'ctrl'});
+ $r->any('/shortcut/act')->to('#config', controller => 'foo', config => {test
=> 'act'});
# /foo/session (session cookie with domain)
- $r->route('/foo/session')->to('foo#session_domain');
+ $r->any('/foo/session')->to('foo#session_domain');
# /rss.xml (mixed formats)
- $r->route('/rss.xml')->to('foo#bar', format => 'rss');
+ $r->any('/rss.xml')->to('foo#bar', format => 'rss');
# /*/* (the default route)
- $r->route('/<controller>/<action>')->to(action => 'index');
+ $r->any('/<controller>/<action>')->to(action => 'index');
# /just/some/template (embedded template)
- $r->route('/just/some/template')->to(template => 'just/some/template');
+ $r->any('/just/some/template')->to(template => 'just/some/template');
}
1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojolicious-8.66/t/mojolicious/lib/PluginWithEmbeddedApp.pm
new/Mojolicious-8.67/t/mojolicious/lib/PluginWithEmbeddedApp.pm
--- old/Mojolicious-8.66/t/mojolicious/lib/PluginWithEmbeddedApp.pm
2020-05-30 14:04:12.000000000 +0200
+++ new/Mojolicious-8.67/t/mojolicious/lib/PluginWithEmbeddedApp.pm
2020-12-04 22:00:19.000000000 +0100
@@ -3,7 +3,7 @@
sub register {
my ($self, $app) = @_;
- $app->routes->route('/plugin')->detour(PluginWithEmbeddedApp::App::app());
+
$app->routes->any('/plugin')->partial(1)->to(PluginWithEmbeddedApp::App::app());
}
package PluginWithEmbeddedApp::App;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojolicious-8.66/t/mojolicious/lib/PluginWithTemplate.pm
new/Mojolicious-8.67/t/mojolicious/lib/PluginWithTemplate.pm
--- old/Mojolicious-8.66/t/mojolicious/lib/PluginWithTemplate.pm
2020-06-14 18:18:32.000000000 +0200
+++ new/Mojolicious-8.67/t/mojolicious/lib/PluginWithTemplate.pm
2020-12-04 22:00:25.000000000 +0100
@@ -4,7 +4,7 @@
sub register {
my ($self, $app) = @_;
push @{$app->renderer->classes}, __PACKAGE__;
- $app->routes->route('/plugin_with_template')->to(cb => sub {
shift->render('plugin_with_template') });
+ $app->routes->any('/plugin_with_template')->to(cb => sub {
shift->render('plugin_with_template') });
}
1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojolicious-8.66/t/mojolicious/lib/SingleFileTestApp.pm
new/Mojolicious-8.67/t/mojolicious/lib/SingleFileTestApp.pm
--- old/Mojolicious-8.66/t/mojolicious/lib/SingleFileTestApp.pm 2020-05-30
14:04:20.000000000 +0200
+++ new/Mojolicious-8.67/t/mojolicious/lib/SingleFileTestApp.pm 2020-12-04
22:00:32.000000000 +0100
@@ -17,7 +17,7 @@
push @{$self->static->classes}, 'SingleFileTestApp::Foo';
# Helper route
- $self->routes->route('/helper')->to(
+ $self->routes->any('/helper')->to(
cb => sub {
my $c = shift;
$c->render(text => $c->some_plugin);
@@ -25,7 +25,7 @@
);
# The default route
- $self->routes->route('/:controller/:action')->to(action => 'index');
+ $self->routes->any('/:controller/:action')->to(action => 'index');
}
package SingleFileTestApp::Redispatch;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.66/t/mojolicious/routes.t
new/Mojolicious-8.67/t/mojolicious/routes.t
--- old/Mojolicious-8.66/t/mojolicious/routes.t 2020-10-24 13:04:19.000000000
+0200
+++ new/Mojolicious-8.67/t/mojolicious/routes.t 2020-12-05 16:48:57.000000000
+0100
@@ -7,171 +7,171 @@
# /clean
my $r = Mojolicious::Routes->new;
-$r->route('/clean')->to(clean => 1)->name('very_clean');
+$r->any('/clean')->to(clean => 1)->name('very_clean');
# /clean/too
-$r->route('/clean/too')->to(something => 1)->name('very_clean');
+$r->any('/clean/too')->to(something => 1)->name('very_clean');
# /0
-$r->route('0')->to(null => 1);
+$r->any('0')->to(null => 1);
# /alternatives
# /alternatives/0
# /alternatives/test
# /alternatives/23
-$r->route('/alternatives/:foo', foo => [qw(0 test 23)])->to(foo => 11);
+$r->any('/alternatives/:foo', [foo => [qw(0 test 23)]])->to(foo => 11);
# /alternatives2/0
# /alternatives2/test
# /alternatives2/23
-$r->route('/alternatives2/:foo/', foo => [qw(0 test 23)]);
+$r->any('/alternatives2/:foo/', [foo => [qw(0 test 23)]]);
# /alternatives3/foo
# /alternatives3/foobar
-$r->route('/alternatives3/:foo', foo => [qw(foo foobar)]);
+$r->any('/alternatives3/:foo', [foo => [qw(foo foobar)]]);
# /alternatives4/foo
# /alternatives4/foo.bar
-$r->route('/alternatives4/:foo', foo => [qw(foo foo.bar)]);
+$r->any('/alternatives4/:foo', [foo => [qw(foo foo.bar)]]);
# /optional/*
# /optional/*/*
-$r->route('/optional/:foo/:bar')->to(bar => 'test');
+$r->any('/optional/:foo/:bar')->to(bar => 'test');
# /optional2
# /optional2/*
# /optional2/*/*
-$r->route('/optional2/:foo')->to(foo => 'one')->route('/:bar')->to(bar =>
'two');
+$r->any('/optional2/:foo')->to(foo => 'one')->any('/:bar')->to(bar => 'two');
# /*/test
-my $test = $r->route('/:controller/test')->to(action => 'test');
+my $test = $r->any('/:controller/test')->to(action => 'test');
# /*/test/edit
-$test->route('/edit')->to(action => 'edit')->name('test_edit');
+$test->any('/edit')->to(action => 'edit')->name('test_edit');
# /*/testedit
-$r->route('/:controller/testedit')->to(action => 'testedit');
+$r->any('/:controller/testedit')->to(action => 'testedit');
# /*/test/delete/*
-$test->route('/delete/<id>', id => qr/\d+/)->to(action => 'delete', id => 23);
+$test->any('/delete/<id>', [id => qr/\d+/])->to(action => 'delete', id => 23);
# /test2
-my $test2 = $r->route('/test2/')->inline(1)->to(controller => 'test2');
+my $test2 = $r->any('/test2/')->inline(1)->to(controller => 'test2');
# /test2 (inline)
-my $test4 = $test2->route('/')->inline(1)->to(controller => 'index');
+my $test4 = $test2->any('/')->inline(1)->to(controller => 'index');
# /test2/foo
-$test4->route('/foo')->to(controller => 'baz');
+$test4->any('/foo')->to(controller => 'baz');
# /test2/bar
-$test4->route('/bar')->to(controller => 'lalala');
+$test4->any('/bar')->to(controller => 'lalala');
# /test2/baz
-$test2->route('/baz')->to('just#works');
+$test2->any('/baz')->to('just#works');
# /
-$r->route('/')->to(controller => 'hello', action => 'world');
+$r->any('/')->to(controller => 'hello', action => 'world');
# /wildcards/1/*
-$r->route('/wildcards/1/<*wildcard>', wildcard => qr/(?:.*)/)->to(controller
=> 'wild', action => 'card');
+$r->any('/wildcards/1/<*wildcard>', [wildcard => qr/(?:.*)/])->to(controller
=> 'wild', action => 'card');
# /wildcards/2/*
-$r->route('/wildcards/2/*wildcard')->to(controller => 'card', action =>
'wild');
+$r->any('/wildcards/2/*wildcard')->to(controller => 'card', action => 'wild');
# /wildcards/3/*/foo
-$r->route('/wildcards/3/<*wildcard>/foo')->to(controller => 'very', action =>
'dangerous');
+$r->any('/wildcards/3/<*wildcard>/foo')->to(controller => 'very', action =>
'dangerous');
# /wildcards/4/*/foo
-$r->route('/wildcards/4/*wildcard/foo')->to(controller => 'somewhat', action
=> 'dangerous');
+$r->any('/wildcards/4/*wildcard/foo')->to(controller => 'somewhat', action =>
'dangerous');
# /format
# /format.html
-$r->route('/format')->to(controller => 'hello')->to(action => 'you', format =>
'html');
+$r->any('/format')->to(controller => 'hello')->to(action => 'you', format =>
'html');
# /format2.txt
-$r->route('/format2', format => qr/txt/)->to(controller => 'we', action =>
'howdy');
+$r->any('/format2', [format => qr/txt/])->to(controller => 'we', action =>
'howdy');
# /format3.txt
# /format3.text
-$r->route('/format3', format => [qw(txt text)])->to(controller => 'we', action
=> 'cheers');
+$r->any('/format3', [format => [qw(txt text)]])->to(controller => 'we', action
=> 'cheers');
# /format4
# /format4.html
-$r->route('/format4', format => ['html'])->to(controller => 'us', action =>
'yay', format => 'html');
+$r->any('/format4', [format => ['html']])->to(controller => 'us', action =>
'yay', format => 'html');
# /format5
-$r->route('/format5', format => 0)->to(controller => 'us', action => 'wow');
+$r->any('/format5', [format => 0])->to(controller => 'us', action => 'wow');
# /format6
-$r->route('/format6', format => 0)->to(controller => 'us', action => 'doh',
format => 'xml');
+$r->any('/format6', [format => 0])->to(controller => 'us', action => 'doh',
format => 'xml');
# /format7.foo
# /format7.foobar
-$r->route('/format7', format => [qw(foo foobar)])->to('perl#rocks');
+$r->any('/format7', [format => [qw(foo foobar)]])->to('perl#rocks');
# /type/23
# /type/24
$r->add_type(my_num => [23, 24]);
-$r->route('/type/<id:my_num>')->to('foo#bar');
+$r->any('/type/<id:my_num>')->to('foo#bar');
# /articles/1/edit
# /articles/1/delete
-my $inline = $r->route('/articles/:id')->inline(1)->to(controller =>
'articles', action => 'load', format => 'html');
-$inline->route('/edit')->to(controller => 'articles', action => 'edit');
-$inline->route('/delete')->to(controller => 'articles', action => 'delete',
format => undef)->name('articles_delete');
+my $inline = $r->any('/articles/:id')->inline(1)->to(controller => 'articles',
action => 'load', format => 'html');
+$inline->any('/edit')->to(controller => 'articles', action => 'edit');
+$inline->any('/delete')->to(controller => 'articles', action => 'delete',
format => undef)->name('articles_delete');
# GET /method/get
-$r->route('/method/get')->via('GET')->to(controller => 'method', action =>
'get');
+$r->any('/method/get')->methods('GET')->to(controller => 'method', action =>
'get');
# POST /method/post
-$r->route('/method/post')->via('post')->to(controller => 'method', action =>
'post');
+$r->any('/method/post')->methods('post')->to(controller => 'method', action =>
'post');
# POST|GET /method/post_get
-$r->route('/method/post_get')->via(qw(POST get))->to(controller => 'method',
action => 'post_get');
+$r->any('/method/post_get')->methods(qw(POST get))->to(controller => 'method',
action => 'post_get');
# /simple/form
-$r->route('/simple/form')->to('test-test#test');
+$r->any('/simple/form')->to('test-test#test');
# /regex/alternatives/*
-$r->route('/regex/alternatives/:alternatives', alternatives => qr/foo|bar|baz/)
+$r->any('/regex/alternatives/:alternatives', [alternatives => qr/foo|bar|baz/])
->to(controller => 'regex', action => 'alternatives');
# /versioned/1.0/test
# /versioned/1.0/test.xml
# /versioned/2.4/test
# /versioned/2.4/test.xml
-my $versioned = $r->route('/versioned');
-$versioned->route('/1.0')->to(controller => 'bar')->route('/test')->to(action
=> 'baz');
-$versioned->route('/2.4')->to(controller => 'foo')->route('/test')->to(action
=> 'bar');
+my $versioned = $r->any('/versioned');
+$versioned->any('/1.0')->to(controller => 'bar')->any('/test')->to(action =>
'baz');
+$versioned->any('/2.4')->to(controller => 'foo')->any('/test')->to(action =>
'bar');
# /versioned/too/1.0
-my $too = $r->route('/versioned/too')->to('too#');
-$too->route('/1.0')->to('#foo');
-$too->route('/2.0', format => 0)->to('#bar');
+my $too = $r->any('/versioned/too')->to('too#');
+$too->any('/1.0')->to('#foo');
+$too->any('/2.0', [format => 0])->to('#bar');
# /multi/foo.bar
-my $multi = $r->route('/multi');
-$multi->route('/foo.bar', format => 0)->to('just#works');
-$multi->route('/bar.baz')->to('works#too', format => 'xml');
+my $multi = $r->any('/multi');
+$multi->any('/foo.bar', [format => 0])->to('just#works');
+$multi->any('/bar.baz')->to('works#too', format => 'xml');
# /nodetect
# /nodetect2.txt
# /nodetect2.html
-my $inactive = $r->route(format => 0);
-$inactive->route('/nodetect')->to('foo#none');
-$inactive->route('/nodetect2', format => ['txt', 'html'])->to('bar#hyper');
+my $inactive = $r->any('/', [format => 0]);
+$inactive->any('/nodetect')->to('foo#none');
+$inactive->any('/nodetect2', [format => ['txt', 'html']])->to('bar#hyper');
# /target/first
# /target/second
# /target/second.xml
# /source/third
# /source/third.xml
-my $source = $r->route('/source')->to('source#');
-my $first = $source->route(format => 0)->route('/first')->to('#first');
-$source->route('/second')->to('#second');
-my $third = $source->route('/third')->to('#third');
-my $target = $r->remove->route('/target')->to('target#');
+my $source = $r->any('/source')->to('source#');
+my $first = $source->any('/', [format => 0])->any('/first')->to('#first');
+$source->any('/second')->to('#second');
+my $third = $source->any('/third')->to('#third');
+my $target = $r->remove->any('/target')->to('target#');
my $second = $r->find('second');
is $second->render({}), '/source/second', 'right result';
$second->remove;
@@ -180,26 +180,26 @@
is $second->render({}), '/target/second', 'right result';
# /websocket
-$r->websocket('/websocket' => {controller => 'ws'})->route('/')->to(action =>
'just')->route->to(works => 1);
+$r->websocket('/websocket' => {controller => 'ws'})->any('/')->to(action =>
'just')->any->to(works => 1);
# /slash
-$r->route('/slash')->to(controller => 'just')->route('/')->to(action =>
'slash');
+$r->any('/slash')->to(controller => 'just')->any('/')->to(action => 'slash');
# /missing/*/name
# /missing/too
# /missing/too/test
-$r->route('/missing/:/name')->to('missing#placeholder');
-$r->route('/missing/*/name')->to('missing#wildcard');
-$r->route('/missing/too/*', '' => ['test'])->to('missing#too', '' =>
'missing');
+$r->any('/missing/:/name')->to('missing#placeholder');
+$r->any('/missing/*/name')->to('missing#wildcard');
+$r->any('/missing/too/*', ['' => ['test']])->to('missing#too', '' =>
'missing');
# /partial/*
-$r->route('/partial')->detour('foo#bar');
+$r->any('/partial')->partial(1)->to('foo#bar');
# GET /similar/*
# PATCH /similar/too
-my $similar = $r->route('/similar')->via(qw(DELETE GET PATCH))->inline(1);
-$similar->route('/:something')->via('GET')->to('similar#get');
-$similar->route('/too')->via('PATCH')->to('similar#post');
+my $similar = $r->any('/similar')->methods(qw(DELETE GET PATCH))->inline(1);
+$similar->any('/:something')->methods('GET')->to('similar#get');
+$similar->any('/too')->methods('PATCH')->to('similar#post');
# /custom_pattern/test_*_test
my $custom = $r->get->to(four => 4);
@@ -207,10 +207,10 @@
$custom->parse('/custom_pattern/a_{.one}_b/{$two}/{@three}');
# Cached lookup
-my $fast = $r->route('/fast');
+my $fast = $r->any('/fast');
is $r->find('fast'), $fast, 'fast route found';
is $r->lookup('fast'), $fast, 'fast route found';
-my $faster = $r->route('/faster')->name('fast');
+my $faster = $r->any('/faster')->name('fast');
is $r->find('fast'), $faster, 'faster route found';
is $r->lookup('fast'), $fast, 'fast route found';
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.66/t/pod_coverage.t
new/Mojolicious-8.67/t/pod_coverage.t
--- old/Mojolicious-8.66/t/pod_coverage.t 2020-11-19 01:30:56.000000000
+0100
+++ new/Mojolicious-8.67/t/pod_coverage.t 2020-12-05 16:48:56.000000000
+0100
@@ -11,4 +11,4 @@
qw(AWAIT_NEW_FAIL AWAIT_ON_CANCEL AWAIT_ON_READY)
);
-all_pod_coverage_ok({also_private => ['BUILD_DYNAMIC', @await, 'success']});
+all_pod_coverage_ok({also_private => ['BUILD_DYNAMIC', @await, 'detour',
'over', 'route', 'success', 'via']});
_______________________________________________
openSUSE Commits mailing list -- [email protected]
To unsubscribe, email [email protected]
List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette
List Archives:
https://lists.opensuse.org/archives/list/[email protected]