Mechanize && meta="Refresh"

"Carl A. Schreiber" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.lwp
Message-ID <[email protected]>
Hi,

How do I get beyond the that meta="Refresh" page.
I konw the answer of Andy Lester in the archive, that
"The address of the META REFRESH should be available to you in the
$mech->links() method."
Yes it is - as you can see below, but how should I use it, all what I 
tried either 
	loads again the login-page to start again or
	loads again that meta-page or 
	looses the session, so re-login is required
So how shall I do it?	

My little piece of code using WWW::Mechanize that logs me in is just:

    use WWW::Mechanize;
    my $mech = WWW::Mechanize->new( agent => 'Linux Konqueror' );
    $mech->get( 'https://acct.server.com/clx/index.php?part=logoff&noclose=true' );
    $mech->success or die "Can't get this url $url\n\n";
    # ok, got the login page..
    my $r = $mech->submit_form(
        fields      => {
            $uFld    => $uNme,
            $pFld    => $pPwd
        }
    );
    die "Couldn't submit form" unless $r->is_success;
    # ok, being here, submit was successfull
    # and this is what I've got
    print $r->content # prints this
      #<html><head>
      #<meta http-equiv="Refresh" 
      #content="0;url=index.php?part=menu&justloggedin=true">
      #</head><body><a 
      #href="index.php?part=menu&justloggedin=true"></a></body></html>

 If I do one of these:
    $mech->follow_link(n=>0);
    $mech->follow_link(n=>1);
I loose the session (need to re-login) and get:
    #<html><head>
    #<meta http-equiv="Refresh" content="0;url=index.php?part=timeout">
    #</head>
    #<body>Session lost<br>
    #<a href="index.php?part=timeout">
    #Click here to go back to the login pa+ge</a>
    #<a href="index.php?part=timeout"></a></body></html>


 If I try to create the url by myself by
 Step 1: 
    print join('; ',@{${$mech->links()}[0]}),"\n\n";
    print join('; ',@{${$mech->links()}[1]}),"\n";

gives me for [0] the mate-url: 
    # index.php?part=menu&justloggedin=true; ; ; meta;
    # https://acct.server.com/clx/index.php; HASH(0x864c5f8)
and for the second url at [1]
    # index.php?part=menu&justloggedin=true; ; ; a;
    # https://acct.server.com/clx/index.php; HASH(0x86168bc)

So I just try: 
    $mech->get( 'https://acct.server.com/clx/index.php?part=menu&justloggedin=true' )
and again the session is lost => re-login.

And even what I have found for WWW-Mechanize 
(http://rt.cpan.org/Public/Bug/Display.html?id=12882) 
      print $mech->response->request->uri;
 shows: 
    # https://acct.server.com/clx/index.php 
which ist the base not what I need   and therefore this:
     $mech->get ( $mech->response->request->uri );
only reloads the first login-form and not what I want.


If I do a reload after submitting the form,
    $mech->reload();
it just reloads the meta="Refresh.. page.

 Anybody with an idea how I can get beyond this "meta-page"? 

 Thanks a lot in advance;
 Carl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.