hi..

i'm havin an issue with the following script. it uses www::mechanize and
appears to die when i use the word/var "ANT" for one of the form inputs. the
test script demonstrates getting information from the test site using both
LWP and mechanize. the LWP approach works, the mechanize fails.

any ideas/comments/criticisms as to why the mechanize fails would be
appreciated..

you can see the machanize works by using "CHE" instead of "ANT"...


###########################################################

#!/usr/bin/perl -w


use WWW::Mechanize;
use HTML::TreeBuilder;
use LWP::UserAgent;
   $ua = new LWP::UserAgent;
   $ua->timeout(30);
   $ua->agent("AgentName/0.1 " . $ua->agent);

   my $req = new HTTP::Request POST =>
'http://lca.lehman.cuny.edu/dept/registrar/schedule/coursefinder.asp';

   my $query;
   my $cstr;
   $cstr =
"?term=FAL04CRS&division=D&u_input=ANT&sortby=Disc%2C+Coursenum%2C+Section&o
rder=+ASC";

   $req->content_type('application/x-www-form-urlencoded');
   $req->content($cstr);

   my $res = $ua->request($req);
   my $q1c = $res->content;
   print $q1c;

#
# using the above LWP method works ok...
# implementing with www::mechanize causes issues
#
# it appears that using "ANT" for "u_input" causes the
# mechanize function to run into issues. other information
# for "u_input" works ok... but "ANT" causes the app to die...
#

   my (@_semester, @_dept, @_sort, @_order1, @_order, @_div);
   my ($default_semester, $default_div, $default_order);

$default_semester="FAL04CRS";
$default_div="D";

$curdept="ANT";  ## <<<<<<< major issue!!!!!!!

$default_sort="Disc Coursenum Section";
$default_order="+ASC";

my $b = WWW::Mechanize->new();


$b->get("http://lca.lehman.cuny.edu/dept/registrar/schedule/coursefinder.asp
");
         $b->form_number(1);
            #print $b->current_form()->dump();
         $b->field("term", $default_semester);
         $b->field("division", $default_div);
         $b->field("u_input", $curdept);
         $b->field("sortby", $default_sort);
         $b->field("order", $default_order);
         #open(F, ">out.html");
         #print F $b->submit()->content();
          #close(F);

   #      &parse_file();
   print "uuu ".$default_semester."  ".$default_div."  ".$curdept."  ".
$default_sort."  ".$default_order."\n";

die;
###########################################################


thanks...

bruce

Reply via email to