CfgTie/TiePh.pm

filter: Statementstmt 12.0% 3 / 25 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 3 Podpod 100% 3 / 3 totaltotal 12.0% 6 / 50 CC 10 SCAR 42.3
CC
10
Cov
7%
scan
90.0
cfg_end
6.0
makerewrites
1.0
CRAP 68.6
« CfgTie/TieRCService.pm ↑ Summary Secure/File.pm »
1 #Copyright 1998-1999, Randall Maas. All rights reserved. This program is free
2 #software; you can redistribute it and/or modify it under the same terms as
3 #PERL itself.
4  
5  
6 #Author: Randall Maas (randym@acm.org)
7  
8 =head1 NAME
9  
10 C<CfgTie::TiePh> -- a ph phonebook server configuration tool
11  
12 =head1 SYNOPSIS
13  
14 Makes it easy to manage the ph phonebook server configuration files as a hash.
15  
16 tie %myhash, 'ph'
17  
18 %myhash{who}->{Person}
19  
20 =head1 DESCRIPTION
21  
22 This is a file to help configure the F<ph> program.
23  
24 tie %myhash, 'ph'
25  
26 %myhash{who}->{Person}
27 %myhash{who}->{Phone}
28  
29 =head2 Methods
30  
31 This inherits any methods from the C<CfgTie::Cfgfile> module
32 (L<CfgTie::Cfgfile>)
33  
34 =head1 See Also
35  
36 L<CfgTie::Cfgfile>, L<CfgTie::TieAliases>, L<CfgTie::TieGeneric>,
37 L<CfgTie::TieGroup>, L<CfgTie::TieHost>, L<CfgTie::TieMTab>,
38 L<CfgTie::TieNamed>, L<CfgTie::TieNet>, L<CfgTie::TiePh>,
39 L<CfgTie::TieProto>, L<CfgTie::TieRCService>, L<CfgTie::TieRsrc>,
40 L<CfgTie::TieServ>, L<CfgTie::TieShadow>, L<CfgTie::TieUser>
41  
42 =head1 Author
43  
44 Randall Maas (L<randym@acm.org>, L<http://www.hamline.edu/~rcmaas/>)
45  
46 =cut
47  
48 package CfgTie::TiePh;
49 1 require CfgTie::Cfgfile;
50 1 require Tie::Hash;
51 1 @ISA=qw(CfgTie::Cfgfile);
52  
53 sub scan
54 0 ▶{
Subroutine scan: not called CC=9 SCAR=45.0
Pod documented
55 0 my $self=shift;
56  
57 0 ▶ if (!exists $self->{Path} ||
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Path"} and defined !$self->{"Path"}) 0 0 0
Condition0%0/3
exists $self->{"Path"} and defined !$self->{"Path"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $self->{"Path"} and defined !$self->{"Path"}
exists $self->{"Path"} defined !$self->{"Path"}
Truth table0%0/3
A and not(B)
A= exists $self->{"Path"}B= defined !$self->{"Path"}
ABresult
0X0
100
111
58 0 !defined !$self->{Path}) {$self->{Path} = 'qi.input';}
59  
60 0 my $F = new Secure::File '<'.$self->{Path};
61 0 my ($who,$eml,$phn);
62 0 ▶ while (my $J = <$F>)
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $J = readline $F)) 0 0 0
63 {
64 0 foreach my $I (split("\t",$J))
65 {
66 0 $_ = $I;
67 0 ▶ if (/([^:\n]*):([^\n]*)/)
Branch: 1 branch
BranchTrueFalseTotal
if (/([^:\n]*):([^\n]*)/) 0 0 0
68 {
69 0 ▶ if ($1 == 3) {$who=$2;}
Branch: 3 branches
BranchTrueFalseTotal
if ($1 == 3) { } 0 0 0
elsif ($1 == 2) { } 0 0 0
elsif ($1 == 1) { } 0 0 0
70 0 elsif ($1==2) {$eml=$2;}
71 0 elsif ($1==1) {$phn=$2;}
72 }
73 }
74 0 $self->{Contents}->{$who}->{Person}=$eml;
75 0 $self->{Contents}->{$who}->{Phone} =$phn;
76 }
77 0 $F->close;
78 }
79  
80 0 ▶sub makerewrites {}
Subroutine makerewrites: not called CC=1 SCAR=0.0
Pod documented
81  
82 sub cfg_end
83 0 ▶{
Subroutine cfg_end: not called CC=2 SCAR=17.9
Pod documented
84 0 my $self=shift;
85 0 my $Path='./';
86 0 $_ = $self->{Path};
87 0 ▶ if (/^(.*\/)[^\/]$/) {$Path = $1;}
Branch: 1 branch
BranchTrueFalseTotal
if (m[^(.*/)[^/]$]) 0 0 0
88 CfgTie::Cfgfile::system('cd '.$Path.'db;credb 10240 prod;maked prod <'.
89 $self->{Path}.
90 0 ';makei prod;build -s prod');
91 }
92  
« CfgTie/TieRCService.pm ↑ Summary Secure/File.pm »