Quiq/Confluence/Page.pm

filter: Statementstmt 59.3% 19 / 32 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 46.1% 6 / 13 Podpod 100% 7 / 7 totaltotal 43.2% 32 / 74 CC 6 SCAR 13.6
CC
6
Cov
41%
new
6.0
id
6.0
space
6.0
CRAP 3.9
« Quiq/Ipc.pm ↑ Summary Quiq/Html/Resources.pm »
1 # -----------------------------------------------------------------------------
2  
3 =encoding utf8
4  
5 =head1 NAME
6  
7 Quiq::Confluence::Page - Confluence-Wiki Seite
8  
9 =head1 BASE CLASS
10  
11 L<Quiq::Hash>
12  
13 =head1 DESCRIPTION
14  
15 Ein Objekt der Klasse kapselt den Body der HTTP Antwort einer
16 getPage()-Operation des Confluence-Client (Klasse
17 Quiq::Confluence::Client). Mit den Methoden der Klasse kann
18 auf die Information in der Antwort zugegriffen werden.
19  
20 =cut
21  
22 # -----------------------------------------------------------------------------
23  
24 package Quiq::Confluence::Page;
25 2 ▶use base qw/Quiq::Hash/;
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 2 ▶use v5.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
30  
31 2 our $VERSION = '1.240';
32  
33 2 ▶use JSON ();
Subroutine BEGIN: called CC=1 SCAR=0.0
34 2 ▶use Quiq::Debug;
Subroutine BEGIN: called CC=1 SCAR=0.0
35  
36 # -----------------------------------------------------------------------------
37  
38 =head1 METHODS
39  
40 =head2 Konstruktor
41  
42 =head3 new() - Konstruktor
43  
44 =head4 Synopsis
45  
46 $pag = $class->new($json);
47  
48 =head4 Arguments
49  
50 =over 4
51  
52 =item $json
53  
54 Body der HTTP-Antwort der getPage()-Operation. Der Body enthält
55 die JSON-Repräsentation der Seite.
56  
57 =back
58  
59 =head4 Returns
60  
61 Page-Objekt (Klasse Quiq::Confluence::Page)
62  
63 =head4 Description
64  
65 Instantiiere ein Confluence Seiten-Objekt und liefere eine Referenz
66 auf dieses Objekt zurück.
67  
68 =cut
69  
70 # -----------------------------------------------------------------------------
71  
72 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod documented
73 0 my ($class,$json) = @_;
74  
75 0 ▶ return $class->SUPER::new(
Branch: 1 branch
BranchTrueFalseTotal
$json ? : 0 0 0
76 perl => $json? JSON::decode_json($json) : undef,
77 );
78 }
79  
80 # -----------------------------------------------------------------------------
81  
82 =head2 Hash-Zugriff
83  
84 =head3 hash() - Hash der JSON-Struktur
85  
86 =head4 Synopsis
87  
88 $h = $pag->hash;
89  
90 =head4 Returns
91  
92 Space (String)
93  
94 =head4 Description
95  
96 Liefere eine Referenz auf den Hash, der der JSON-Struktur der
97 Seite entspricht.
98  
99 =cut
100  
101 # -----------------------------------------------------------------------------
102  
103 0 ▶sub hash {
Subroutine hash: not called CC=1 SCAR=6.9
Pod documented
104 0 return shift->{'perl'};
105 }
106  
107 # -----------------------------------------------------------------------------
108  
109 =head2 Akzessoren
110  
111 =head3 id() - Id der Seite
112  
113 =head4 Synopsis
114  
115 $id = $pag->id;
116  
117 =head4 Returns
118  
119 Space (integer)
120  
121 =head4 Description
122  
123 Liefere die Id der Seite.
124  
125 =cut
126  
127 # -----------------------------------------------------------------------------
128  
129 0 ▶sub id {
Subroutine id: not called CC=2 SCAR=17.9
Pod documented
130 0 my $self = shift;
131 0 ▶ return $self->{'perl'}->{'id'} || $self->throw;
Condition0%0/3
$self->{'perl'}{'id'} || $self->throw
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{'perl'}{'id'} || $self->throw
$self->{'perl'}{'id'} $self->throw
Truth table0%0/3
A || B
A= $self->{'perl'}{'id'}B= $self->throw
ABresult
1X1
011
000
132 }
133  
134 # -----------------------------------------------------------------------------
135  
136 =head3 space() - Name des Space, in dem die Seite liegt
137  
138 =head4 Synopsis
139  
140 $space = $pag->space;
141  
142 =head4 Returns
143  
144 Space (String)
145  
146 =head4 Description
147  
148 Liefere den Namen des Space, in dem die Seite liegt.
149  
150 =cut
151  
152 # -----------------------------------------------------------------------------
153  
154 0 ▶sub space {
Subroutine space: not called CC=2 SCAR=17.9
Pod documented
155 0 my $self = shift;
156 0 ▶ return $self->{'perl'}->{'space'}->{'key'} || $self->throw;
Condition0%0/3
$self->{'perl'}{'space'}{'key'} || $self->throw
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{'perl'}{'space'}{'key'} || $self->throw
$self->{'perl'}{'space'}{'key'} $self->throw
Truth table0%0/3
A || B
A= $self->{'perl'}{'space'}{'key'}B= $self->throw
ABresult
1X1
011
000
157 }
158  
159 # -----------------------------------------------------------------------------
160  
161 =head3 title() - Titel der Seite
162  
163 =head4 Synopsis
164  
165 $title = $pag->title;
166  
167 =head4 Returns
168  
169 Seitentitel (String)
170  
171 =head4 Description
172  
173 Liefere den Titel der Seite. Der Seitentitel ist unabhängig
174 vom Seiteninhalt.
175  
176 =cut
177  
178 # -----------------------------------------------------------------------------
179  
180 0 ▶sub title {
Subroutine title: not called CC=2 SCAR=17.9
Pod documented
181 0 my $self = shift;
182 0 ▶ return $self->{'perl'}->{'title'} || $self->throw;
Condition0%0/3
$self->{'perl'}{'title'} || $self->throw
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{'perl'}{'title'} || $self->throw
$self->{'perl'}{'title'} $self->throw
Truth table0%0/3
A || B
A= $self->{'perl'}{'title'}B= $self->throw
ABresult
1X1
011
000
183 }
184  
185 # -----------------------------------------------------------------------------
186  
187 =head3 version() - Version der Seite
188  
189 =head4 Synopsis
190  
191 $n = $pag->version;
192  
193 =head4 Returns
194  
195 Versionsnummer (Integer)
196  
197 =head4 Description
198  
199 Liefere die Version der Seite. Dies ist eine ganze Zahl > 0.
200  
201 =cut
202  
203 # -----------------------------------------------------------------------------
204  
205 0 ▶sub version {
Subroutine version: not called CC=2 SCAR=17.9
Pod documented
206 0 my $self = shift;
207 0 ▶ return $self->{'perl'}->{'version'}->{'number'} || $self->throw;
Condition0%0/3
$self->{'perl'}{'version'}{'number'} || $self->throw
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{'perl'}{'version'}{'number'} || $self->throw
$self->{'perl'}{'version'}{'number'} $self->throw
Truth table0%0/3
A || B
A= $self->{'perl'}{'version'}{'number'}B= $self->throw
ABresult
1X1
011
000
208 }
209  
210 # -----------------------------------------------------------------------------
211  
212 =head2 Debugging
213  
214 =head3 asString() - Perl-Repräsentation als Zeichenkette
215  
216 =head4 Synopsis
217  
218 $str = $pag->asString;
219  
220 =head4 Returns
221  
222 Perl-Datenstruktur (als Text)
223  
224 =head4 Description
225  
226 Der Konstruktor der Klasse wandelt die JSON-Darstellung der Seite
227 in eine analoge Perl-Datenstruktur. Diese Methode liefert die
228 Zeichenketten-Repäsentation dieser Perl-Datenstruktur.
229  
230 =cut
231  
232 # -----------------------------------------------------------------------------
233  
234 0 ▶sub asString {
Subroutine asString: not called CC=1 SCAR=6.9
Pod documented
235 0 my $self = shift;
236 0 return Quiq::Debug->dump($self->{'perl'});
237 }
238  
239 # -----------------------------------------------------------------------------
240  
241 =head1 VERSION
242  
243 1.240
244  
245 =head1 AUTHOR
246  
247 Frank Seitz, L<http://fseitz.de/>
248  
249 =head1 COPYRIGHT
250  
251 Copyright (C) 2026 Frank Seitz
252  
253 =head1 LICENSE
254  
255 This code is free software; you can redistribute it and/or modify
256 it under the same terms as Perl itself.
257  
258 =cut
259  
260 # -----------------------------------------------------------------------------
261  
262 2 1;
263  
264 # eof
« Quiq/Ipc.pm ↑ Summary Quiq/Html/Resources.pm »