Skip to content

Commit

Permalink
Minor fixes to docs / comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bbrtj committed Oct 8, 2024
1 parent 4a997d0 commit 41e666c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Changes
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Revision history for Kelp
{{$NEXT}}
[New Interface]
- Added after_unrendered hook to Kelp
- Added order key to routes
- Added order attribute and compare method to routes

[Changes]
- Fixed bridge without trailing slash being used for longer routes on the same level
Expand Down
7 changes: 3 additions & 4 deletions lib/Kelp/Routes.pm
Original file line number Diff line number Diff line change
Expand Up @@ -289,14 +289,13 @@ sub match
my $routes = $self->cache->get($key);
if (!defined $routes) {

# Look through all routes, grep the ones that match and sort them by
# 'bridge' and 'pattern'. Perl sort function is stable, meaning it will
# Look through all routes, grep the ones that match and sort them with
# the compare method. Perl sort function is stable, meaning it will
# preserve the initial order of records it considers equal. This means
# that the order of registering routes is crucial when a couple of
# routes are registered with the same pattern: routes defined earlier
# will be run first and the first one to render will end the execution
# chain. If the patterns are not the same, their order will be changed
# by string sorting by patterns.
# chain.
@$routes =
sort { $a->compare($b) }
grep { $_->match($path, $method) } @{$self->routes};
Expand Down

0 comments on commit 41e666c

Please sign in to comment.