blib/lib/Perlilog/sysclasses/PLport.pl untested

filter: Statementstmt 0.0% 0 / 17 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 3 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 31 CC 5 SCAR 26.0
CC
5
Cov
0%
who
20.0
new
6.0
setparent
2.0
CRAP 13.4
1 #
2 # This file is part of the Perlilog project.
3 #
4 # Copyright (C) 2003, Eli Billauer
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #
20 # A copy of the license can be found in a file named "licence.txt", at the
21 # root directory of this project.
22 #
23  
24 # Perlilog's basic port class
25 ${__PACKAGE__.'::errorcrawl'}='system';
26  
27 sub new {
28 my $this = shift;
29 my $self = $this->SUPER::new(@_);
30  
31 puke($self->who()." does not have a parent\n")
32 unless (ref($self->get('parent')));
33  
34 return $self;
35 }
36  
37 sub who {
38 my $self = shift;
39  
40 my $parent = $self->get('parent');
41 my $owned = $self->isobject($parent) ? ' owned by '.$parent->who : '';
42  
43 my $sus = $self -> get('perlilog-transient');
44  
45 if (not (defined $sus)) {
46 return "port \'".$self->get('name')."\'$owned";
47 } elsif ($sus eq 'transient') {
48 return "(transient) port \'".$self->get('nick')."\'$owned";
49 } else {
50 return "auto. gen. port \'".$self->get('name')."\'$owned";
51 }
52 }
53  
54 # We override the setparent method for ports.
55 sub setparent {
56 my ($self, $papa)=@_;
57 $self->const('parent', $papa);
58 $papa->ppush('ports',$self);
59 }