doifinder debug
hostname: $hostName
server: $server
file server root: $fileServerRoot
EOF
print "QUERY_STRING: $ENV{QUERY_STRING}\n";
#print all arguments and values
my @all = $fd->param;
foreach my $a (@all) {
my @v = $fd->param($a);
print "$a:\n";
foreach my $v (@v) {
print " $v\n";
}
}
}
#
# DSN - this one does the right thing on either server
#
my $DSN = "DSN=DynaSearch;UID=tango_client;PWD=dancetango";
my $dbh; # database handle
#
# This program is called like this:
# http://www.nature.com/cgi-bin/doifinder.pl?URL=/doifinder/10.1038/123435
# or
# http://www.nature.com/cgi-bin/doifinder.pl?URL=/uidfinder/10.1038/123435
# or
# http://www.nature.com/cgi-bin/doifinder.pl?URL=/linkfinder/10.1038/123435
#
# This is accomplished by an IIS redirect from the original URL.
#
# get the URL parameter and parse
my($URL) = $fd->param('URL');
my($whichCall, $doi) = $URL =~ m,/(doi|uid|link)finder/(.*?)$,i;
# bail if there's no DOI
unless ($doi) {
my $redirect = "http://$server/crossref/crossref_error_handle.html";
doRedirect($redirect, "no doi to lookup");
exit 0;
}
# patch in handle on old uidfinder artid
$doi = uidFinderFixDOI($doi);
# old sj/palgrave period/slash patch
$doi = sjPalgraveFixDOI($doi);
print "DOI: $doi WHICH: $whichCall\n" if $verbose;
#
# From here on, we need database records.
#
my $articles = lookupArticleByDOI($doi);
my $articleCount = scalar(@$articles);
#
# if there's no database record(s), not much we can do.
#
if ($articleCount == 0) {
my $redirect = "http://$server/crossref/crossref_error_handle.html";
doRedirect($redirect, "No database record");
exit 0;
}
#
# Special handling for google bot.
#
if (isGoogle()) {
#
# Note, if there are multiple renditions, we just give
# the first one to google. They should all have the same content,
# more or less. This is not really defined.
#
buildGoogleHTML($$articles[0]);
exit 0;
}
#
# For news@nature and Nature Clinical Practice (and more in the future),
# we have the possibility of multiple versions of an article on-line.
# This means we need a renditions page.
#
if ($articleCount > 1) {
buildRenditionsPage($articles, $whichCall);
exit 0;
}
#
# We have a single article.
# Redirect to content or build citation page
#
my $aRec = $$articles[0];
unless (handleOutput($aRec)) {
my $redirect = "http://$server/crossref/crossref_error_handle.html";
doRedirect($redirect, "error in handleOutput");
exit 0;
}
$dbh->Close if $dbh;
if ($verbose) {
print <