+ $mech->submit_form(
+ form_name => 'summary_navigation',
+ fields => {
+ 'page' => $page,
+ },
+ );
+
+ save_mech;
+
+ $mech->form_name( 'summary_navigation' );
+ my $is_next_page = $mech->value('page') == $page;
+ warn "no next_page" unless $is_next_page;
+ return $is_next_page;
+}
+
+if ( $results ) {
+ search;
+ years;
+ get_results;
+}
+
+if ( $citations ) {
+
+ citations;
+ years unless @ranges;
+
+ do {
+ my $part;
+ if ( @ranges ) {
+ $part .= $ranges[0]->[0] . '.';
+ search;
+ citations;
+ }
+ $part .= 'citing';
+ get_results $part;
+ } while ( @ranges );
+
+}
+
+
+
+if ( $q =~ m{CA=(.+)} && $cited_reference ) {
+
+ my $CA = $1;
+
+ warn "# citated reference search";
+ $mech->follow_link( url_regex => qr/CitedReferenceSearch/ );
+ save_mech;
+
+
+ $mech->submit_form(
+ form_name => 'WOS_CitedReferenceSearch_input_form',
+ fields => {
+ 'value(input1)' => $CA,
+ },
+ );
+
+ my $page = 1;
+ my $records = $1 if $mech->content =~ m/(\d+)\s+records/;
+ warn "# found $records records\n";
+ my $last_span = 'fake';
+
+ while (1) {
+ save_mech "/tmp/isi.$q.citedref.$page";
+
+ last unless next_page();
+
+ if ( $mech->content =~ m/(\d+\s*-\s*(\d+))/ ) {
+ warn "span: $1\n";
+ last if $2 == $records;
+ last if $1 == $last_span;
+ $last_span = $1;
+ } elsif ( $page > 5 ) {
+ warn "ARTIFICALLY LIMITED TO 5 PAGES WITHOUT VALID SPAN!";
+ last;
+ }