Hi,

Looks like you're moving in the right direction. BTW - forgot to mention that mech->success is easier than checking the HTTP status code.

Checking mech->content against a regular expression is good (IMHO) and the one you've got is probably a good start. The proof of the pudding however is in the eating, so you will have to see if "action.php" is a good (enough) criteria to determine that you have gotten the content you expect.

BTW - the save content will only work if the directory Results/$id already exists

Cheers,

Peter

Hüseyin KÖK wrote:
hi,

No i do not used error checking yet( im new in coding :))
 I also never thougt about that, because it worked weeks ago fine.


now i just changed the code:

so now i am parsing after mech->get if the form is there. This is the 2. advise 
you gave. do you think this works?

######
  my $mech = WWW::Mechanize->new;
  
$mech->get('http://swissmodel.expasy.org/workspace/index.php?func=modelling_simple1&userid=USERID&token=TOKEN');
if($mech->content =~/form action=index.php/){ # look if form exists/available
          #print "Swissmodel Form  -  OK\n";

        $mech->submit_form # fill in form and submit
        (
          form_number => '1',
fields => {
                sequence  => $seq,
                group => $temp
} );
  }
  else{
          #print "Problem getting Form!\n";
$mech->save_content("Results/$id/smerr.html");
          return 0;
  }
#####

at first i did not exactly figured put what mech->status returns, till i found out that this is standardized http response code. so if its 200 its ok, else there could be a problem. therefor i had to study the response codes. so i will insert this also.

thanks for ur help and advise.


best regards
Hüseyin





Reply via email to