ClassDiagram/GlobalVar.pm untested

filter: Statementstmt 0.0% 0 / 31 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 49 CC 5 SCAR 22.3
CC
5
Cov
0%
new
20.0
class
6.0
render
2.0
CRAP 9.3
1 package GraphViz::Diagram::ClassDiagram::GlobalVar;
2 #_{ use
3 use warnings;
4 use strict;
5 use Carp;
6 #_}
7 use GraphViz::Diagram::ClassDiagram::Node_;
8  
9 our $VERSION = $GraphViz::Diagram::ClassDiagram::VERSION;
10 our @ISA = qw(GraphViz::Diagram::ClassDiagram::Node_);
11 #_{ POD: Methods
12 =head1 METHODS
13  
14 =cut
15 #_}
16 sub new { #_{
17 #_{ POD
18 =head2 new
19  
20 Creates an instance for a C<GlobalVar>. Should (as of now) not be called by the user.
21 It's called by L<GraphViz::Diagram::ClassDiagram/global_var> instead.
22  
23 =cut
24 #_}
25  
26 my $class = shift;
27 my $class_name = shift;
28 my $class_diagram = shift; # The class diagram on which this class should be drawn
29  
30 # my $opts = shift // {};
31  
32 croak "GlobalVar - new, class=$class instead GraphViz::Diagram::ClassDiagram::GlobalVar" unless $class eq 'GraphViz::Diagram::ClassDiagram::GlobalVar';
33 croak "GlobalVar - new, class_name=$class_name instead of a string" if ref $class_name;
34 croak "GlobalVar - new, class_diagram=$class_diagram instead of GraphViz::Diagram::ClassDiagram" unless ref $class_diagram eq 'GraphViz::Diagram::ClassDiagram';
35  
36 my $self = $class->GraphViz::Diagram::ClassDiagram::Node_::new($class_name, $class_diagram);
37  
38 return $self;
39  
40  
41 } #_}
42 sub class { #{
43 #_{ POD
44 =head2 class
45  
46 my $class_diagram = GraphViz::Diagram::ClassDiagram->new('foo.png');
47  
48 my $CFoo = $class_diagram->class ('CFoo' );
49 my $g_foo = $class_diagram->global_var('g_foo')
50  
51 $g_foo->class($CFoo);
52  
53 $class_diagram->create();
54  
55  
56 Specify the class of the GlobalVar.
57  
58 =cut
59 #_}
60  
61 my $self = shift;
62 my $class = shift;
63  
64 croak "GraphViz::Diagram::ClassDiagram::GlobalVar - class: $class is not a GraphViz::Diagram::ClassDiagram::Class" unless $class->isa('GraphViz::Diagram::ClassDiagram::Class');
65  
66 my $edge = $self->{class_diagram}->edge($self, $class);
67 $edge->arrow_end('none');
68  
69 } #}
70 sub render {
71 #_{ POD
72 =head2 render
73  
74 Renders the html for the GlobalVar. Should not be called by the user, it's called
75 by L<GraphViz::Diagram::ClassDiagram/create>.
76  
77 =cut
78 #_}
79  
80 my $self = shift;
81  
82 $self->label({html=>
83 "<font face='Courier' color='#e73915'>$self->{name}</font>"
84 }
85 );
86 }
87  
88 'tq84';