|
Line 0
Link Here
|
| 0 |
- |
1 |
#!/usr/bin/perl |
|
|
2 |
|
| 3 |
use warnings; |
| 4 |
use strict; |
| 5 |
|
| 6 |
use LWP::UserAgent; |
| 7 |
use File::Slurp; |
| 8 |
|
| 9 |
my $url = 'http://srvgit.koha-dev.rot13.org:8080/cgi-bin/koha/svc'; |
| 10 |
|
| 11 |
my $biblionumber = 252283; |
| 12 |
|
| 13 |
my $file = "bib-$biblionumber.marcxml"; |
| 14 |
|
| 15 |
my $user = 'svcuser'; |
| 16 |
my $password = 'svcpasswd'; |
| 17 |
my $debug = 1; |
| 18 |
|
| 19 |
my $ua = LWP::UserAgent->new(); |
| 20 |
$ua->cookie_jar({}); |
| 21 |
my $resp = $ua->post( "$url/authentication", {userid =>$user, password => $password} ); |
| 22 |
die $resp->status_line unless $resp->is_success; |
| 23 |
print $resp->decoded_content; |
| 24 |
|
| 25 |
if ( ! -e $file ) { |
| 26 |
|
| 27 |
$resp = $ua->get( "$url/bib/$biblionumber", userid =>$user, password => $password ); |
| 28 |
die $resp->status_line unless $resp->is_success; |
| 29 |
write_file $file, $resp->decoded_content; |
| 30 |
print "saved $file ", -s $file, " bytes\n"; |
| 31 |
print $resp->decoded_content; |
| 32 |
|
| 33 |
} |
| 34 |
|
| 35 |
print "update $biblionumber from $file\n"; |
| 36 |
$resp = $ua->post( "$url/bib/$biblionumber", { #userid =>$user, password => $password, |
| 37 |
POSTDATA => scalar read_file($file), |
| 38 |
} ); |
| 39 |
die $resp->status_line unless $resp->is_success; |
| 40 |
|
| 41 |
print $resp->decoded_content; |
| 42 |
|
| 43 |
|