Peter Stuifzand
and 1 contributors

NAME

Sleep::Routes - From URI to classname.

SYNOPSYS

    my $routes = Sleep::Routes->new([
        { 
            route => qr{/question(?:/(\d+))?$},
            class => 'QA::Question' 
        },
        { 
            route => qr{/question/(\d+)/comments$},
            class => 'QA::Comment' 
        },
    ]);

DESCRIPTION

CLASS METHODS

Sleep::Routes->new([ ROUTES ])

A route should contain at least two entries: route and class. The route is a regular expression which will be matched to an URL. The class should the name of a subclass of Sleep::Resource which will work with the arguments.

METHODS

SELF->resource(URL)

Returns the first route that matched and the variables from the URL that were parsed from it.

SELF->parse_url(URL)

Does the actual check of URL described in resource

BUGS

If you find a bug, please let the author know.

COPYRIGHT

Copyright (c) 2008 Peter Stuifzand. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Peter Stuifzand <peter@stuifzand.eu>