Home: Perl Programming Help: Beginner:
Apache2::Cookie with SSO


May 18, 2016, 6:08 PM

Views: 2109
Apache2::Cookie with SSO

HI, My company uses Ping Federation (UID) to authenticate users. All the cookies and header data is created. Basically I want to harness the already generated header/cookie data by UID, and use that in the pre-existing application. I tried to do the bare minum by using Perl's Apache2::Cookie module to obtain the header and cookie info from SSO. So I tried to put together this small script just. I realize I didn't get to the point of trying to echo/print out the array of header information, but it just results in the error I mentioned below. This is frustrating to me, because based on the cpan docs http://search.cpan.org/~isaac/libapreq2-2.13/glue/perl/lib/Apache2/Cookie.pm#name , what I have should in theory work. Am I completely off here? Should I be using a different module? Any thoughts on this would be greatly appreciated.


use Apache2::Cookie;
use Apache2::Request;
use strict;
use warnings;
use diagnostics;

my $r;

my $j = Apache2::Cookie->new($r);
my @c_in = $j->cookies();

print "Content-type: text/html\n\n";

[error] Can't call method "cookies" on an undefined value at /opt/cloudhost/apache/www/html/testing/auth4.pl line 12.\n


May 21, 2016, 4:25 PM

Views: 2075
Re: [hpg4815] Apache2::Cookie with SSO

You appear to be attempting to instantiate a cookie, not a jar. $j is undefined because Apache2::Cookie::new returns undefined if no name or value attribute was supplied.

my $j = Apache2::Cookie->new($r); 
my $j = Apache2::Cookie::Jar->new($r);