[dancer-users] Calling CGI Script From Dancer Application

Amelia Ireland aireland at lbl.gov
Thu Mar 3 20:09:38 GMT 2016


Hi Brent,

There are several Plack modules that allow you to run CGIs in a Plack/PSGI
environment; have a look at the articles for days 10 and 9 in the Plack
advent calendar for details of the different options:

http://advent.plackperl.org/2009/12/page/2/  (towards the bottom of the
page)

Amelia.


On 3 March 2016 at 11:44, <Brent.N.Jones at wellsfargo.com> wrote:

> I have a need to call a CGI script that resides in cgi-bin from a Dancer
> application.  My CGI application is simple:
>
> use CGI;
> use JSON;
>
> my $cgi = new CGI();
> print $cgi->header();
>
> # Get the CSRF Token fnd the user rom cookie
> my $CSRFToken = `/apps/www/cgi-bin/rsacookie -g -CSRFToken`;
> my $user = `/apps/www/cgi-bin/rsacookie -g -user`;
>
> my %rec_hash = ('token'=>$CSRFToken, 'user'=>$user );
> my $json = encode_json \%rec_hash;
> print $json;
>
> The rsacookie is a binary that reads a client side cookie from an
> authenticated user. The Dancer application is secured by RSA’s web agent.
> The agent writes a cookie that can only be read by the rsacookie applet.
> Once I authenticate with the agent, the above script works when called from
> the cgi-bin directory in a different browser tab/window, however when I
> call the script from within Dancer the rsacookie applet cannot find a valid
> cookie.  Since the rsacookie applet requires to be ran in the CGI
> environment, how can I call it from Dancer and maintain the CGI env?  My
> dancer app is deployed with Plack/PSGI.
>
> Thanks.
> Brent
>
>
>
> _______________________________________________
> 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/20160303/12fbeee3/attachment.html>


More information about the dancer-users mailing list