6 my $url = 'http://ovidsp.ovid.com/ovidweb.cgi?T=JS&NEWS=n&MODE=ovid&PAGE=main&D=psyh';
8 our $location = 'Croatia';
9 my $results_per_page = 100; # 5 10 25 50 100
12 use Data::Dump qw(dump);
15 our $mech = WWW::Mechanize->new(
22 my $dir = '/tmp/ovid';
23 rmtree $dir if -e $dir;
29 my $base_path = sprintf('%s/%04d', $dir,$step);
31 $path .= $mech->{ct} =~ m{html}i ? '.html' : '.txt';
32 $mech->save_content( $path );
33 warn "# [$step] $path ", -s $path, " ", $mech->ct, "\n";
34 open(my $dump, '>', "$base_path.dump.txt");
35 $mech->dump_all($dump);
43 $mech->follow_link( url_regex => qr/multifield/ );
46 warn "# search lo:$location";
48 form_name => 'sfmultifield',
51 'textBox001' => $location,
56 # $mech->form_id( 'nav-results' ); # XXX not supported by older WWW::Mechanize
57 $mech->form_number(3);
61 my @records = $mech->find_all_inputs(
63 name => 'cmRecordSelect',
66 #warn '## records ', dump @records;
67 my $range = $records[0]->{menu}->[1]->{value} || die "All on this page";
69 warn "submit_form save $range";
72 'cmRecordSelect' => $range,
74 'cmFormat' => 'export',
75 'saveStrategy' => 'on',
76 'jumpstartLink' => 'on',
78 button => 'submit:cmsave|1',
80 save_mech "$dir.$range";
84 my @next_page = $mech->find_all_submits( value_regex => qr/Next Page/i );
85 #warn "## next page ", dump @next_page;
86 my $button = $next_page[-1]->{name} || die "next page button?";
87 warn "submit_form next page $button\n";
90 results_per_page => $results_per_page, # FIXME doesn't work?