NAME
Dancer::Plugin::CORS::Sharing - Helper class for sharing keyword
VERSION
Version 0.01
DESCRIPTION
In order to use many rules with many routes, this helpers class helps you to organize yourself.
SYNOPSIS
use Dancer::Plugin::CORS;
sharing->rule(
origin => ...,
credentials => 1
);
$route = post '/' => sub { ... };
sharing->add($route);
METHODS
new
A convient way is to use the implicit form of the module. This means you don't have to call new() self, just start with defining rules and add routes.
When you want more than one ruleset, obtain a new instance by calling new():
my $sharing = sharing->new;
$sharing->rule(...);
$sharing->add(...);
rule(%options)
This method defines a optionset. See Dancer::Plugin::CORS::share for a explaination of valid options.
add(@routes)
This method finally calls Dancer::Plugin::CORS::share for any route. @routes maybe a list of arrayrefs of Dancer::Route objects or paths.
Note: Dancer::Plugin::CRUD::resource returns a hash instead of a list. Use values() to obtain the route objects:
sharing->add(values(resource(...)));
clear
This method clears all previously defined rules.
AUTHOR
David Zurborg, <zurborg@cpan.org>
SEE ALSO
COPYRIGHT & LICENSE
Copyright 2014 David Zurborg, all rights reserved.
This program is released under the following license: open-source