+sub check_subframes {
+ my ($m,$call) = @_;
+ my @sub_frames = $m->find_all_links(tag_regex=>qr/^i?frame$/);
+ print STDERR "subframes: \n" if $DEBUG;
+ p @sub_frames if $DEBUG;
+ for my $frame (@sub_frames) {
+ my $r = $m->get($frame->url_abs());
+ print STDERR "trying: ".$frame->url_abs()."\n" if $DEBUG;
+ if ($r->header('Content-Type') =~ /pdf/) {
+ return $m;
+ }
+ print STDERR "failed: ".$r->header('Content-Type')."\n" if $DEBUG;
+ }
+ for my $frame (@sub_frames) {
+ my $r = $m->get($frame->url_abs());
+ my $pdf_m = find_pdf_link($m,
+ 0,
+ $call+1,
+ );
+ if (defined $pdf_m) {
+ return $pdf_m;
+ }
+ }
+ return undef;
+}
+
+