Skip to content

Commit

Permalink
deprecated Mojolicious::Routes del method in favor of the delete method
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Oct 15, 2011
1 parent 8fd45e5 commit 58b176d
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Changes
@@ -1,6 +1,6 @@
This file documents the revision history for Perl extension Mojolicious.

2.0 2011-10-14 00:00:00
2.0 2011-10-15 00:00:00
- Code name "Leaf Fluttering In Wind", this is a major release.
- Increased Perl version requirement to 5.10.1.
- Renamed Mojo::IOLoop::EventEmitter to Mojo::EventEmitter.
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojolicious/Guides/Routing.pod
Expand Up @@ -435,12 +435,12 @@ pass.
# GET /bye -> {controller => 'foo', action => 'bye'}
# POST /bye -> undef
# DELETE /bye -> undef
$r->route('/bye')->via('get')->to(controller => 'foo', action => 'bye');
$r->route('/bye')->via('GET')->to(controller => 'foo', action => 'bye');

# GET /bye -> {controller => 'foo', action => 'bye'}
# POST /bye -> {controller => 'foo', action => 'bye'}
# DELETE /bye -> undef
$r->route('/bye')->via('get', 'post')
$r->route('/bye')->via('GET', 'POST')
->to(controller => 'foo', action => 'bye');

=head2 Nested routes
Expand Down
6 changes: 3 additions & 3 deletions lib/Mojolicious/Lite.pm
Expand Up @@ -38,7 +38,7 @@ sub import {
my $root = $routes;
*{"${caller}::new"} = *{"${caller}::app"} = sub {$app};
*{"${caller}::any"} = sub { $routes->any(@_) };
*{"${caller}::del"} = sub { $routes->del(@_) };
*{"${caller}::del"} = sub { $routes->delete(@_) };
*{"${caller}::get"} = sub { $routes->get(@_) };
*{"${caller}::group"} = sub (&) {
my $old = $root;
Expand Down Expand Up @@ -774,7 +774,7 @@ C<log/$mode.log> file if a C<log> directory exists.
For more control the L<Mojolicious> instance can be accessed directly.
app->log->level('error');
app->routes->route('/foo/:bar')->via('get')->to(cb => sub {
app->routes->route('/foo/:bar')->via('GET')->to(cb => sub {
my $self = shift;
$self->app->log->debug('Got a request for "Hello Mojo!".');
$self->render(text => 'Hello Mojo!');
Expand Down Expand Up @@ -802,7 +802,7 @@ can be easily mixed to make the transition process very smooth.
};
app->routes->namespace('MyApp');
app->routes->route('/foo/:action')->via('get')->to('foo#index');
app->routes->route('/foo/:action')->via('GET')->to('foo#index');
app->start;
Expand Down
21 changes: 15 additions & 6 deletions lib/Mojolicious/Routes.pm
Expand Up @@ -89,7 +89,16 @@ sub auto_render {

sub bridge { shift->route(@_)->inline(1) }

sub del { shift->_generate_route('delete', @_) }
# DEPRECATED in Smiling Face With Sunglasses!
sub del {
warn <<EOF;
Mojolicious::Routes->del is DEPRECATED in favor of
Mojolicious::Routes->delete!!!
EOF
shift->delete(@_);
}

sub delete { shift->_generate_route('delete', @_) }

sub detour {
my $self = shift;
Expand Down Expand Up @@ -790,9 +799,9 @@ Automatic rendering.
Add a new bridge to this route as a nested child.
=head2 C<del>
=head2 C<delete>
my $del = $route->del('/:foo' => sub {...});
my $del = $route->delete('/:foo' => sub {...});
Generate route matching only C<DELETE> requests.
See also the L<Mojolicious::Lite> tutorial for more argument variations.
Expand Down Expand Up @@ -949,9 +958,9 @@ See also the L<Mojolicious::Lite> tutorial for more argument variations.
=head2 C<via>
my $methods = $r->via;
$r = $r->via('get');
$r = $r->via(qw/get post/);
$r = $r->via([qw/get post/]);
$r = $r->via('GET');
$r = $r->via(qw/GET POST/);
$r = $r->via([qw/GET POST/]);
Restrict HTTP methods this route is allowed to handle, defaults to no
restrictions.
Expand Down
2 changes: 1 addition & 1 deletion t/pod_coverage.t
Expand Up @@ -10,7 +10,7 @@ plan skip_all => 'set TEST_POD to enable this test (developer only!)'

# DEPRECATED in Smiling Face With Sunglasses!
my @sunglasses = (
qw/add_after add_before append inner_xml on_finish on_progress on_read/,
qw/add_after add_before append del inner_xml on_finish on_progress on_read/,
qw/on_request on_resume on_start on_upgrade render_inner replace_inner/,
);

Expand Down

0 comments on commit 58b176d

Please sign in to comment.