[dancer-users] Tiny problem with sessions in a Dancer2 plugin

Cymon cymon.ML at gmail.com
Sun Sep 29 14:19:27 BST 2013


> 
> Is there a way to add routes inside a plugin, on init or something
> like that? Or perhaps it's something else I've missed?
> 
> Any reply or pointers appreciated.

Hi,
I have no time to try your code now and help you with your issue, but I
can answer this.

To add routes inside a plugin just define the on_plugin_import sub in
your plugin package as this.

on_plugin_import {
     my $dsl = shift;
     my $controller = sub { ...do things ... }
     $dsl->any(['get'] => '/your/path', $controller);
}


-- 
Cymon
http://perlishscrewdriver.blogspot.it/


More information about the dancer-users mailing list