diff options
Diffstat (limited to 'lib/Narwhal/RouteBuilder/HTTPMethod.pm')
-rw-r--r-- | lib/Narwhal/RouteBuilder/HTTPMethod.pm | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/lib/Narwhal/RouteBuilder/HTTPMethod.pm b/lib/Narwhal/RouteBuilder/HTTPMethod.pm index 9631616..33fe893 100644 --- a/lib/Narwhal/RouteBuilder/HTTPMethod.pm +++ b/lib/Narwhal/RouteBuilder/HTTPMethod.pm @@ -3,21 +3,6 @@ use Moose; with 'OX::RouteBuilder'; -sub import { - my $meta = Class::MOP::class_of(caller); - $meta->add_route_builder( - class => __PACKAGE__, - route_spec => sub { - my $spec = shift; - return if ref($spec); - return unless $spec =~ /^http-method:(\w+)$/; - return { - action => $1, - }; - }, - ); -} - sub compile_routes { my $self = shift; @@ -59,6 +44,16 @@ sub compile_routes { ]; } +sub parse_action_spec { + my $self = shift; + my ($action_spec) = @_; + return if ref($action_spec); + return unless $action_spec =~ /^http-method:(\w+)$/; + return { + action => $1, + }; +} + __PACKAGE__->meta->make_immutable; no Moose; |