File Coverage

blib/lib/Bio/Tools/EUtilities/History.pm
Criterion Covered Total %
statement 23 31 74.1
branch 2 4 50.0
condition 3 9 33.3
subroutine 6 7 85.7
pod 2 2 100.0
total 36 53 67.9


line stmt bran cond sub pod time code
1             package Bio::Tools::EUtilities::History;
2             $Bio::Tools::EUtilities::History::VERSION = '1.77';
3 4     4   29 use utf8;
  4         9  
  4         22  
4 4     4   120 use strict;
  4         8  
  4         71  
5 4     4   18 use warnings;
  4         6  
  4         106  
6 4     4   20 use base qw(Bio::Root::Root Bio::Tools::EUtilities::HistoryI);
  4         7  
  4         2128  
7              
8             # ABSTRACT: Lightweight implementation of HistoryI interface (not bound to filehandles, extraneous methods, etc).
9             # AUTHOR: Chris Fields
10             # OWNER: 2006-2013 Chris Fields
11             # LICENSE: Perl_5
12              
13              
14              
15             sub new {
16 2     2 1 62 my ($class, @args) = @_;
17 2         27 my $self = $class->SUPER::new(@args);
18 2         162 my ($eutil) = $self->_rearrange([qw(eutil)],@args);
19 2 50       70 $eutil || $self->throw('eutil not defined');
20 2         17 $self->eutil($eutil);
21 2         16 $self->datatype('history');
22 2         9 return $self;
23             }
24              
25              
26              
27              
28             sub _add_data {
29 2     2   6 my ($self, $simple) = @_;
30 2 50 33     15 if (!exists $simple->{WebEnv} || !exists $simple->{QueryKey}) {
31 0         0 $self->debug("Data:",Dumper($simple));
32 0         0 $self->throw("Missing webenv/query key in history output");
33             }
34 2   33     26 $self->{_webenv} = $simple->{WebEnv} && delete $simple->{WebEnv};
35 2   33     17 $self->{_querykey} = $simple->{QueryKey} && delete $simple->{QueryKey};
36             }
37              
38              
39             sub to_string {
40 0     0 1   my $self = shift;
41 0           my $string;
42 0           my %map = (
43             'get_webenv' => 'WebEnv',
44             'get_query_key' => 'Key'
45             );
46 0           for my $m (qw(get_webenv get_query_key)) {
47 0           $string .= sprintf("%-20s:%s\n", $map{$m}, $self->$m);
48             }
49 0           return $string;
50             }
51              
52             1;
53              
54             __END__