I receiving this error below when I try to send to a secure site using the post method, and the redirect fails coming back.

I using perl, v5.6.1 and LWP with Crypt::SSLeay installed. Here's the error and my code below. Does any one know a solution, thanks in advance.

ERROR: Can't locate object method "requests_redirectable" via package "LWP::UserAgent" (perhaps you forgot to load "LWP::UserAgent"?) at /home/tranx/cgi-bin/clearinghouse.pl line 39 Its complaining about this line: push @{$ua->requests_redirectable}, 'POST';

#!/usr/bin/perl #This Perl script sends a secure HTTP POST Method data #to authenticate to the National Student Clearinghouse #This process only works using the POST Http method. #Username, Social Security Number, and Password are sent to the Cleari +nghouse #Site. print "Content-type: text/html\n\n"; #Perl Modules that are used in this script use strict; use CGI; #use HTTP::Request::Common qw(POST); use HTTP::Request; use HTTP::Response; use LWP::UserAgent; my $query = CGI->new(); my $username = $query->param('user_id'); my $ssn = $query->param('qu'); my $password = $query->param('password'); #Referral link that must match what Clearinghouse has recorded #that we are referring to them from. my $referer = 'https://lamp1s.isu.edu/cgi-bin/clearinghouse.pl'; #Secure Clearhousing Link that the student content is validated at. my $destURL = 'https://www.studentclearinghouse.org/secure_area/ref_st +udents.asp'; #Creating Virtual server connection my $ua = new LWP::UserAgent; #Defining the browser were using $ua->agent('Mozilla/5.0 [en] (Windows NT 5.1; U)'); #Create the HTTP POST Secure URL link my $request = HTTP::Request->new(POST => $destURL); $request->content_ +type('application/x-www-fo rm-urlencoded');$request->content('user_id='.$username.'&password='.$p +assword.'&qu='.$ssn);$requ est->referer($referer); #Turning on redirect with the POST Method only push @{$ua->requests_redirectable}, 'POST'; #Submitting the link for verfication my $response = $ua->request($request); #Verifying if everthing worked, if not #an error will be generated back to the browser. #If everything worked Student should be #logged into the National Student Clearing House Site if (! $response->is_success) { print <<EOF; <html> <head> <title>Transcript Verification Request</title> </head> <body> <div align="center"> <h1>Error submitting to Student Clearinghouse</h1> EOF print $ua->is_protocol_supported( 'https' ). "<BR>"; print <<EOF; </div> </body> </html> EOF } else { print $response->content; } exit;

Edit by castaway - added code tags


In reply to Lwp:UserAgent Error by koryw

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.