Visio/PageSheet.pm

filter: Statementstmt 56.8% 29 / 51 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 9 / 12 Podpod 0.0% 0 / 3 totaltotal 54.2% 38 / 70 CC 3 SCAR 9.2
CC
3
Cov
53%
new
6.0
create_pageProps
6.0
get_node
2.0
CRAP 2.5
« Visio/Line.pm ↑ Summary Visio/PageProps.pm »
1 package Visio::PageSheet;
2  
3  
4 #PLEASE SEE MSPATENTLICENSE
5 # "This product may incorporate intellectual property owned by
6 # Microsoft Corporation. The terms and conditions upon which Microsoft
7 # is licensing such intellectual property may be found at
8 # http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp"
9  
10  
11 # Copyright 2005 Aamer Akhter. All rights reserved.
12  
13 # Redistribution and use in source and binary forms, with or without
14 # modification, are permitted provided that the following conditions are
15 # met:
16  
17 # 1. Redistributions of source code must retain the above copyright
18 # notice, this list of conditions and the following disclaimer.
19  
20 # 2. Redistributions in binary form must reproduce the above copyright
21 # notice, this list of conditions and the following disclaimer in the
22 # documentation and/or other materials provided with the distribution.
23  
24 # THIS SOFTWARE IS PROVIDED BY THE LICENSOR(S) ``AS IS'' AND ANY EXPRESS
25 # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 # DISCLAIMED. IN NO EVENT SHALL THE LICENSOR(S) OR OTHER CONTRIBUTORS BE
28 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
31 # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
32 # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
33 # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
34 # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35  
36 # The views and conclusions contained in the software and documentation
37 # are those of the authors and should not be interpreted as representing
38 # official policies, either expressed or implied, of the Licensor(s).
39  
40 # The software may be subject to additional license restrictions
41 # provided by the Licensor(s).
42  
43  
44  
45 1 ▶use 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
46 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
47 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
48 1 ▶use Log::Log4perl qw(get_logger);
Subroutine BEGIN: called CC=1 SCAR=0.0
49 1 ▶use XML::LibXML;
Subroutine BEGIN: called CC=1 SCAR=0.0
50 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
51 1 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
52 1 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
53  
54  
55 1 ▶use Visio::PageProps;
Subroutine BEGIN: called CC=1 SCAR=0.0
56  
57 1 $VERSION = sprintf "%d.%03d", q$Revision: 1.5 $ =~ /: (\d+)\.(\d+)/;
58  
59 1 my $log = get_logger('visio.pagesheet');
60  
61 # Preloaded methods go here.
62  
63 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod undocumented
64 0 my $class = shift;
65 0 my $parentN = shift;
66 0 my $self = {};
67 0 $self->{parentN} = $parentN;
68 0 $self->{xmldoc} = $parentN->ownerDocument;
69 0 $self->{xmlroot} = $self->{xmldoc}->documentElement;
70 0 bless($self,$class);
71 0 my $psNL = $self->{parentN}->findnodes('PageSheet');
72 0 ▶ if ($psNL->size() > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($psNL->size > 0) { } 0 0 0
73 0 $self->{psNode} = $psNL->pop();
74 0 $log->debug("visio pagesheet object already exists");
75 } else {
76 0 $self->{psNode} = $self->{xmldoc}->createElement('PageSheet');
77 0 $self->{parentN}->appendChild($self->{psNode});
78 #lets create the page
79 0 $log->debug("visio pagesheet object created");
80 }
81 0 return $self;
82 }
83  
84 0 ▶sub get_node {
Subroutine get_node: not called CC=1 SCAR=6.9
Pod undocumented
85 0 my $self = shift;
86 0 return $self->{psNode};
87 }
88  
89 0 ▶sub create_pageProps {
Subroutine create_pageProps: not called CC=2 SCAR=17.9
Pod undocumented
90 #if pagePropsdoesn't exist, create it;
91 0 my $self = shift;
92 0 ▶ if (defined $self->{pageProps}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{'pageProps'}) { } 0 0 0
93 0 return $self->{pageProps};
94 } else {
95 $self->{pageProps} =
96 0 new Visio::PageProps($self->{psNode});
97 0 return $self->{pageProps};
98 }
99 }
100  
101 1 1;
102 __END__
« Visio/Line.pm ↑ Summary Visio/PageProps.pm »