Lines 48-58
if ($path_info =~ m!^/(\d+)$!) {
Link Here
|
48 |
print $query->header(-type => 'text/xml', -status => '400 Bad Request'); |
48 |
print $query->header(-type => 'text/xml', -status => '400 Bad Request'); |
49 |
} |
49 |
} |
50 |
|
50 |
|
51 |
# are we retrieving or updating a bib? |
51 |
# are we retrieving, updating or deleting a bib? |
52 |
if ($query->request_method eq "GET") { |
52 |
if ($query->request_method eq "GET") { |
53 |
fetch_bib($query, $biblionumber); |
53 |
fetch_bib($query, $biblionumber); |
54 |
} else { |
54 |
} elsif ($query->request_method eq "POST") { |
55 |
update_bib($query, $biblionumber); |
55 |
update_bib($query, $biblionumber); |
|
|
56 |
} elsif ($query->request_method eq "DELETE") { |
57 |
delete_bib($query, $biblionumber); |
58 |
} else { |
59 |
print $query->header(-type => 'text/xml', -status => '405 Method not allowed'); |
60 |
print XMLout({ error => 'Method not allowed' }, NoAttr => 1, RootName => 'response', XMLDecl => 1); |
61 |
exit 0; |
56 |
} |
62 |
} |
57 |
|
63 |
|
58 |
exit 0; |
64 |
exit 0; |
Lines 120-122
sub update_bib {
Link Here
|
120 |
|
126 |
|
121 |
print XMLout($result, NoAttr => 1, RootName => 'response', XMLDecl => 1, NoEscape => $do_not_escape); |
127 |
print XMLout($result, NoAttr => 1, RootName => 'response', XMLDecl => 1, NoEscape => $do_not_escape); |
122 |
} |
128 |
} |
123 |
- |
129 |
|
|
|
130 |
sub delete_bib { |
131 |
my $query = shift; |
132 |
my $biblionumber = shift; |
133 |
my $error = DelBiblio($biblionumber); |
134 |
|
135 |
if (defined $error) { |
136 |
print $query->header(-type => 'text/xml', -status => '400 Bad request'); |
137 |
print XMLout({ error => $error }, NoAttr => 1, RootName => 'response', XMLDecl => 1); |
138 |
exit 0; |
139 |
} |
140 |
|
141 |
print $query->header(-type => 'text/xml'); |
142 |
print XMLout({ status => 'OK, biblio deleted' }, NoAttr => 1, RootName => 'response', XMLDecl => 1); |
143 |
} |