Gungho/Plugin/Statistics/Format/XML.pm untested

filter: Statementstmt 0.0% 0 / 28 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 39 CC 2 SCAR 12.0
CC
2
Cov
0%
format
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 3.3
1 # $Id: /mirror/gungho/lib/Gungho/Plugin/Statistics/Format/XML.pm 4238 2007-10-29T15:08:17.605700Z lestrrat $
2  
3 package Gungho::Plugin::Statistics::Format::XML;
4 use strict;
5 use warnings;
6 use base qw(Gungho::Base);
7 use XML::LibXML;
8  
9 sub format
10 {
11 my ($self, $storage, $output) = @_;
12  
13 $output ||= \*STDOUT;
14  
15 my $doc = XML::LibXML::Document->new("1.0", "UTF-8");
16 my $root = $doc->createElement('GunghoStatstics');
17 $doc->setDocumentElement( $root );
18  
19 my $parent = $root;
20 foreach my $name qw(active_requests finished_requests) {
21 my $tag = $name;
22 $tag =~ s/(?:\b|_)(.)/uc $1/ge;
23 my $el = $doc->createElement($tag);
24 my $value = $storage->get($name);
25 if (defined $value) {
26 $el->appendText($value);
27 }
28 $parent->appendChild($el);
29 }
30  
31 print $output $doc->toString();
32 }
33  
34 1;
35  
36 __END__