[Dancer-users] Custom Session Handler issues

David Precious davidp at preshweb.co.uk
Fri May 27 18:15:17 CEST 2011

[resending to list, as I realised I sent it direct approximately one 
ohnosecond after clicking send]

On Friday 27 May 2011 17:04:35 J. Bobby Lopez wrote:
> I took a look at the code you have for the CGISession implementation, it
> looks fairly straight forward.
> A couple of questions though:
>    1. Does using Dancer::ModuleLoader->load('CGI::Session') mean that we
>    should have access to all objects and methods exported by CGI::Session?
> For example, can I access CGI->self_url() somehow?

The plugin loads CGI::Session, so anything that CGI::Session exports by 
default would be exported into the *plugin*'s namespace.  (The plugin could 
skip using Dancer::ModuleLoader and just "use CGI::Session ();" directly, to 
avoid anything being exported).

The plugin could provide a keyword like, say, cgi_session() that would give 
you direct access to the CGI::Session object, should you need to do things 
with it directly.

I'm not sure why you'd want to use CGI.pm within a Dancer app, personally, nor 
would I be sure it would work appropriately either, especially if it expects 
to use STDIN and STDOUT.

>    2. Would I be able to access Dancer settings and variables form a
>    sub-module?  E.g.:  Is there any way to access Dancer's 'cookies' or
>    'session' info from a module, without having to pass them as arguments
> to my module?

Any module that imports Dancer syntax with "use Dancer qw(:syntax)" would be 
able to use them.


Dave P

David Precious  ("bigpresh")

   "Programming is like sex. One mistake and you have to support
   it for the rest of your life". (Michael Sinz)

More information about the Dancer-users mailing list