Skip to content

Commit

Permalink
add ->route
Browse files Browse the repository at this point in the history
  • Loading branch information
miyagawa committed Oct 23, 2009
1 parent 4a00fce commit 24d7487
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/Tatsumaki/Application.pm
Expand Up @@ -20,14 +20,20 @@ around BUILDARGS => sub {
my @rules;
while (my($path, $handler) = splice @$handlers, 0, 2) {
$path = qr/^$path/ unless ref $path eq 'RegExp';
push @rules, { path => $path, handler => $handler };
push @rules, { path => $path, handler => $handler }};
}
$class->$orig(_rules => \@rules, @_);
} else {
$class->$orig(@_);
}
};

sub route {
my($self, $path, $handler) = @_;
$path = qr/^$path/ unless ref $path eq 'RegExp';
push @{$self->{_rules}, { path => $path, handler => $handler }};
}

sub dispatch {
my($self, $path) = @_;

Expand Down

0 comments on commit 24d7487

Please sign in to comment.