1 # This module is part of , and is released
2 # under the terms of the GPL version 2, or any later version. See the
3 # file README and COPYING for more information.
4 # Copyright 2003 by Don Armstrong <don@donarmstrong.com>.
5 # $Id: Article.pm 30 2004-06-29 10:26:20Z don $
7 package Reference::Type::Article;
11 Reference::Type::Article -- Article reference type
27 use vars qw($VERSION $DEBUG);
30 use base qw(Reference Reference::Field::Author Reference::Field::Pages Reference::Field::Journal Reference::Field::Date);
34 use Params::Validate qw(:types validate_with);
37 ($VERSION) = q$LastChangedRevision: 30 $ =~ /\$LastChangedRevision:\s+([^\s+])/;
38 $DEBUG = 0 unless defined $DEBUG;
46 $article->name($article_name);
47 my $article_name = $article->name;
51 Returns the article name if it has been set, or builds an article name
52 from the author, journal, volume, and page if none is set.
59 if (scalar(@_) == 1) {
60 $params{name} = shift;
63 %params = validate_with(params => \@_,
64 spec => {name => {type => SCALAR,
67 output => {type => SCALAR,
74 if (defined $params{name}) {
75 $self->{reference}->{name} = $params{name};
78 if (not defined $self->{reference}->{name}) {
79 my ($name) = $self->first_author =~ /(\w+)$/;
80 if (not defined $name) {
81 no warnings qw(uninitialized);
82 $name = $self->journal . $self->volume . $self->pages;
84 $name .= $self->year if defined $self->year;
85 $self->{reference}->{name} = $name;
89 return $self->{reference}->{name};
97 my @ref_fields = $self->ref_fields;
101 Returns the list of reference fields which this type of reference
109 return qw(author title year abstract journal pmid medline_id volume date number pages keywords doi html pdf month);
117 Called by Reference's new function
121 Call superclass's _init function [C<$self->NEXT::_init>], set up the
122 bibtex_mapping and bibtex_order.
130 $self->{type} = 'article';
131 # $self->{bibtex_mapping} = {Article => 'name',
132 # author => 'author',
134 # journal => 'journal',
137 # volume => 'volume',
138 # number => 'number',
141 # abstract => 'abstract',
143 # mlid => 'medline_id',
148 # $self->{bibtex_order} = [qw(Article author title journal
149 # year key volume number pages
150 # month abstract pmid mlid doi