Changeset 26982
- Timestamp:
- 12/18/08 08:57:53 (4 years ago)
- Location:
- lang/perl/HTTP-Router/branches/merb-like
- Files:
-
- 7 modified
-
lib/HTTP/Router/Route.pm (modified) (3 diffs)
-
t/10_route_match.t (modified) (1 diff)
-
t/11_route_captures.t (modified) (1 diff)
-
t/13_route_conditions.t (modified) (1 diff)
-
t/14_route_uri_for.t (modified) (1 diff)
-
t/20_define_match.t (modified) (2 diffs)
-
t/Router.pm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/HTTP-Router/branches/merb-like/lib/HTTP/Router/Route.pm
r26975 r26982 3 3 use Moose; 4 4 use MooseX::AttributeHelpers; 5 use UNIVERSAL::can;6 5 use Hash::Merge qw(merge); 7 6 use List::MoreUtils qw(any); … … 51 50 sub match { 52 51 my ($self, $req) = @_; 52 return unless blessed $req; 53 53 54 my $path = UNIVERSAL::can($req,'path') ? $req->path : do {55 if ( UNIVERSAL::can($req, 'uri') and UNIVERSAL::can($req->uri,'path')) {54 my $path = $req->can('path') ? $req->path : do { 55 if ($req->can('uri') and blessed($req->uri) and $req->uri->can('path')) { 56 56 $req->uri->path; 57 57 } … … 115 115 116 116 for my $name (@$conditions) { 117 return 0 unless my $code = UNIVERSAL::can($req,$name);117 return 0 unless my $code = $req->can($name); 118 118 return 0 unless $self->validate($code->(), $self->conditions->{$name}); 119 119 } -
lang/perl/HTTP-Router/branches/merb-like/t/10_route_match.t
r26975 r26982 1 use Test::Base; 1 2 use t::Router; 2 3 use HTTP::Router::Route; -
lang/perl/HTTP-Router/branches/merb-like/t/11_route_captures.t
r26975 r26982 1 use Test::Base; 1 2 use t::Router; 2 3 use HTTP::Router::Route; -
lang/perl/HTTP-Router/branches/merb-like/t/13_route_conditions.t
r26975 r26982 1 use Test::Base; 1 2 use t::Router; 2 3 use HTTP::Router::Route; -
lang/perl/HTTP-Router/branches/merb-like/t/14_route_uri_for.t
r26802 r26982 1 use t::Router;1 use Test::Base; 2 2 use HTTP::Router::Route; 3 3 -
lang/perl/HTTP-Router/branches/merb-like/t/20_define_match.t
r26975 r26982 1 use Test::Base; 1 2 use t::Router; 2 3 use HTTP::Router; … … 48 49 --- conditions: { user_id => qr/^\d+$/, method => 'GET' } 49 50 --- params: { name => 'users' } 50 --- request: { path => '/users/100' }51 --- request: { path => '/users/100', method => 'GET' } 51 52 --- results: { name => 'users', user_id => 100 } -
lang/perl/HTTP-Router/branches/merb-like/t/Router.pm
r26975 r26982 1 1 package t::Router; 2 2 3 use Test::Base -Base;4 use Test::MockObject ();3 use Exporter 'import'; 4 use Test::MockObject; 5 5 6 6 our @EXPORT = qw(create_request); 7 7 8 sub create_request (){8 sub create_request { 9 9 my $params = shift; 10 10 my $req = Test::MockObject->new;
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)