Config.pm

filter: Statementstmt 14.1% 12 / 85 Branchbran 0.0% 0 / 30 Conditioncond 0.0% 0 / 18 MC/DCmcdc 0.0% 0 / 9 Subroutinesub 18.1% 2 / 11 Podpod 0.0% 0 / 8 totaltotal 8.7% 14 / 161 CC 22 SCAR 31.3
CC
22
Cov
9%
local_user
42.0
remote_user
42.0
home
20.0
CRAP 22.9
« Handle.pm ↑ Summary
1 # -*- Mode: Perl -*-
2 # Config.pm --
3 # ITIID : $ITI$ $Header $__Header$
4 # Author : Ulrich Pfeifer
5 # Created On : Sat Sep 28 13:53:36 1996
6 # Last Modified By: Ulrich Pfeifer
7 # Last Modified On: Mon Sep 30 08:55:23 1996
8 # Language : CPerl
9 # Update Count : 11
10 # Status : Unknown, Use with caution!
11 #
12 # (C) Copyright 1996, Universität Dortmund, all rights reserved.
13 #
14  
15 package NNML::Config;
16  
17 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use vars qw($VERSION @ISA @EXPORT_OK $Config);
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 1 require Exporter;
21  
22 1 @ISA = qw(Exporter);
23  
24 1 @EXPORT_OK = qw(
25 $Config
26 );
27  
28 1 $VERSION = '0.01';
29  
30  
31 1 $Config = bless {
32 'active' => q[~/active],
33 'base' => q[~/Mail],
34 'local_passwd' => q[],
35 'local_user' => q[~],
36 'mirror_host' => q[],
37 'mirror_port' => q[119],
38 'passwd' => q[~/passwd],
39 'port' => q[119],
40 'remote_passwd' => q[],
41 'remote_user' => q[~],
42 }, 'NNML::Config';
43  
44 0 ▶sub local_user {
Subroutine local_user: not called CC=6 SCAR=37.4
Pod undocumented
45 0 my $self = shift;
46 0 my $user;
47  
48 0 ▶ if (defined $user) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $user) 0 0 0
49 0 $self->{local_user} = $user;
50 0 delete $self->{_local_user};
51 }
52 0 ▶ return $self->{_local_user} if exists $self->{_local_user};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"_local_user"} 0 0 0
53 0 ▶ if ($self->{local_user} eq '~') {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'local_user'} eq '~') { } 0 0 0
54 0 ▶ my $user = $ENV{'USER'} || $ENV{'LOGNAME'} || getpwuid($<);
Condition0%0/6
$ENV{'USER'} || $ENV{'LOGNAME'} || getpwuid $<
l!l&&r!l&&!r
000
$ENV{"USER"} or $ENV{"LOGNAME"}
l!l&&r!l&&!r
000
MC/DC0%0/3
$ENV{'USER'} || $ENV{'LOGNAME'} || getpwuid $<
$ENV{"USER"} $ENV{"LOGNAME"} getpwuid $<
Truth table0%0/4
A or B || C
A= $ENV{"USER"}B= $ENV{"LOGNAME"}C= getpwuid $<
ABCresult
1XX1
01X1
0011
0000
55 0 $self->{_local_user} = $user;
56 } else {
57 0 $self->{_local_user} = $self->{local_user};
58 }
59 0 $self->{_local_user};
60 }
61  
62 0 ▶sub remote_user {
Subroutine remote_user: not called CC=6 SCAR=37.4
Pod undocumented
63 0 my $self = shift;
64 0 my $user;
65  
66 0 ▶ if (defined $user) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $user) 0 0 0
67 0 $self->{remote_user} = $user;
68 0 delete $self->{_remote_user};
69 }
70 0 ▶ return $self->{_remote_user} if exists $self->{_remote_user};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"_remote_user"} 0 0 0
71 0 ▶ if ($self->{remote_user} eq '~') {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'remote_user'} eq '~') { } 0 0 0
72 0 ▶ my $user = $ENV{'USER'} || $ENV{'LOGNAME'} || getpwuid($<);
Condition0%0/6
$ENV{'USER'} || $ENV{'LOGNAME'} || getpwuid $<
l!l&&r!l&&!r
000
$ENV{"USER"} or $ENV{"LOGNAME"}
l!l&&r!l&&!r
000
MC/DC0%0/3
$ENV{'USER'} || $ENV{'LOGNAME'} || getpwuid $<
$ENV{"USER"} $ENV{"LOGNAME"} getpwuid $<
Truth table0%0/4
A or B || C
A= $ENV{"USER"}B= $ENV{"LOGNAME"}C= getpwuid $<
ABCresult
1XX1
01X1
0011
0000
73 0 $self->{_remote_user} = $user;
74 } else {
75 0 $self->{_remote_user} = $self->{remote_user};
76 }
77 0 $self->{_remote_user};
78 }
79  
80 0 ▶sub home {
Subroutine home: not called CC=4 SCAR=30.0
Pod undocumented
81 0 my $self = shift;
82  
83 0 ▶ return $self->{_home} if exists $self->{_home};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"_home"} 0 0 0
84 0 ▶ my $user = $ENV{'USER'} || $ENV{'LOGNAME'} || getpwuid($<);
Condition0%0/6
$ENV{'USER'} || $ENV{'LOGNAME'} || getpwuid $<
l!l&&r!l&&!r
000
$ENV{"USER"} or $ENV{"LOGNAME"}
l!l&&r!l&&!r
000
MC/DC0%0/3
$ENV{'USER'} || $ENV{'LOGNAME'} || getpwuid $<
$ENV{"USER"} $ENV{"LOGNAME"} getpwuid $<
Truth table0%0/4
A or B || C
A= $ENV{"USER"}B= $ENV{"LOGNAME"}C= getpwuid $<
ABCresult
1XX1
01X1
0011
0000
85 0 my $home = (getpwnam($user))[7];
86 0 $self->{_home} = $home;
87 }
88  
89 0 ▶sub base {
Subroutine base: not called CC=3 SCAR=24.8
Pod undocumented
90 0 my $self = shift;
91 0 my $base = shift;
92  
93 0 ▶ if (defined $base) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $base) 0 0 0
94 0 $self->{base} = $base;
95 0 delete $self->{_base};
96 0 delete $self->{_active};
97 0 delete $self->{_passwd};
98 }
99 0 ▶ return $self->{_base} if exists $self->{_base};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"_base"} 0 0 0
100 0 $self->{_base} = $self->{base};
101 0 $self->{_base} =~ s/^~/$self->home/e;
102 0 $self->{_base};
103 }
104  
105 0 ▶sub spool {
Subroutine spool: not called CC=1 SCAR=6.9
Pod undocumented
106 0 my $self = shift;
107 0 $self->base . '/NNML.spool';
108 }
109  
110 0 ▶sub bad {
Subroutine bad: not called CC=1 SCAR=6.9
Pod undocumented
111 0 my $self = shift;
112 0 $self->base . '/NNML.bad';
113 }
114  
115 0 ▶sub active {
Subroutine active: not called CC=3 SCAR=24.8
Pod undocumented
116 0 my $self = shift;
117 0 my $active = shift;
118 0 ▶ if (defined $active) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $active) 0 0 0
119 0 $self->{active} = $active;
120 0 delete $self->{_active};
121 }
122 0 ▶ return $self->{_active} if exists $self->{_active};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"_active"} 0 0 0
123 0 $self->{_active} = $self->{active};
124 0 $self->{_active} =~ s/^~/$self->base/e;
125 0 $self->{_active};
126 }
127  
128 0 ▶sub passwd {
Subroutine passwd: not called CC=3 SCAR=24.8
Pod undocumented
129 0 my $self = shift;
130 0 my $passwd = shift;
131 0 ▶ if (defined $passwd) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $passwd) 0 0 0
132 0 $self->{passwd} = $passwd;
133 0 delete $self->{_passwd};
134 }
135 0 ▶ return $self->{_passwd} if exists $self->{_passwd};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"_passwd"} 0 0 0
136 0 $self->{_passwd} = $self->{passwd};
137 0 $self->{_passwd} =~ s/^~/$self->base/e;
138 0 $self->{_passwd};
139 }
140  
141 0 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: not called CC=3 SCAR=24.8
142 0 my $func = $NNML::Config::AUTOLOAD; $func =~ s/.*:://;
143 0 my $self = shift;
144 0 my $val = shift;
145 0 ▶ if (defined $val) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $val) { } 0 0 0
146 0 $self->{$func} = $val;
147 0 return $val;
148 } else {
149 0 ▶ if (exists $self->{$func}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{$func}) { } 0 0 0
150 0 return $self->{$func};
151 } else {
152 0 return undef;
153 }
154 }
155 }
156  
157 1 1;
158  
« Handle.pm ↑ Summary