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