blib/lib/Perlilog/siteclasses/vars2vars.pl untested

filter: Statementstmt 0.0% 0 / 22 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 2 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 30 CC 3 SCAR 17.9
CC
3
Cov
0%
attempt
6.0
generate
6.0
CRAP 6.0
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 sub attempt {
25 my $this = shift;
26  
27 # All vars?
28 return undef
29 if (grep {ref ne 'vars'} @_);
30  
31 my $self = $this->new(nick => 'vars_connection');
32 return $self;
33  
34 }
35  
36 sub generate {
37 my $self = shift;
38  
39 # Get the ports to connect...
40 my @ports = $self->get('perlilog-ports-to-connect');
41  
42 my %conn = ();
43 foreach my $port (@ports) {
44 my %h = $self->labelID($port);
45 { # We disable warnings for this block...
46 local $SIG{__WARN__};
47 $SIG{__WARN__} = sub { }; # No warnings here, please
48  
49 foreach my $label (sort keys %h) {
50 $conn{$label} = join(',', (split(',', $conn{$label}), $h{$label}));
51 }
52 }
53 }
54  
55 foreach my $label (sort keys %conn) {
56 my @IDs = split(',', $conn{$label});
57 my $first = shift(@IDs);
58 fishy("The label \'$label\' has no counterpart while connecting the following ports:\n".
59 join("\n", map {$self->safewho($_); } @ports)."\n")
60 unless @IDs;
61 foreach my $second (@IDs) {
62 $self->attach($first, $second);
63 }
64 }
65 }