| 1 | package WebService::Cmis::AtomEntry; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | =head1 NAME | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | WebService::Cmis::AtomEntry - Representation of a cmis object | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | Base class for entries in a L<atom feed|WebService::Cmis::AtomFeeed>. | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | Sub classes: | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | =cut | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | 1 | ▶ | use WebService::Cmis qw(:namespaces :relations :contenttypes); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use XML::LibXML qw(:libxml); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 1 | our $CMIS_XPATH_TITLE = new XML::LibXML::XPathExpression('./*[local-name() = "title" and namespace-uri() ="'.ATOM_NS.'"]'); | |||||||||||||||||||||||||||
| 21 | 1 | our $CMIS_XPATH_UPDATED = new XML::LibXML::XPathExpression('./*[local-name() = "updated" and namespace-uri() ="'.ATOM_NS.'"]'); | |||||||||||||||||||||||||||
| 22 | 1 | our $CMIS_XPATH_SUMMARY = new XML::LibXML::XPathExpression('./*[local-name() = "summary" and namespace-uri() ="'.ATOM_NS.'"]'); | |||||||||||||||||||||||||||
| 23 | 1 | our $CMIS_XPATH_PUBLISHED = new XML::LibXML::XPathExpression('./*[local-name() = "published" and namespace-uri() ="'.ATOM_NS.'"]'); | |||||||||||||||||||||||||||
| 24 | 1 | our $CMIS_XPATH_EDITED = new XML::LibXML::XPathExpression('./*[local-name() = "edited" and namespace-uri() ="'.APP_NS.'"]'); | |||||||||||||||||||||||||||
| 25 | 1 | our $CMIS_XPATH_AUTHOR = new XML::LibXML::XPathExpression('./*[local-name() = "author" and namespace-uri() ="'.ATOM_NS.'"]'); | |||||||||||||||||||||||||||
| 26 | 1 | our $CMIS_XPATH_ID = new XML::LibXML::XPathExpression('./*[local-name() = "id" and namespace-uri() ="'.ATOM_NS.'"]'); | |||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | =head1 METHODS | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | =over 4 | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | =item new() | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | =cut | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 37 | 0 | my $class = shift; | |||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 0 | my $this = bless({ @_ }, $class); | |||||||||||||||||||||||||||
| 40 | 0 | $this->_initData; | |||||||||||||||||||||||||||
| 41 | 0 | return $this; | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | =item _initData | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | resets the internal cache of this entry. | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | =cut | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 0 | ▶ | sub _initData { | ||||||||||||||||||||||||||
|
Subroutine
_initData: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 51 | 0 | my $this = shift; | |||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 0 | $this->{name} = undef; | |||||||||||||||||||||||||||
| 54 | 0 | $this->{summary} = undef; | |||||||||||||||||||||||||||
| 55 | 0 | $this->{title} = undef; | |||||||||||||||||||||||||||
| 56 | 0 | $this->{published} = undef; | |||||||||||||||||||||||||||
| 57 | 0 | $this->{edited} = undef; | |||||||||||||||||||||||||||
| 58 | 0 | $this->{updated} = undef; | |||||||||||||||||||||||||||
| 59 | 0 | $this->{author} = undef; | |||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | =item reload | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | a plain AtomEntry has got no way to reload itself. that's only possible for | ||||||||||||||||||||||||||||
| 65 | cmis objects comping from a repository. | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | =cut | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 0 | ▶ | sub reload {} | ||||||||||||||||||||||||||
|
Subroutine
reload: not called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | =item _xmlDoc | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | internal helper to make sure the xmlDoc is loaded. | ||||||||||||||||||||||||||||
| 74 | don't use on plain AtomEntries without providing an xmlDoc to the constructor | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | =cut | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | 0 | ▶ | sub _xmlDoc { | ||||||||||||||||||||||||||
|
Subroutine
_xmlDoc: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 79 | 0 | my $this = shift; | |||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 0 | ▶ | $this->reload unless defined $this->{xmlDoc}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | 0 | ▶ | unless (defined $this->{xmlDoc}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 84 | 0 | throw Error::Simple("Can't fetch xmlDoc, even though I tried to reload() this $this"); | |||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 0 | return $this->{xmlDoc}; | |||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | =item _getDocumentElement -> $xmlNode | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | returns the document element of the current xmlDoc or the xmlDoc | ||||||||||||||||||||||||||||
| 93 | itself if this object is constructed using an element instead of a complete document. | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | =cut | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | 0 | ▶ | sub _getDocumentElement { | ||||||||||||||||||||||||||
|
Subroutine
_getDocumentElement: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 98 | 0 | my $xmlDoc = $_[0]->_xmlDoc; | |||||||||||||||||||||||||||
| 99 | 0 | ▶ | return ($xmlDoc && $xmlDoc->isa("XML::LibXML::Document"))?$xmlDoc->documentElement:$xmlDoc; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$xmlDoc and $xmlDoc->isa("XML::LibXML::Document")
MC/DC0%0/2
$xmlDoc and $xmlDoc->isa("XML::LibXML::Document")
$xmlDoc
$xmlDoc->isa("XML::LibXML::Document")
Truth table0%0/3
A and B
A= $xmlDocB= $xmlDoc->isa("XML::LibXML::Document")
| |||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | =item toString() | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | return a string representation of this object | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | =cut | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | 0 | ▶ | sub toString { | ||||||||||||||||||||||||||
|
Subroutine
toString: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 109 | 0 | return $_[0]->getId; | |||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | =item getId | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | returns the unique ID of the change entry. | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | =cut | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | 0 | ▶ | sub getId { | ||||||||||||||||||||||||||
|
Subroutine
getId: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 119 | 0 | return $_[0]->{xmlDoc}->findvalue($CMIS_XPATH_ID); | |||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | =item getTitle -> $title | ||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | returns the value of the object's atom:title property. | ||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | =cut | ||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | 0 | ▶ | sub getTitle { | ||||||||||||||||||||||||||
|
Subroutine
getTitle: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 130 | 0 | my $this = shift; | |||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | 0 | ▶ | unless (defined $this->{title}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 133 | 0 | $this->{title} = $this->_getDocumentElement->findvalue($CMIS_XPATH_TITLE); | |||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | 0 | return $this->{title}; | |||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | =item getSummary -> $summary | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | returns the value of the object's atom:summary property. | ||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | =cut | ||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | 0 | ▶ | sub getSummary { | ||||||||||||||||||||||||||
|
Subroutine
getSummary: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 146 | 0 | my $this = shift; | |||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | 0 | ▶ | unless ($this->{summary}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 149 | 0 | $this->{summary} = $this->_getDocumentElement->findvalue($CMIS_XPATH_SUMMARY); | |||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | 0 | return $this->{summary}; | |||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | =item updateSummary($text) -> $this | ||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||
| 157 | changes the atom:summary of this object | ||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | Warning: some repos don't maintain the atom:summary field. As a consequence, | ||||||||||||||||||||||||||||
| 160 | updateSummary() might fail with a C<400 Bad Request> error message. Try using | ||||||||||||||||||||||||||||
| 161 | the dublin core's dc:description via L<WebService::Cmis::Object::updateProperties> for that | ||||||||||||||||||||||||||||
| 162 | instead. | ||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | =cut | ||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | 0 | ▶ | sub updateSummary { | ||||||||||||||||||||||||||
|
Subroutine
updateSummary: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 167 | 0 | my ($this, $text) = @_; | |||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | # get the self link | ||||||||||||||||||||||||||||
| 170 | 0 | my $selfUrl = $this->getSelfLink; | |||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | # build the entry based on the properties provided | ||||||||||||||||||||||||||||
| 173 | 0 | my $xmlEntryDoc = $this->{repository}->createEntryXmlDoc(summary => $text); | |||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | # do a PUT of the entry | ||||||||||||||||||||||||||||
| 176 | 0 | my $result = $this->{repository}{client}->put($selfUrl, $xmlEntryDoc->toString, ATOM_XML_TYPE); | |||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | # reset the xmlDoc for this object with what we got back from | ||||||||||||||||||||||||||||
| 179 | # the PUT, then call initData we dont' want to call | ||||||||||||||||||||||||||||
| 180 | # self.reload because we've already got the parsed XML-- | ||||||||||||||||||||||||||||
| 181 | # there's no need to fetch it again | ||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | 0 | $this->{xmlDoc} = $result; | |||||||||||||||||||||||||||
| 184 | 0 | $this->_initData; | |||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | 0 | return $this; | |||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | =item getUpdated -> $epoch | ||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | returns the value of the object's atom:updated property. | ||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | =cut | ||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | 0 | ▶ | sub getUpdated { | ||||||||||||||||||||||||||
|
Subroutine
getUpdated: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 197 | 0 | my $this = shift; | |||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | 0 | ▶ | unless ($this->{updated}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 200 | 0 | require WebService::Cmis::Property; | |||||||||||||||||||||||||||
| 201 | 0 | $this->{updated} = WebService::Cmis::Property::parseDateTime($this->_getDocumentElement->findvalue($CMIS_XPATH_UPDATED)); | |||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||
| 204 | 0 | return $this->{updated}; | |||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||
| 207 | =item getPublished -> $epoch | ||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | returns the value of the object's atom:published property, | ||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||
| 211 | =cut | ||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | 0 | ▶ | sub getPublished { | ||||||||||||||||||||||||||
|
Subroutine
getPublished: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 214 | 0 | my $this = shift; | |||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | 0 | ▶ | unless ($this->{published}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 217 | 0 | require WebService::Cmis::Property; | |||||||||||||||||||||||||||
| 218 | 0 | $this->{published} = WebService::Cmis::Property::parseDateTime($this->_getDocumentElement->findvalue($CMIS_XPATH_PUBLISHED)); | |||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | 0 | return $this->{published}; | |||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||
| 224 | =item getEdited -> $epoch | ||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | returns the value of the object's app:edited property, | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | =cut | ||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | 0 | ▶ | sub getEdited { | ||||||||||||||||||||||||||
|
Subroutine
getEdited: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 231 | 0 | my $this = shift; | |||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||
| 233 | 0 | ▶ | unless ($this->{edited}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 234 | 0 | require WebService::Cmis::Property; | |||||||||||||||||||||||||||
| 235 | 0 | $this->{edited} = WebService::Cmis::Property::parseDateTime($this->_getDocumentElement->findvalue($CMIS_XPATH_EDITED)); | |||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | 0 | return $this->{edited}; | |||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||
| 242 | =item getAuthor -> $author | ||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | returns the value of the object's atom:author property. | ||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||
| 246 | =cut | ||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||
| 248 | 0 | ▶ | sub getAuthor { | ||||||||||||||||||||||||||
|
Subroutine
getAuthor: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 249 | 0 | my $this = shift; | |||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||
| 251 | 0 | ▶ | unless ($this->{author}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 252 | 0 | $this->{author} = $this->_getDocumentElement->findvalue($CMIS_XPATH_AUTHOR); | |||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||
| 255 | 0 | return $this->{author}; | |||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | =item getLink($relation, $linkType) -> $href | ||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | returns the href attribute of an Atom link element for the | ||||||||||||||||||||||||||||
| 261 | specified relation. | ||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||
| 263 | =cut | ||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||
| 265 | 0 | ▶ | sub getLink { | ||||||||||||||||||||||||||
|
Subroutine
getLink: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||
| 266 | 0 | my ($this, $relation, $linkType, $dontReload) = @_; | |||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | 0 | ▶ | $relation = '*' unless defined $relation; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||
| 270 | 0 | ▶ | my $selector = $relation eq '*'? | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 271 | './*[local-name() = "link" and namespace-uri() = "'.ATOM_NS.'"]': | ||||||||||||||||||||||||||||
| 272 | './*[local-name() = "link" and namespace-uri() = "'.ATOM_NS.'" and @rel="'.$relation.'"]'; | ||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||
| 274 | 0 | my @nodes = $this->_getDocumentElement->findnodes($selector); | |||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | 0 | foreach my $linkElement (@nodes) { | |||||||||||||||||||||||||||
| 277 | 0 | my $attrs = $linkElement->attributes; | |||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||
| 279 | 0 | ▶ | if (defined $linkType) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 280 | 0 | my $type = $attrs->getNamedItem('type'); | |||||||||||||||||||||||||||
| 281 | 0 | ▶ | next unless $type && $type->value =~ /$linkType/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$type and $type->value =~ /$linkType/
MC/DC0%0/2
$type and $type->value =~ /$linkType/
$type
$type->value =~ /$linkType/
Truth table0%0/3
A and B
A= $typeB= $type->value =~ /$linkType/
| |||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||
| 283 | 0 | my $href = $attrs->getNamedItem('href')->value; | |||||||||||||||||||||||||||
| 284 | 0 | return $href; | |||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | # try again by reloading the object | ||||||||||||||||||||||||||||
| 288 | 0 | ▶ | unless ($dontReload) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 289 | 0 | $this->reload; | |||||||||||||||||||||||||||
| 290 | 0 | return $this->getLink($relation, $linkType, 1); | |||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||
| 293 | 0 | return; | |||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||
| 297 | =back | ||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||
| 299 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | Michael Daum C<< <daum@michaeldaumconsulting.com> >> | ||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||
| 303 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||
| 305 | Copyright 2012-2013 Michael Daum | ||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||
| 307 | This module is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||
| 308 | the same terms as Perl itself. See F<http://dev.perl.org/licenses/artistic.html>. | ||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||
| 310 | =cut | ||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||
| 312 | 1 | 1; | |||||||||||||||||||||||||||