3 # BioPerl module for Bio::Tools::EUtilities::Link::UrlLink
5 # Please direct questions and support issues to <bioperl-l@bioperl.org>
7 # Cared for by Chris Fields
9 # Copyright Chris Fields
11 # You may distribute this module under the same terms as perl itself
13 # POD documentation - main docs before the code
15 # Part of the EUtilities BioPerl package
19 Bio::Tools::EUtilities::Link::UrlLink - class for EUtils UrlLinks
33 User feedback is an integral part of the
34 evolution of this and other Bioperl modules. Send
35 your comments and suggestions preferably to one
36 of the Bioperl mailing lists. Your participation
39 bioperl-l@lists.open-bio.org - General discussion
40 http://www.bioperl.org/wiki/Mailing_lists - About the mailing lists
44 Please direct usage questions or support issues to the mailing list:
46 I<bioperl-l@bioperl.org>
48 rather than to the module maintainer directly. Many experienced and
49 reponsive experts will be able look at the problem and quickly
50 address it. Please include a thorough description of the problem
51 with code and data examples if at all possible.
55 Report bugs to the Bioperl bug tracking system to
56 help us keep track the bugs and their resolution.
57 Bug reports can be submitted via the web.
59 http://bugzilla.open-bio.org/
63 Email cjfields at bioperl dot org
67 The rest of the documentation details each of the
68 object methods. Internal methods are usually
73 # Let the code begin...
75 package Bio
::Tools
::EUtilities
::Link
::UrlLink
;
77 use base
qw(Bio::Root::Root Bio::Tools::EUtilities::EUtilDataI);
90 sub get_dbfrom
{ return shift->{'_dbfrom'}; }
102 sub get_attribute
{ return shift->{'_attribute'}; }
114 sub get_icon_url
{ return shift->{'_iconurl'}; }
116 =head2 get_subject_type
126 sub get_subject_type
{ return shift->{'_subjecttype'}; }
140 # fix Entrz LinkOut URLS without the full URL
141 if ($self->{'_url'} && $self->{'_url'} =~ m{^/}) {
142 $self->{'_url'} = 'http://www.ncbi.nih.gov'.$self->{'_url'};
144 return $self->{'_url'};
149 Title : get_link_name
157 sub get_link_name
{ return shift->{'_linkname'}; }
159 =head2 get_provider_name
161 Title : get_provider_name
169 sub get_provider_name
{ return shift->{'_provider_name'}; }
171 =head2 get_provider_abbr
173 Title : get_provider_abbr
181 sub get_provider_abbr
{ return shift->{'_provider_nameabbr'}; }
183 =head2 get_provider_id
185 Title : get_provider_id
193 sub get_provider_id
{ return shift->{'_provider_id'}[0]; }
195 =head2 get_provider_icon_url
197 Title : get_provider_icon_url
205 sub get_provider_icon_url
{ return shift->{'_provider_iconurl'}; }
207 =head2 get_provider_url
209 Title : get_provider_url
217 sub get_provider_url
{ return shift->{'_provider_url'}; }
222 my ($self, $data) = @_;
223 if (exists $data->{Provider
}) {
224 map {$self->{'_provider_'.lc $_} = $data->{Provider
}->{$_};
225 } keys %{$data->{Provider
}};
226 delete $data->{Provider
};
228 map {$self->{'_'.lc $_} = $data->{$_} if $data->{$_}} keys %$data;
234 Usage : $foo->to_string()
235 Function : converts current object to string
237 Args : (optional) simple data for text formatting
238 Note : Used generally for debugging and for various print methods
244 my $level = shift || 0;
245 my $pad = 20 - $level;
247 my %tags = (1 => ['get_link_name' => 'Link Name'],
248 2 => ['get_subject_type' => 'Subject Type'],
249 3 => ['get_dbfrom' => 'DB From'],
250 4 => ['get_attribute' => 'Attribute'],
251 6 => ['get_icon_url' => 'IconURL'],
252 7 => ['get_url' => 'URL'],
253 8 => ['get_provider_name' => 'Provider'],
254 9 => ['get_provider_abbr' => 'ProvAbbr'],
255 10 => ['get_provider_id' => 'ProvID'],
256 11 => ['get_provider_url' => 'ProvURL'],
257 12 => ['get_provider_icon_url' => 'ProvIcon'],
260 for my $tag (sort {$a <=> $b} keys %tags) {
261 my ($m, $nm) = ($tags{$tag}->[0], $tags{$tag}->[1]);
262 my $content = $self->$m();
263 next unless $content;
264 $string .= sprintf("%-*s%-*s%s\n",
267 $self->_text_wrap(':',
268 ' ' x
($pad + $level).':',