File Coverage

blib/lib/WWW/Blog/Metadata/OpenSearch.pm
Criterion Covered Total %
statement 4 6 66.6
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 6 8 75.0


line stmt bran cond sub pod time code
1             package WWW::Blog::Metadata::OpenSearch;
2              
3 1     1   34176 use strict;
  1         2  
  1         56  
4             our $VERSION = '0.01';
5              
6 1     1   455 use WWW::Blog::Metadata;
  0            
  0            
7             use URI;
8              
9             WWW::Blog::Metadata->mk_accessors(qw( _osd ));
10              
11             sub on_got_tag {
12             my $class = shift;
13             my($meta, $tag, $attr, $base_uri) = @_;
14             if ($tag eq 'link' && $attr->{rel} && lc($attr->{rel}) eq 'search'
15             && $attr->{type} eq 'application/opensearchdescription+xml') {
16             $meta->_osd([]) unless $meta->_osd;
17             push @{$meta->_osd}, (URI->new_abs($attr->{href}, $base_uri)->as_string);
18             }
19             }
20              
21             sub WWW::Blog::Metadata::opensearch_description {
22             my $self = shift;
23             wantarray ? @{$self->_osd || []} : $self->_osd->[0];
24             }
25              
26             sub on_got_tag_order { 99 }
27              
28             1;
29             __END__