in reply to Setting referer with HTTP::Request and LWP::UserAgent

If all you want is a redirect, why use LWP?
use CGI; print CGI->header( -nph =>1, -Referer => 'http://www.northwindtraders.com/login.html', -location => 'www.mydomain.com/foo/page.htm', ); __END__ HTTP/1.0 200 OK Server: cmdline Date: Sat, 07 Mar 2009 15:38:40 GMT Location: www.mydomain.com/foo/page.htm Referer: http://www.northwindtraders.com/login.html Content-Type: text/html

Replies are listed 'Best First'.
Re^2: Setting referer with HTTP::Request and LWP::UserAgent
by punch_card_don (Curate) on Mar 07, 2009 at 16:46 UTC
    That's very cool, so I put it in myscript.pl:
    #!/usr/bin/perl -w use strict; use CGI; print CGI->header( -nph =>1, -Referer => 'http://www.northwindtraders.com/login.html', -location => 'www.mydomain.com', );
    I get the exact same output from the command line - huge step forward, thanks - but surfing to the script with a browser still produces Internal Server Error.

    What am I missing?

        Actually, I just noticed this before the rest of the output from the command line:

        "Use of uninitialized value in string ne at (eval 3) line 29"

        even though there's no line 29 in my script - what I posted is all there is.