Skip to content

Commit

Permalink
deprecated Mojolicious::Routes::Route::bridge in favor of Mojolicious…
Browse files Browse the repository at this point in the history
…::Routes::Route::under
  • Loading branch information
kraih committed Jan 13, 2015
1 parent 3b7f5d8 commit 4701608
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 31 deletions.
4 changes: 3 additions & 1 deletion Changes
@@ -1,5 +1,7 @@

5.73 2015-01-13
5.73 2015-01-14
- Deprecated Mojolicious::Routes::Route::bridge in favor of
Mojolicious::Routes::Route::under.
- Removed deprecated object-oriented Mojo::JSON API.
- Removed deprecated stringification support from Mojo::Collection.
- Removed deprecated support for data arguments from Mojo::JSON::Pointer.
Expand Down
21 changes: 6 additions & 15 deletions lib/Mojolicious/Routes/Route.pm
Expand Up @@ -32,7 +32,12 @@ sub add_child {

sub any { shift->_generate_route(ref $_[0] eq 'ARRAY' ? shift : [], @_) }

sub bridge { shift->route(@_)->inline(1) }
# DEPRECATED in Tiger Face!
sub bridge {
Mojo::Util::deprecated 'Mojolicious::Routes::Route::bridge is DEPRECATED in'
. ' favor of Mojolicious::Routes::Route::under';
shift->route(@_)->inline(1);
}

sub delete { shift->_generate_route(DELETE => @_) }

Expand Down Expand Up @@ -302,20 +307,6 @@ more argument variations.
$r->any('/user')->to('user#whatever');
=head2 bridge
my $route = $r->bridge;
my $route = $r->bridge('/:action');
my $route = $r->bridge('/:action', action => qr/\w+/);
my $route = $r->bridge(format => 0);
Low-level generator for nested routes with their own intermediate destination,
returns a L<Mojolicious::Routes::Route> object.
my $auth = $r->bridge('/user')->to('user#auth');
$auth->get('/show')->to('#show');
$auth->post('/create')->to('#create');
=head2 delete
my $route = $r->delete('/:foo');
Expand Down
14 changes: 7 additions & 7 deletions t/mojolicious/lib/MojoliciousTest.pm
Expand Up @@ -68,8 +68,8 @@ sub startup {
$r->route('/exceptional/:action')->to('exceptional#');

# /exceptional_too/*
$r->bridge('/exceptional_too')->to('exceptional#this_one_might_die')
->route('/:action');
$r->route('/exceptional_too')->inline(1)
->to('exceptional#this_one_might_die')->route('/:action');

# /fun/time
$r->fun('/time')->to('foo#fun');
Expand Down Expand Up @@ -128,13 +128,13 @@ sub startup {
# /withblock (template with blocks)
$r->route('/withblock')->to('foo#withBlock');

# /staged (authentication with bridges)
my $b = $r->bridge('/staged')->to('foo#stage1', return => 1);
# /staged (authentication with intermediate destination)
my $b = $r->route('/staged')->inline(1)->to('foo#stage1', return => 1);
$b->route->to(action => 'stage2');

# /suspended (suspended bridge)
$r->bridge('/suspended')->to('foo#suspended')->bridge->to('foo#suspended')
->route->to('foo#fun');
# /suspended (suspended intermediate destination)
$r->route('/suspended')->inline(1)->to('foo#suspended')->route->inline(1)
->to('foo#suspended')->route->to('foo#fun');

# /longpoll (long polling)
$r->route('/longpoll')->to('foo#longpoll');
Expand Down
14 changes: 7 additions & 7 deletions t/mojolicious/routes.t
Expand Up @@ -57,10 +57,10 @@ $r->route('/:controller/testedit')->to(action => 'testedit');
$test->route('/delete/(id)', id => qr/\d+/)->to(action => 'delete', id => 23);

# /test2
my $test2 = $r->bridge('/test2/')->to(controller => 'test2');
my $test2 = $r->route('/test2/')->inline(1)->to(controller => 'test2');

# /test2 (inline)
my $test4 = $test2->bridge('/')->to(controller => 'index');
my $test4 = $test2->route('/')->inline(1)->to(controller => 'index');

# /test2/foo
$test4->route('/foo')->to(controller => 'baz');
Expand Down Expand Up @@ -122,10 +122,10 @@ $r->route('/format7', format => [qw(foo foobar)])->to('perl#rocks');

# /articles/1/edit
# /articles/1/delete
my $bridge = $r->bridge('/articles/:id')
my $inline = $r->route('/articles/:id')->inline(1)
->to(controller => 'articles', action => 'load', format => 'html');
$bridge->route('/edit')->to(controller => 'articles', action => 'edit');
$bridge->route('/delete')
$inline->route('/edit')->to(controller => 'articles', action => 'edit');
$inline->route('/delete')
->to(controller => 'articles', action => 'delete', format => undef)
->name('articles_delete');

Expand Down Expand Up @@ -213,7 +213,7 @@ $r->route('/partial')->detour('foo#bar');

# GET /similar/*
# POST /similar/too
my $similar = $r->bridge('/similar');
my $similar = $r->route('/similar')->inline(1);
$similar->route('/:something')->via('GET')->to('similar#get');
$similar->route('/too')->via('POST')->to('similar#post');

Expand Down Expand Up @@ -711,7 +711,7 @@ is_deeply $m->stack, [{controller => 'test-test', action => 'test'}],
is $m->path_for->{path}, '/simple/form', 'right path';
is $m->path_for('current')->{path}, '/simple/form', 'right path';

# Special edge case with nested bridges (regex)
# Special edge case with intermediate destinations (regex)
$m = Mojolicious::Routes::Match->new(root => $r);
$m->match($c => {method => 'GET', path => '/regex/alternatives/foo'});
is_deeply $m->stack,
Expand Down
2 changes: 1 addition & 1 deletion t/pod_coverage.t
Expand Up @@ -8,6 +8,6 @@ plan skip_all => 'Test::Pod::Coverage 1.04 required for this test!'
unless eval 'use Test::Pod::Coverage 1.04; 1';

# DEPRECATED in Tiger Face!
my @tiger = qw(siblings);
my @tiger = qw(bridge siblings);

all_pod_coverage_ok({also_private => [@tiger]});

0 comments on commit 4701608

Please sign in to comment.