File Coverage

blib/lib/XML/RSS/Private/Output/V1_0.pm
Criterion Covered Total %
statement 10 12 83.3
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 14 16 87.5


line stmt bran cond sub pod time code
1             package XML::RSS::Private::Output::V1_0;
2              
3 1     1   1639 use strict;
  1         2  
  1         30  
4 1     1   4 use warnings;
  1         2  
  1         28  
5              
6 1     1   4 use vars (qw(@ISA));
  1         2  
  1         51  
7              
8 1     1   36 use XML::RSS::Private::Output::Base;
  0            
  0            
9             use XML::RSS::Private::Output::Roles::ModulesElems;
10              
11             @ISA = (qw(XML::RSS::Private::Output::Roles::ModulesElems XML::RSS::Private::Output::Base));
12              
13             sub _get_top_elem_about {
14             my ($self, $tag, $about_sub) = @_;
15             return ' rdf:about="' . $self->_encode($about_sub->()) . '"';
16             }
17              
18             sub _out_textinput_rss_1_0_elems {
19             my $self = shift;
20              
21             $self->_out_dc_elements($self->textinput());
22              
23             # Ad-hoc modules
24             # TODO : Should this follow the %rdf_resources conventions of the items'
25             # and channel's modules' support ?
26             while (my ($url, $prefix) = each %{$self->_modules()}) {
27             next if $prefix =~ /^(dc|syn|taxo)$/;
28             while (my ($el, $value) = each %{$self->textinput($prefix) || {}}) {
29             $self->_out_ns_tag($prefix, $el, $value);
30             }
31             }
32             }
33              
34             sub _get_rdf_decl_open_tag {
35             return "
36             }
37              
38             sub _calc_prefer_dc {
39             return 1;
40             }
41              
42             sub _get_first_rdf_decl_mappings {
43             return (
44             ["rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"],
45             [undef, "http://purl.org/rss/1.0/"]
46             );
47             }
48              
49             sub _out_image_dc_elements {
50             my $self = shift;
51             return $self->_out_dc_elements($self->image());
52             }
53              
54             sub _out_item_1_0_tags {
55             my ($self, $item) = @_;
56              
57             $self->_out_dc_elements($item);
58              
59             # Taxonomy module
60             $self->_output_taxo_topics($item);
61             }
62              
63             sub _output_rss_middle {
64             my $self = shift;
65              
66             # PICS rating - Dublin Core has not decided how to incorporate PICS ratings yet
67             #$$output .= ''.$self->{channel}->{rating}.''."\n"
68             #$if $self->{channel}->{rating};
69              
70             $self->_out_copyright();
71              
72             # publication date
73             $self->_out_defined_tag("dc:date", $self->_calc_dc_date());
74              
75             # external CDF URL
76             #$output .= ''.$self->{channel}->{docs}.''."\n"
77             #if $self->{channel}->{docs};
78              
79             $self->_out_editors;
80              
81             $self->_out_all_modules_elems;
82              
83             $self->_out_seq_items();
84              
85             if ($self->_is_image_defined()) {
86             $self->_out(' 87             $self->_encode($self->image('url')) . "\" />\n"
88             );
89             }
90              
91             if (defined(my $textinput_link = $self->textinput('link'))) {
92             $self->_out(' 93             . $self->_encode($textinput_link) . "\" />\n"
94             );
95             }
96              
97             $self->_end_channel;
98              
99             $self->_output_main_elements;
100             }
101              
102             sub _get_end_tag {
103             return "rdf:RDF";
104             }
105              
106             1;
107