X-Git-Url: https://git.donarmstrong.com/?p=reference.git;a=blobdiff_plain;f=blib%2Flib%2FReference%2FField%2FJournal.pm;fp=blib%2Flib%2FReference%2FField%2FJournal.pm;h=0000000000000000000000000000000000000000;hp=ad5639a481f6360fad582420633060dfb1e9cbe5;hb=086538a2425d531df6c90013cf8ea40711572604;hpb=867806a4b5d5ec60310161f0bca43d2cdcdfed52 diff --git a/blib/lib/Reference/Field/Journal.pm b/blib/lib/Reference/Field/Journal.pm deleted file mode 100644 index ad5639a..0000000 --- a/blib/lib/Reference/Field/Journal.pm +++ /dev/null @@ -1,110 +0,0 @@ -# This module is part of da_reference, and is released -# under the terms of the GPL version 2, or any later version. See the -# file README and COPYING for more information. -# Copyright 2003 by Don Armstrong . -# $Id: Journal.pm 44 2013-09-10 00:37:13Z don $ - -package Reference::Field::Journal; - -=head1 NAME - - -- - -=head1 SYNOPSIS - - -=head1 DESCRIPTION - - -=head1 BUGS - -None known. - -=cut - - -use strict; -use vars qw($REVISION $DEBUG @JOURNAL_FIELDS); - -use NEXT; -use Params::Validate qw(:types validate_with); - -BEGIN{ - ($REVISION) = q$LastChangedRevision: 44 $ =~ /\$LastChangedRevision:\s+([^\s+])/; - $DEBUG = 0 unless defined $DEBUG; - @JOURNAL_FIELDS = qw(title medlineabbr isoabbr nlmid issn eissn publisher pmid); -} - - -sub _init{ - my $self = shift; - - $self->{reference}->{journal} = {}; - @{$self->{reference}->{journal}}{@JOURNAL_FIELDS} = (undef) x scalar @JOURNAL_FIELDS; - - $self->NEXT::_init; - -} - -sub journal{ - my $self = shift; - my %params; - if (scalar(@_) == 1) { - $params{journal} = shift; - $params{output} = 'scalar'; - } - else { - my %spec; - @spec{@JOURNAL_FIELDS} = ({type => SCALAR|UNDEF,optional=>1}) x scalar @JOURNAL_FIELDS; - %params = validate_with(params => \@_, - spec => {journal => {type => SCALAR, - optional => 1, - }, - output => {type => SCALAR, - default => 'scalar', - }, - %spec, - }, - ); - } - # Were we called using $reference->journal(foo=>bar) {ignoring journal=>bar} ? - my $using_param_call = 0; - foreach my $key (@JOURNAL_FIELDS) { - $using_param_call = 1 and last if exists $params{$key} and defined $params{$key}; - } - if ($using_param_call) { - foreach my $key (@JOURNAL_FIELDS) { - $self->{reference}->{journal}->{$key} = $params{$key} if exists $params{$key} and defined $params{$key}; - } - } - elsif (defined $params{journal}) { - $self->{reference}->{journal}->{title} = $params{journal}; - } - - local $_ = $params{output}; - if (/bibtex/) { - my $title = $self->{reference}->{journal}->{medlineabbr} || $self->{reference}->{journal}->{title}; - $title =~ s/\s//g; - return $title; - } elsif (/medline/) { - return $self->{reference}->{journal}->{medlineabbr} || $self->{reference}->{journal}->{title}; - } elsif (/iso/) { - return $self->{reference}->{journal}->{isoabbr} || $self->{reference}->{journal}->{title}; - } - else { - return $self->{reference}->{journal}->{title}; - } -} - - - -1; - - -__END__ - - - - - -