added save_content for debugging
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 23 Oct 2010 16:27:26 +0000 (18:27 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 23 Oct 2010 16:27:26 +0000 (18:27 +0200)
Aleph.pm
Scraper.pm
t/2-Aleph.t

index b937728..c8e529a 100644 (file)
--- a/Aleph.pm
+++ b/Aleph.pm
@@ -77,7 +77,9 @@ diag "advanced search";
 
        $mech->follow_link( url_regex => qr/find-c/ );
 
-diag "submit search $query";
+diag "submit search [$query] on ", $self->{database};
+
+       $self->save_content;
 
        $mech->submit_form(
                fields => {
index 535f7b5..d5e1ba8 100644 (file)
@@ -35,4 +35,15 @@ sub save_marc {
 
 }
 
+our $dump_nr = 1;
+
+sub save_content {
+       my $self = shift;
+       my $path = "/tmp/$dump_nr.html";
+       open(my $html, '>', $path);
+       print $html $self->{mech}->content;
+       close($html);
+       warn "# save_content $path ", -s $path, " bytes";
+}
+
 1;
index aeb20a2..e88ec04 100755 (executable)
@@ -7,7 +7,7 @@ use Test::More tests => 6;
 
 use_ok 'Aleph';
 
-ok( my $o = Aleph->new, 'new' );
+ok( my $o = Aleph->new('ZAG01'), 'new' );
 
 ok( my $hits = $o->search( 'WTI=linux' ), 'search' );
 diag "$hits results";