Revision 7695
Added by ben leinfelder over 11 years ago
Metacat.pm | ||
---|---|---|
437 | 437 |
} |
438 | 438 |
|
439 | 439 |
############################################################# |
440 |
# subroutine to get the docid for a given PID |
|
441 |
# If success, return docid, else return -1 |
|
442 |
############################################################# |
|
443 |
sub getDocid { |
|
444 |
my $self = shift; |
|
445 |
my $pid = shift; |
|
446 |
|
|
447 |
my $returnval = 0; |
|
448 |
|
|
449 |
my %postData = ( action => 'getdocid', |
|
450 |
pid => $pid |
|
451 |
); |
|
452 |
|
|
453 |
my $response = $self->sendData(%postData); |
|
454 |
if (($response) && $response->content =~ /<docid>(.*)<\/docid>/s) { |
|
455 |
$returnval = "$1"; |
|
456 |
} elsif (($response)) { |
|
457 |
$returnval = -1; |
|
458 |
#print "Error response from sendData!\n"; |
|
459 |
#print $response->content, "\n"; |
|
460 |
} else { |
|
461 |
$returnval = -1; |
|
462 |
#print "Invalid response from sendData!\n"; |
|
463 |
} |
|
464 |
|
|
465 |
return $returnval; |
|
466 |
} |
|
467 |
|
|
468 |
############################################################# |
|
440 | 469 |
# subroutine to get the message returned from the last executed |
441 | 470 |
# metacat action. These are generally XML formatted messages. |
442 | 471 |
############################################################# |
Also available in: Unified diff
Allow use of PID instead of docid in the Perl registry. At least for reading/editing and deleting existing content. Does not create content using a pid. https://projects.ecoinformatics.org/ecoinfo/issues/5932