File Coverage

blib/lib/Text/Annotate/DataSource/Simple.pm
Criterion Covered Total %
statement 25 26 96.1
branch 3 4 75.0
condition n/a
subroutine 6 7 85.7
pod 0 3 0.0
total 34 40 85.0


line stmt bran cond sub pod time code
1             package Text::Annotate::DataSource::Simple;
2 1     1   16249 use strict;
  1         3  
  1         55  
3 1     1   6 use base qw(Text::Annotate::DataSource);
  1         3  
  1         921  
4 1     1   6 use File::Basename qw(basename);
  1         2  
  1         109  
5 1     1   13 use Carp;
  1         3  
  1         266  
6             our $VERSION;
7             $VERSION = 0.01_2;
8              
9             sub new {
10 1     1 0 34 my $class = shift;
11 1         3 my $idx = shift;
12 1         12 my $self = $class->SUPER::new ();
13 1         5 foreach my $key (keys %$idx) {
14 2         12 my $can = $self->canonicalize_id($key);
15 2 100       8 if ($can ne $key) {
16 1         4 $idx->{$can} = $idx->{$key};
17 1         4 delete $idx->{$key};
18             }
19              
20             # needed? working?
21 2 50       33 $idx->{$can} = [$idx->{$can}] unless ((ref $idx->{$can}) eq "ARRAY");
22             }
23 1         9 $self->{idx} = $idx;
24 1         4 $self;
25             };
26              
27 0     0 0 0 sub generate_index { } ;
28              
29             sub explain_link {
30 4     4 0 8 my ($self, $url) = @_;
31 4         53 return ( html_content=>$url, title => "not yet" );
32             };
33             1;