--- trunk/Meteor/Koha.pm 2009/03/28 20:53:45 78 +++ trunk/Meteor/Koha.pm 2009/03/29 00:11:48 79 @@ -9,16 +9,27 @@ our $cache; +use HTML::Query qw/Query/; +use File::Slurp; +use Encode qw/decode/; +use Data::Dump qw/dump/; + sub item { my ( $class, $client, $item ) = @_; my $html; my $status = 200; + my $path = "cache/$item.html"; + if ( $html = $cache->{$item} ) { warn "# koha item $item from cache\n"; + } elsif ( 0 && -e $path ) { # FIXME enable + + $html = $cache->{$item} = read_file( $path ); + } else { my $url = 'http://koha.ffzg.hr/cgi-bin/koha/opac-detail.pl?biblionumber=' . $item; @@ -28,11 +39,20 @@ if ($response->is_success) { $html = $response->content; - $html =~ s{
.+?