| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WWW::PlantUML; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
135375
|
use 5.006; |
|
|
2
|
|
|
|
|
15
|
|
|
4
|
2
|
|
|
2
|
|
10
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
44
|
|
|
5
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
|
2
|
|
|
|
|
9
|
|
|
|
2
|
|
|
|
|
97
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
11
|
use Carp; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
164
|
|
|
8
|
2
|
|
|
2
|
|
996
|
use UML::PlantUML::Encoder qw(encode_p); |
|
|
2
|
|
|
|
|
164648
|
|
|
|
2
|
|
|
|
|
469
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
WWW::PlantUML - a simple Perl remote client interface to a plantuml server. |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 VERSION |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Version 0.01 |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=cut |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
|
21
|
|
|
|
|
|
|
our $URL = 'http://www.plantuml.com/plantuml'; |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use WWW::PlantUML; |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $puml = WWW::PlantUML->new; |
|
28
|
|
|
|
|
|
|
my $url = $puml->fetch_url(qq{ |
|
29
|
|
|
|
|
|
|
Alice -> Bob : hello |
|
30
|
|
|
|
|
|
|
}, 'png'); |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
print $url; |
|
33
|
|
|
|
|
|
|
# prints http://www.plantuml.com/plantuml/png/69NZKb1moazIqBLJSCp9J4vLi5B8ICt9oUS204a_1dy0 |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Plantuml is a library for generating UML diagrams from a simple text markup language. |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
This is a simple Perl remote client interface to a plantuml server using the same custom encoding used by most other plantuml clients. Perl was missing from the list. |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
There are other plantuml Perl libraries, like PlantUML::ClassDiagram::Parse, they provide only parsing capabilities for Class Diagrams. In contrast WWW::PlantUML module provides accessing any UML Diagram Type in various formats supported by any plantUML server via HTTP Protocol. |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
This client defaults to the public plantuml server, but can be used against any server. |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 new |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Constructor. |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Can be optionally passed a URL to the PlantUML Server. |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Defaults to http://www.plantuml.com/plantuml |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub new { |
|
58
|
1
|
|
|
1
|
1
|
892
|
my $class = shift; |
|
59
|
1
|
|
|
|
|
2
|
my $url = shift; |
|
60
|
|
|
|
|
|
|
my %args = ( |
|
61
|
1
|
|
33
|
|
|
13
|
'baseurl' => $url || $ENV{PLANTUML_BASE_URL} || $URL, |
|
62
|
|
|
|
|
|
|
'contexts' => ( 'png', 'svg', 'txt' ), |
|
63
|
|
|
|
|
|
|
@_, |
|
64
|
|
|
|
|
|
|
); |
|
65
|
|
|
|
|
|
|
|
|
66
|
1
|
|
|
|
|
8
|
return bless {%args}, $class; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head2 fetch_url |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
First parameter is PlantUML Syntax as a String. |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Optionally second parameter is the format of the generated diagram as a String. |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Default is Text Format. |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub fetch_url { |
|
80
|
1
|
|
|
1
|
1
|
5
|
my $self = shift; |
|
81
|
1
|
|
|
|
|
5
|
my $base = $self->{'baseurl'}; |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
#my $path = $self->{'infopath'}; |
|
84
|
|
|
|
|
|
|
#my ( $type, $code ) = $self->_parse_args(@_); |
|
85
|
1
|
|
|
|
|
2
|
my $code = shift; |
|
86
|
1
|
|
|
|
|
3
|
my $type = shift; |
|
87
|
|
|
|
|
|
|
|
|
88
|
1
|
|
|
|
|
3
|
my $ncoded = encode_p($code); |
|
89
|
1
|
50
|
|
|
|
1479
|
my $url = defined $type ? "$base/$type/$ncoded" : "$base/txt/$ncoded"; |
|
90
|
1
|
|
|
|
|
6
|
return $url; |
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 AUTHOR |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Rangana Sudesha Withanage, C<< >> |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 BUGS |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
|
100
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
|
101
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 SUPPORT |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
perldoc WWW::PlantUML |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
You can also look for information at: |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=over 4 |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker (report bugs here) |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
L |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
L |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=item * CPAN Ratings |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
L |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=item * Search CPAN |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
L |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=back |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
This software is copyright (c) 2019 by Rangana Sudesha Withanage. |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
142
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=cut |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
1; # End of WWW::PlantUML |