Subject: | PMCID breaks if PMC->PMID translation fails |
Paraphrased from
http://en.wikipedia.org/wiki/User_talk:Diberri/Template_filler:
PMCIDs are used indirectly to generate {{cite journal}} templates. The
process involves 1) converting a PMCID to a PMID (via
W::W::TF::S::PubmedcentralId) and 2) generating a {{cite journal}}
template from the PMID (via W::W::TF::S::PubmedId). If no PMID exists
for a given PMCID, then step 1 effectively causes an undef to be passed
to step 2. And since there is insufficient error handling in the step 2
code, this causes warnings and errors up the wazoo.
This was discovered using the web interface, an example for which is
given at [1]. Errors include the following:
Use of uninitialized value in substitution (s///) at
lib/WWW/Wikipedia/TemplateFiller/Source/PubmedId.pm line 30.
Use of uninitialized value in string eq at
lib/WWW/Wikipedia/TemplateFiller/Source/PubmedId.pm line 33.
Use of uninitialized value in substitution (s///) at
lib/WWW/Wikipedia/TemplateFiller/Source/PubmedId.pm line 39.
Use of uninitialized value in substitution (s///) at
lib/WWW/Wikipedia/TemplateFiller/Source/PubmedId.pm line 39.
Error executing run mode 'view': Can't call method "url" on unblessed
reference at lib/WWW/Wikipedia/TemplateFiller/Source/PubmedId.pm line 42.
at /var/www/diberri/cgi-bin/templatefiller/index.cgi line 12
[Tue Nov 18 19:17:49 2008] [error] [client 24.39.185.18] Premature end
of script headers: /var/web/cgi-bin/templatefiller/index.cgi
The proper behavior would be to gracefully exit in the event that no
PMID exists for a given PMCID. This might mean issuing a die() from
PubmedId.pm's get() in the event that $pmid is undefined, and trapping
this error in a higher-level eval{}, or it might mean going about the
error-handling in an entirely different manner.
-- David Iberri
[1]
http://diberri.dyndns.org/cgi-bin/templatefiller/index.cgi?ddb=&type=pubmedcentral_id&id=1247673&add_ref_tag=1&add_text_url=1