[dancer-users] Tiny problem with sessions in a Dancer2 plugin
Slavik Goltser
slavikg at gmail.com
Tue Oct 1 00:18:32 BST 2013
Doesn't that get ignored in Dancer2?
On Mon, Sep 30, 2013 at 6:51 PM, Cymon <cymon.ML at gmail.com> wrote:
> Hi,
> i tried your code.
>
> Did you remember to add:
>
> register_plugin for_versions => [ 2 ];
>
> at the end of the plugin?
> It will not work without this.
>
> Cymon
> http://perlishscrewdriver.blogspot.it/
>
> Il giorno Sun, 29 Sep 2013 22:55:05 +0530
> "Gideon D'souza" <gidisrael at gmail.com> ha scritto:
>
> > Thank you very much for your time.
> >
> > I tried it. No luck still.
> >
> > If I may bother you so:
> >
> > on_plugin_import {
> > my $dsl = shift;
> > my $controller = sub { ...; ...; $dsl->session(user =>
> > $some_json);} $dsl->any(['get'] => '/your/path', $controller);
> > }
> >
> > in app that uses this plugin:
> >
> > get '/' => sub {
> >
> > if (not defined(session->read('user'))) {
> > ######
> > #session->Read('user') is always undef!!!
> > ######
> > return redirect auth_github_authenticate_url;
> > }
> > };
> >
> > Any clues here?
> >
> >
> > On Sun, Sep 29, 2013 at 6:49 PM, Cymon <cymon.ML at gmail.com> wrote:
> >
> > >
> > > >
> > > > 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/
> > > _______________________________________________
> > > dancer-users mailing list
> > > dancer-users at dancer.pm
> > > http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
> > >
>
>
> --
> Cymon
> Coniglio domina,
> http://www.therabbit.it
> _______________________________________________
> dancer-users mailing list
> dancer-users at dancer.pm
> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20130930/c218e72c/attachment.html>
More information about the dancer-users
mailing list