| 1 | 6 | ▶ | use 5.008001; # no good Unicode support? you lose | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 2 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | package XML::Atom::SimpleFeed; | ||||||||||||||||||||||||||||||||||||||||||
| 6 | 6 | our $VERSION = '0.905'; | |||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 6 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 6 | ▶ | use Encode (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 6 | ▶ | use POSIX (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 6 | my @XML_ENC = 'us-ascii'; # use array because local($myvar) error but local($myvar[0]) OK | |||||||||||||||||||||||||||||||||||||||||
| 13 | # and use a lexical because not a public interface | ||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | sub ATOM_NS () { 'http://www.w3.org/2005/Atom' } | ||||||||||||||||||||||||||||||||||||||||||
| 16 | sub XHTML_NS () { 'http://www.w3.org/1999/xhtml' } | ||||||||||||||||||||||||||||||||||||||||||
| 17 | 7 | ▶ | sub PREAMBLE () { qq(<?xml version="1.0" encoding="$XML_ENC[0]"?>\n) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
PREAMBLE: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | sub W3C_DATETIME () { '%Y-%m-%dT%H:%M:%S' } | ||||||||||||||||||||||||||||||||||||||||||
| 19 | 4 | ▶ | sub DEFAULT_GENERATOR () { { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DEFAULT_GENERATOR: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 4 | ▶ | uri => 'https://metacpan.org/pod/' . __PACKAGE__, | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
__PACKAGE__->VERSION || 'git'
MC/DC0%0/1
__PACKAGE__->VERSION || 'git'
__PACKAGE__->VERSION
Truth table50%1/2
A
A= __PACKAGE__->VERSION
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | version => __PACKAGE__->VERSION || 'git', | ||||||||||||||||||||||||||||||||||||||||||
| 22 | name => __PACKAGE__, | ||||||||||||||||||||||||||||||||||||||||||
| 23 | } } | ||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | #################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 26 | # superminimal XML writer | ||||||||||||||||||||||||||||||||||||||||||
| 27 | # | ||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | 2 | ▶ | sub xml_encoding { local $XML_ENC[0] = shift; &{(shift)} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
xml_encoding: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 6 | my %XML_ESC = ( | |||||||||||||||||||||||||||||||||||||||||
| 32 | "\xA" => ' ', | ||||||||||||||||||||||||||||||||||||||||||
| 33 | "\xD" => ' ', | ||||||||||||||||||||||||||||||||||||||||||
| 34 | '"' => '"', | ||||||||||||||||||||||||||||||||||||||||||
| 35 | '&' => '&', | ||||||||||||||||||||||||||||||||||||||||||
| 36 | "'" => ''', | ||||||||||||||||||||||||||||||||||||||||||
| 37 | '<' => '<', | ||||||||||||||||||||||||||||||||||||||||||
| 38 | '>' => '>', | ||||||||||||||||||||||||||||||||||||||||||
| 39 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | 63 | ▶ | sub xml_cref { Encode::encode $XML_ENC[0], $_[0], Encode::HTMLCREF } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
xml_cref: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | 40 | ▶ | sub xml_escape { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
xml_escape: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | 40 | $_[0] =~ s{ ( [<>&'"] ) }{ $XML_ESC{ $1 } }gex; | |||||||||||||||||||||||||||||||||||||||||
| 45 | 40 | &xml_cref; | |||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | 22 | ▶ | sub xml_attr_escape { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
xml_attr_escape: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | 22 | $_[0] =~ s{ ( [\x0A\x0D<>&'"] ) }{ $XML_ESC{ $1 } }gex; | |||||||||||||||||||||||||||||||||||||||||
| 50 | 22 | &xml_cref; | |||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | 1 | ▶ | sub xml_cdata_flatten { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
xml_cdata_flatten: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | 1 | for ( $_[0] ) { | |||||||||||||||||||||||||||||||||||||||||
| 55 | 1 | my $cdata_content; | |||||||||||||||||||||||||||||||||||||||||
| 56 | 1 | s{<!\[CDATA\[(.*?)]]>}{ xml_escape $cdata_content = $1 }gse; | |||||||||||||||||||||||||||||||||||||||||
| 57 | 1 | ▶ | croak 'Incomplete CDATA section' if -1 < index $_, '<![CDATA['; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | 1 | return $_; | |||||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | 1 | ▶ | sub xml_string { xml_cref xml_cdata_flatten $_[ 0 ] } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
xml_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | 57 | ▶ | sub xml_tag { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
xml_tag: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | 57 | my $name = shift; | |||||||||||||||||||||||||||||||||||||||||
| 66 | 57 | my $attr = ''; | |||||||||||||||||||||||||||||||||||||||||
| 67 | 57 | ▶ | if( ref $name eq 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | 25 | my $i = 1; | |||||||||||||||||||||||||||||||||||||||||
| 69 | 25 | ▶ | while( $i < @$name ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 70 | 20 | $attr .= ' ' . $name->[ $i ] . '="' . xml_attr_escape( $name->[ $i + 1 ] ) . '"'; | |||||||||||||||||||||||||||||||||||||||||
| 71 | 20 | $i += 2; | |||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||
| 73 | 25 | $name = $name->[ 0 ]; | |||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||
| 75 | 57 | ▶ | @_ ? join( '', "<$name$attr>", @_, "</$name>" ) : "<$name$attr/>"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | #################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 79 | # misc utility functions | ||||||||||||||||||||||||||||||||||||||||||
| 80 | # | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | sub natural_enum { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
natural_enum: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | my @and; | |||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | unshift @and, pop @_ if @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | unshift @and, join ', ', @_ if @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | join ' and ', @and; | |||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | 3 | ▶ | sub permalink { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
permalink: called CC=4 SCAR=15.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | 3 | my ( $link_arg ) = ( @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 91 | 3 | ▶ | if( ref $link_arg ne 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 92 | 2 | return $link_arg; | |||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||
| 94 | ▶ | elsif( not exists $link_arg->{ rel } or $link_arg->{ rel } eq 'alternate' ) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
not exists $link_arg->{"rel"} or $link_arg->{"rel"} eq "alternate"
MC/DC0%0/2
not exists $link_arg->{"rel"} or $link_arg->{"rel"} eq "alternate"
not exists $link_arg->{"rel"}
$link_arg->{"rel"} eq "alternate"
Truth table33%1/3
not(A) or B
A= not exists $link_arg->{"rel"}B= $link_arg->{"rel"} eq "alternate"
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | return $link_arg->{ href }; | |||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||
| 97 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | #################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 101 | # actual implementation of RFC 4287 | ||||||||||||||||||||||||||||||||||||||||||
| 102 | # | ||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||
| 104 | 8 | ▶ | sub simple_construct { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
simple_construct: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | 8 | my ( $name, $content ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 106 | 8 | xml_tag $name, xml_escape $content; | |||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | 11 | ▶ | sub date_construct { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
date_construct: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | 11 | my ( $name, $dt ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 111 | 11 | eval { $dt = $dt->epoch }; # convert to epoch to avoid dealing with everyone's TZ crap | |||||||||||||||||||||||||||||||||||||||||
| 112 | 11 | ▶ | $dt = POSIX::strftime( W3C_DATETIME . 'Z', gmtime $dt ) unless $dt =~ /[^0-9]/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 113 | 11 | xml_tag $name, xml_escape $dt; | |||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | 3 | ▶ | sub person_construct { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
person_construct: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 117 | 3 | my ( $name, $arg ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | 3 | ▶ | my $prop = 'HASH' ne ref $arg ? { name => $arg } : $arg; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | 3 | ▶ | croak "name required for $name element" if not exists $prop->{ name }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||
| 123 | return xml_tag $name => ( | ||||||||||||||||||||||||||||||||||||||||||
| 124 | 3 | map { xml_tag $_ => xml_escape $prop->{ $_ } } | |||||||||||||||||||||||||||||||||||||||||
| 125 | 3 | grep { exists $prop->{ $_ } } | |||||||||||||||||||||||||||||||||||||||||
| 126 | qw( name email uri ) | ||||||||||||||||||||||||||||||||||||||||||
| 127 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | 9 | ▶ | sub text_construct { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
text_construct: called CC=12 SCAR=38.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | 9 | my ( $name, $arg ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | 9 | my ( $type, $content ); | |||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | 9 | ▶ | if( ref $arg eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 136 | # FIXME doesn't support @src attribute for $name eq 'content' yet | ||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | $type = exists $arg->{ type } ? $arg->{ type } : 'html'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | croak "content required for $name element" unless exists $arg->{ content }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||
| 142 | # a lof of the effort that follows is to omit the type attribute whenever possible | ||||||||||||||||||||||||||||||||||||||||||
| 143 | # | ||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | if( $type eq 'xhtml' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | $content = xml_string $arg->{ content }; | |||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | ▶ | if( $content !~ /</ ) { # FIXME does this cover all cases correctly? | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | $type = 'text'; | |||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | $content =~ s/[\n\t]+/ /g; | |||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||
| 151 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | $content = xml_tag [ div => xmlns => XHTML_NS ], $content; | |||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||
| 155 | ▶ | elsif( $type eq 'html' or $type eq 'text' ) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$type eq "html" or $type eq "text"
MC/DC0%0/2
$type eq "html" or $type eq "text"
$type eq "html"
$type eq "text"
Truth table0%0/3
A or B
A= $type eq "html"B= $type eq "text"
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | $content = xml_escape $arg->{ content }; | |||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||
| 158 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | ▶ | croak "type '$type' not allowed in $name element" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 160 | if $name ne 'content'; | ||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||
| 162 | # FIXME non-XML/text media types must be base64 encoded! | ||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | $content = xml_string $arg->{ content }; | |||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||
| 166 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 167 | 9 | $type = 'html'; | |||||||||||||||||||||||||||||||||||||||||
| 168 | 9 | $content = xml_escape $arg; | |||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||
| 171 | 9 | ▶ | if( $type eq 'html' and $content !~ /&/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$type eq "html" and not $content =~ /&/
MC/DC50%1/2
$type eq "html" and not $content =~ /&/
$type eq "html"
not $content =~ /&/
Truth table66%2/3
A and not(B)
A= $type eq "html"B= not $content =~ /&/
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | 8 | $type = 'text'; | |||||||||||||||||||||||||||||||||||||||||
| 173 | 8 | $content =~ s/[\n\t]+/ /g; | |||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||
| 176 | 9 | ▶ | return xml_tag [ $name => $type ne 'text' ? ( type => $type ) : () ], $content; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | 3 | ▶ | sub link_element { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
link_element: called CC=6 SCAR=18.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 180 | 3 | my ( $name, $arg ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | # omit atom:link/@rel value when possible | ||||||||||||||||||||||||||||||||||||||||||
| 183 | delete $arg->{'rel'} | ||||||||||||||||||||||||||||||||||||||||||
| 184 | if 'HASH' eq ref $arg | ||||||||||||||||||||||||||||||||||||||||||
| 185 | and exists $arg->{'rel'} | ||||||||||||||||||||||||||||||||||||||||||
| 186 | 3 | ▶ | and 'alternate' eq $arg->{'rel'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
"HASH" eq ref $arg and exists $arg->{"rel"} and "alternate" eq $arg->{"rel"}
"HASH" eq ref $arg and exists $arg->{"rel"}
MC/DC0%0/3
"HASH" eq ref $arg and exists $arg->{"rel"} and "alternate" eq $arg->{"rel"}
"HASH" eq ref $arg
exists $arg->{"rel"}
"alternate" eq $arg->{"rel"}
Truth table50%2/4
A and B and C
A= "HASH" eq ref $argB= exists $arg->{"rel"}C= "alternate" eq $arg->{"rel"}
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | my @attr = 'HASH' eq ref $arg | ||||||||||||||||||||||||||||||||||||||||||
| 189 | 3 | ▶ | ? do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 190 | 1 | ▶ | croak "href required for link element" if not exists $arg->{'href'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | 1 | map { $_ => $arg->{ $_ } } grep exists $arg->{ $_ }, qw( href rel type title hreflang length ); | |||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||
| 193 | : ( href => $arg ); | ||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||
| 195 | # croak "link '$attr[1]' is not a valid URI" | ||||||||||||||||||||||||||||||||||||||||||
| 196 | # if $attr[1] XXX TODO | ||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||
| 198 | 3 | xml_tag [ link => @attr ]; | |||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||
| 201 | 2 | ▶ | sub category_element { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
category_element: called CC=3 SCAR=16.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | 2 | my ( $name, $arg ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||
| 204 | my @attr = 'HASH' eq ref $arg | ||||||||||||||||||||||||||||||||||||||||||
| 205 | 2 | ▶ | ? do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | ▶ | croak "term required for category element" if not exists $arg->{'term'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | map { $_ => $arg->{ $_ } } grep exists $arg->{ $_ }, qw( term scheme label ); | |||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||
| 209 | : ( term => $arg ); | ||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | 2 | xml_tag [ category => @attr ]; | |||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||
| 214 | 7 | ▶ | sub generator_element { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
generator_element: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 215 | 7 | my ( $name, $arg ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 216 | 7 | ▶ | if( ref $arg eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 217 | 2 | ▶ | croak 'name required for generator element' if not exists $arg->{ name }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 218 | 2 | my $content = delete $arg->{ name }; | |||||||||||||||||||||||||||||||||||||||||
| 219 | 2 | xml_tag [ generator => map +( $_ => $arg->{ $_ } ), grep exists $arg->{ $_ }, qw( uri version ) ], xml_escape( $content ); | |||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||
| 221 | elsif( defined $arg ) { | ||||||||||||||||||||||||||||||||||||||||||
| 222 | 4 | xml_tag generator => xml_escape( $arg ); | |||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||
| 224 | 1 | else { '' } | |||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||
| 227 | # tag makers are called with the name of the tag they're supposed to handle as the first parameter | ||||||||||||||||||||||||||||||||||||||||||
| 228 | 6 | my %make_tag = ( | |||||||||||||||||||||||||||||||||||||||||
| 229 | icon => \&simple_construct, | ||||||||||||||||||||||||||||||||||||||||||
| 230 | id => \&simple_construct, | ||||||||||||||||||||||||||||||||||||||||||
| 231 | logo => \&simple_construct, | ||||||||||||||||||||||||||||||||||||||||||
| 232 | published => \&date_construct, | ||||||||||||||||||||||||||||||||||||||||||
| 233 | updated => \&date_construct, | ||||||||||||||||||||||||||||||||||||||||||
| 234 | author => \&person_construct, | ||||||||||||||||||||||||||||||||||||||||||
| 235 | contributor => \&person_construct, | ||||||||||||||||||||||||||||||||||||||||||
| 236 | title => \&text_construct, | ||||||||||||||||||||||||||||||||||||||||||
| 237 | subtitle => \&text_construct, | ||||||||||||||||||||||||||||||||||||||||||
| 238 | rights => \&text_construct, | ||||||||||||||||||||||||||||||||||||||||||
| 239 | summary => \&text_construct, | ||||||||||||||||||||||||||||||||||||||||||
| 240 | content => \&text_construct, | ||||||||||||||||||||||||||||||||||||||||||
| 241 | link => \&link_element, | ||||||||||||||||||||||||||||||||||||||||||
| 242 | category => \&category_element, | ||||||||||||||||||||||||||||||||||||||||||
| 243 | generator => \&generator_element, | ||||||||||||||||||||||||||||||||||||||||||
| 244 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||
| 246 | 8 | ▶ | sub container_content { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
container_content: called CC=15 SCAR=28.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 247 | 8 | my ( $name, %arg ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | my ( $elements, $required, $optional, $singular, $deprecation, $callback ) = | ||||||||||||||||||||||||||||||||||||||||||
| 250 | 8 | @arg{ qw( elements required optional singular deprecate callback ) }; | |||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||
| 252 | 8 | my ( $content, %permission, %count, $permalink ); | |||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | 8 | undef @permission{ @$required, @$optional }; # populate | |||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||
| 256 | 8 | ▶ | while( my ( $elem, $arg ) = splice @$elements, 0, 2 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 257 | 36 | ▶ | if( exists $permission{ $elem } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 258 | 36 | $content .= $make_tag{ $elem }->( $elem, $arg ); | |||||||||||||||||||||||||||||||||||||||||
| 259 | 36 | ++$count{ $elem }; | |||||||||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||||||||||
| 261 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | croak "Unknown element $elem"; | |||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||
| 265 | 36 | ▶ | if( $elem eq 'link' and defined ( my $alt = permalink $arg ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$elem eq "link" and defined(my $alt = permalink($arg))
MC/DC100%2/2
$elem eq "link" and defined(my $alt = permalink($arg))
$elem eq "link"
defined(my $alt = permalink($arg))
Truth table100%3/3
A and B
A= $elem eq "link"B= defined(my $alt = permalink($arg))
| |||||||||||||||||||||||||||||||||||||||||||
| 266 | 2 | ▶ | $permalink = $alt unless $count{ 'alternate link' }++; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||
| 269 | 36 | ▶ | if( exists $callback->{ $elem } ) { $callback->{ $elem }->( $arg ) } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||
| 271 | 36 | ▶ | if( not @$elements ) { # end of input? | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 272 | # we would normally fall off the bottom of the loop now; | ||||||||||||||||||||||||||||||||||||||||||
| 273 | # before that happens, it's time to defaultify stuff and | ||||||||||||||||||||||||||||||||||||||||||
| 274 | # put it in the input so we will keep going for a little longer | ||||||||||||||||||||||||||||||||||||||||||
| 275 | 11 | ▶ | if( not $count{ id } and defined $permalink ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $count{"id"} and defined $permalink
MC/DC0%0/2
not $count{"id"} and defined $permalink
not $count{"id"}
defined $permalink
Truth table33%1/3
not(A) and B
A= not $count{"id"}B= defined $permalink
| |||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | carp 'Falling back to alternate link as id'; | |||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | push @$elements, id => $permalink; | |||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||
| 279 | 11 | ▶ | if( not $count{ updated } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 280 | 3 | push @$elements, updated => $arg{ default_upd }; | |||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||
| 285 | 8 | my @error; | |||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | 8 | my @missing = grep { not exists $count{ $_ } } @$required; | |||||||||||||||||||||||||||||||||||||||||
| 288 | 8 | ▶ | my @toomany = grep { ( $count{ $_ } || 0 ) > 1 } 'alternate link', @$singular; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$count{$_} || 0
MC/DC100%1/1
$count{$_} || 0
$count{$_}
Truth table100%2/2
A
A= $count{$_}
| |||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||
| 290 | 8 | ▶ | push @error, 'requires at least one ' . natural_enum( @missing ) . ' element' if @missing; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 291 | 8 | ▶ | push @error, 'must have no more than one ' . natural_enum( @toomany ) . ' element' if @toomany; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||
| 293 | 8 | ▶ | croak $name, ' ', join ' and ', @error if @error; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||
| 295 | 8 | return $content; | |||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||
| 298 | #################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 299 | # implementation of published interface and rest of RFC 4287 | ||||||||||||||||||||||||||||||||||||||||||
| 300 | # | ||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||
| 302 | 7 | ▶ | sub XML::Atom::SimpleFeed::new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 303 | 7 | my $self = bless { xml_encoding => $XML_ENC[0] }, shift; | |||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||
| 305 | 7 | ▶ | if ( my @i = grep { '-encoding' eq $_[$_] } grep { not $_ % 2 } 0 .. $#_ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 306 | 2 | ▶ | croak 'multiple encodings requested' if @i > 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 307 | 2 | ( undef, my $encoding ) = splice @_, $i[0], 2; | |||||||||||||||||||||||||||||||||||||||||
| 308 | 2 | $self->{ xml_encoding } = $encoding; | |||||||||||||||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||
| 311 | 7 | ▶ | @_ ? $self->feed( @_ ) : $self; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||
| 314 | 7 | ▶ | sub XML::Atom::SimpleFeed::feed { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
feed: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 315 | 7 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||
| 317 | 7 | my $have_generator; | |||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | 7 | local $XML_ENC[0] = $self->{ xml_encoding }; | |||||||||||||||||||||||||||||||||||||||||
| 320 | $self->{ meta } = container_content feed => ( | ||||||||||||||||||||||||||||||||||||||||||
| 321 | elements => \@_, | ||||||||||||||||||||||||||||||||||||||||||
| 322 | required => [ qw( id title updated ) ], | ||||||||||||||||||||||||||||||||||||||||||
| 323 | optional => [ qw( author category contributor generator icon logo link rights subtitle ) ], | ||||||||||||||||||||||||||||||||||||||||||
| 324 | singular => [ qw( generator icon logo id rights subtitle title updated ) ], | ||||||||||||||||||||||||||||||||||||||||||
| 325 | callback => { | ||||||||||||||||||||||||||||||||||||||||||
| 326 | 1 | ▶ | author => sub { $self->{ have_default_author } = 1 }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 327 | 7 | ▶ | updated => sub { $self->{ global_updated } = $_[ 0 ] }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 328 | 5 | ▶ | generator => sub { $have_generator = 1 }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 329 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 330 | 7 | default_upd => time, | |||||||||||||||||||||||||||||||||||||||||
| 331 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||
| 333 | 7 | ▶ | $self->{ meta } .= $make_tag{ generator }->( generator => DEFAULT_GENERATOR ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 334 | unless $have_generator; | ||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||
| 336 | 7 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||
| 339 | 1 | ▶ | sub XML::Atom::SimpleFeed::add_entry { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_entry: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 340 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||
| 342 | 1 | my @required = qw( id title updated ); | |||||||||||||||||||||||||||||||||||||||||
| 343 | 1 | my @optional = qw( category content contributor link published rights summary ); | |||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||
| 345 | 1 | ▶ | push @{ $self->{ have_default_author } ? \@optional : \@required }, 'author'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||
| 347 | # FIXME | ||||||||||||||||||||||||||||||||||||||||||
| 348 | # | ||||||||||||||||||||||||||||||||||||||||||
| 349 | # o atom:entry elements that contain no child atom:content element | ||||||||||||||||||||||||||||||||||||||||||
| 350 | # MUST contain at least one atom:link element with a rel attribute | ||||||||||||||||||||||||||||||||||||||||||
| 351 | # value of "alternate". | ||||||||||||||||||||||||||||||||||||||||||
| 352 | # | ||||||||||||||||||||||||||||||||||||||||||
| 353 | # o atom:entry elements MUST contain an atom:summary element in either | ||||||||||||||||||||||||||||||||||||||||||
| 354 | # of the following cases: | ||||||||||||||||||||||||||||||||||||||||||
| 355 | # * the atom:entry contains an atom:content that has a "src" | ||||||||||||||||||||||||||||||||||||||||||
| 356 | # attribute (and is thus empty). | ||||||||||||||||||||||||||||||||||||||||||
| 357 | # * the atom:entry contains content that is encoded in Base64; | ||||||||||||||||||||||||||||||||||||||||||
| 358 | # i.e., the "type" attribute of atom:content is a MIME media type | ||||||||||||||||||||||||||||||||||||||||||
| 359 | # [MIMEREG], but is not an XML media type [RFC3023], does not | ||||||||||||||||||||||||||||||||||||||||||
| 360 | # begin with "text/", and does not end with "/xml" or "+xml". | ||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||
| 362 | 1 | local $XML_ENC[0] = $self->{ xml_encoding }; | |||||||||||||||||||||||||||||||||||||||||
| 363 | 1 | push @{ $self->{ entries } }, xml_tag entry => container_content entry => ( | |||||||||||||||||||||||||||||||||||||||||
| 364 | elements => \@_, | ||||||||||||||||||||||||||||||||||||||||||
| 365 | required => \@required, | ||||||||||||||||||||||||||||||||||||||||||
| 366 | optional => \@optional, | ||||||||||||||||||||||||||||||||||||||||||
| 367 | singular => [ qw( content id published rights summary ) ], | ||||||||||||||||||||||||||||||||||||||||||
| 368 | default_upd => $self->{ global_updated }, | ||||||||||||||||||||||||||||||||||||||||||
| 369 | 1 | ); | |||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||
| 371 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||
| 374 | 7 | ▶ | sub XML::Atom::SimpleFeed::as_string { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
as_string: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 375 | 7 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 376 | 7 | local $XML_ENC[0] = $self->{ xml_encoding }; | |||||||||||||||||||||||||||||||||||||||||
| 377 | 7 | PREAMBLE . xml_tag [ feed => xmlns => ATOM_NS ], $self->{ meta }, @{ $self->{ entries } }; | |||||||||||||||||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | ▶ | sub XML::Atom::SimpleFeed::print { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
print: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | my ( $handle ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | local $, = local $\ = ''; | |||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | ▶ | defined $handle ? print $handle $self->as_string : print $self->as_string; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | ▶ | sub XML::Atom::SimpleFeed::save_file { croak q{no longer supported, use 'print' instead and pass in a filehandle} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
save_file: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||
| 389 | 6 | !!'Funky and proud of it.'; | |||||||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||||||||
| 391 | __END__ | ||||||||||||||||||||||||||||||||||||||||||