The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WebAPI::DBIC::Resource::Role::Router

VERSION

version 0.001007

DESCRIPTION

This role provides methods to interface with the router.

NAME

WebAPI::DBIC::Resource::Role::Router - interface with the router

METHODS

uri_for

    $absolute_url = $self->uri_for(
        resource_class => $resource_class, # e.g. 'TestSchema::Result::Artist'
        1 => $artist_id                    # key value (first and only in this case)
    );

    ($prefix_path, $relative_path) = $self->uri_for(...);

Uses the router to find a url that matches the given parameter hash. Returns undef if there's no match.

The Plack request env hash is used to get the router ('plack.router') and the script url prefix ('SCRIPT_NAME').

When called in scalar context the absolute url is returned. This is the concatenation of the script url prefix and the relative path matched by the router. When called in list context the two values are returned separately.

AUTHOR

Tim Bunce <Tim.Bunce@pobox.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Tim Bunce.

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