Thanks for that, makes things a little clearer.

The reason why I wanted to use CGI; was to get access to CGI->cookie.  But from what you're saying (if I understand correctly), I should be abel to 'use Dancer qw(:syntax)', and I'll have access to the same 'cookies' method that the Dancer core app does.


On Fri, May 27, 2011 at 12:15 PM, David Precious <davidp@preshweb.co.uk> wrote:
[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.

Cheers

Dave P


--
David Precious  ("bigpresh")
http://www.preshweb.co.uk/

  "Programming is like sex. One mistake and you have to support
  it for the rest of your life". (Michael Sinz)
_______________________________________________
Dancer-users mailing list
Dancer-users@perldancer.org
http://www.backup-manager.org/cgi-bin/listinfo/dancer-users