Dancer::Plugin::CORS::Sharing - Helper class for sharing method
version 0.13
In order to use many rules with many routes, this helpers class helps you to organize yourself.
use Dancer::Plugin::CORS; sharing->rule( origin => ..., credentials => 1 ); $route = post '/' => sub { ... }; sharing->add($route);
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(...);
This method defines a optionset. See Dancer::Plugin::CORS::share for a explaination of valid options.
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(...)));
This method clears all previously defined rules.
Dancer::Plugin::CORS
1;
Please report any bugs or feature requests on the bugtracker website https://github.com/zurborg/libdancer-plugin-cors-perl/issues
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
David Zurborg <zurborg@cpan.org>
This software is Copyright (c) 2014 by David Zurborg.
This is free software, licensed under:
The ISC License
To install Dancer::Plugin::CORS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dancer::Plugin::CORS
CPAN shell
perl -MCPAN -e shell install Dancer::Plugin::CORS
For more information on module installation, please visit the detailed CPAN module installation guide.