| 1 | package Net::Amazon::S3::Request::Role::XML::Content; | ||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Role providing XML content | ||||||||||||||||||||||||||||
| 3 | 99 | $Net::Amazon::S3::Request::Role::XML::Content::VERSION = '0.992'; | |||||||||||||||||||||||||||
| 4 | 99 | ▶ | use Moose::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 99 | with 'Net::Amazon::S3::Request::Role::HTTP::Header::Content_length'; | |||||||||||||||||||||||||||
| 7 | 99 | with 'Net::Amazon::S3::Request::Role::HTTP::Header::Content_type' => { content_type => 'application/xml' }; | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 39 | ▶ | sub _build_xml { | ||||||||||||||||||||||||||
|
Subroutine
_build_xml: called CC=6 SCAR=18.0
| |||||||||||||||||||||||||||||
| 10 | 39 | my ($self, $root_name, $root_content) = @_; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 39 | my $ns = Net::Amazon::S3::Constants->S3_NAMESPACE_URI; | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 39 | my $xml_doc = XML::LibXML::Document->new ('1.0','UTF-8'); | |||||||||||||||||||||||||||
| 15 | 39 | my $root_element = $xml_doc->createElementNS ($ns, $root_name); | |||||||||||||||||||||||||||
| 16 | 39 | $xml_doc->setDocumentElement ($root_element); | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 39 | my @queue = ([ $root_element, $root_content ]); | |||||||||||||||||||||||||||
| 19 | 39 | ▶ | while (my $node = shift @queue) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 20 | 117 | my ($parent, $content) = @$node; | |||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 117 | for my $tag (@$content) { | |||||||||||||||||||||||||||
| 23 | 195 | my ($tag_name, $tag_content) = %$tag; | |||||||||||||||||||||||||||
| 24 | 195 | my $tag_node = $parent->addNewChild ($ns, $tag_name); | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 195 | ▶ | if (ref $tag_content) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 27 | 78 | push @queue, [$tag_node, $tag_content]; | |||||||||||||||||||||||||||
| 28 | 78 | next; | |||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 117 | ▶ | if (defined $tag_content && length $tag_content) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $tag_content and length $tag_content
MC/DC0%0/2
defined $tag_content and length $tag_content
defined $tag_content
length $tag_content
Truth table33%1/3
A and B
A= defined $tag_contentB= length $tag_content
| |||||||||||||||||||||||||||||
| 32 | 117 | $tag_node->addChild ($xml_doc->createTextNode ($tag_content)); | |||||||||||||||||||||||||||
| 33 | 117 | next; | |||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 39 | $xml_doc->toString; | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 99 | 1; | |||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | __END__ | ||||||||||||||||||||||||||||