Nodelist/Node.pm

filter: Statementstmt 70.7% 29 / 41 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 6 / 12 Podpod 100% 9 / 9 totaltotal 70.9% 44 / 62 SCAR 0.2
CC
1
Cov
71%
keyword
2.0
name
2.0
sysop
2.0
CRAP 1.0
« Nodelist.pm ↑ Summary
1 # FTN/Nodelist/Node.pm
2 #
3 # Copyright (c) 2005 Serguei Trouchelle. All rights reserved.
4 #
5 # This program is free software; you can redistribute it and/or modify it
6 # under the same terms as Perl itself.
7  
8 # History:
9 # 1.02 2005/02/22 Documentation improved
10 # 1.01 2005/02/16 Initial revision
11  
12 =head1 NAME
13  
14 FTN::Nodelist::Node - Manipulate node information in FTN nodelist
15  
16 =head1 SYNOPSIS
17  
18 my $ndl = new FTN::Nodelist(-file => '/fido/var/ndl/nodelist.*');
19 if (my $node = $ndl->getNode('2:550/4077')) {
20 print $node->sysop();
21 } else {
22 warn 'Cannot find node';
23 }
24  
25 =head1 DESCRIPTION
26  
27 C<FTN::Nodelist::Node> contains functions that can be used to get information
28 about node entry in Fidonet Technology Network nodelist.
29  
30 =head1 METHODS
31  
32 =head2 new
33  
34 This method creates C<FTN::Nodelist::Node> object.
35  
36 You should not use it anyway, since it is used from C<FTN::Nodelist>.
37 See L<FTN::Nodelist> for details.
38  
39 =cut
40  
41 package FTN::Nodelist::Node;
42  
43 7 require Exporter;
44 7 ▶use Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
45  
46 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
47 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
48  
49 7 our @EXPORT_OK = qw//;
50 7 our %EXPORT_TAGS = ();
51 7 our @ISA = qw/Exporter/;
52  
53 7 $FTN::Nodelist::Node::VERSION = "1.01";
54  
55 sub new {
56 23 ▶ my $self = shift;
Subroutine new: called CC=1 SCAR=0.0
Pod documented
57 23 my $addr = shift; # FTN::Address hash {z/n/f/p}
58 23 my $line = shift; # Nodelist line
59  
60 23 $line =~ s/_/ /g; # change underline to spaces
61  
62 23 $self = $addr;
63 $self->{'__addr'} = $addr->{'z'} . ':' . $addr->{'n'} . '/' .
64 23 $addr->{'f'} . '.' . $addr->{'p'};
65  
66 (
67 $self->{'__keyword'}, # Pvt/Hold/Down/Zone/Region/Host/Hub
68 undef, # Node Number
69 $self->{'__name'}, # Node Name
70 $self->{'__loc'}, # Location
71 $self->{'__sysop'}, # Sysop Name
72 $self->{'__phone'}, # Phone Number
73 $self->{'__speed'}, # DCE Speed
74 23 @{$self->{'__flags'}}
75 ) = split ',', $line;
76  
77 23 bless $self;
78 23 return $self;
79 }
80  
81 =head2 address
82  
83 Returns FTN node address in 4D format.
84  
85 =cut
86  
87 sub address {
88 23 ▶ my $self = shift;
Subroutine address: called CC=1 SCAR=0.0
Pod documented
89 23 return $self->{'__addr'};
90 }
91  
92 =head2 keyword
93  
94 Returns FTN node keyword (Pvt/Hold/Down/Zone/Region/Host/Hub).
95 Empty string is used for regular node.
96  
97 =cut
98  
99 sub keyword {
100 0 ▶ my $self = shift;
Subroutine keyword: not called CC=1 SCAR=6.9
Pod documented
101 0 return $self->{'__keyword'};
102 }
103  
104 =head2 name
105  
106 Returns FTN node station name.
107  
108 This field may also be used by IP nodes for a domain name, static IP
109 address or E-Mail address for email tunnelling programs.
110  
111 =cut
112  
113 sub name {
114 0 ▶ my $self = shift;
Subroutine name: not called CC=1 SCAR=6.9
Pod documented
115 0 return $self->{'__name'};
116 }
117  
118 =head2 location
119  
120 Returns FTN node location
121  
122 =cut
123  
124 sub location {
125 23 ▶ my $self = shift;
Subroutine location: called CC=1 SCAR=0.0
Pod documented
126 23 return $self->{'__loc'};
127 }
128  
129 =head2 sysop
130  
131 Returns FTN node sysop name
132  
133 =cut
134  
135 sub sysop {
136 0 ▶ my $self = shift;
Subroutine sysop: not called CC=1 SCAR=6.9
Pod documented
137 0 return $self->{'__sysop'};
138 }
139  
140 =head2 phone
141  
142 Returns FTN node phone number (PSTN/ISDN)
143  
144 Can also contains C<'-Unpublished-'> value or 000-IP address.
145  
146 =cut
147  
148 sub phone {
149 0 ▶ my $self = shift;
Subroutine phone: not called CC=1 SCAR=6.9
Pod documented
150 0 return $self->{'__phone'};
151 }
152  
153 =head2 speed
154  
155 Returns FTN node DCE speed
156  
157 =cut
158  
159 sub speed {
160 0 ▶ my $self = shift;
Subroutine speed: not called CC=1 SCAR=6.9
Pod documented
161 0 return $self->{'__speed'};
162 }
163  
164 =head2 flags
165  
166 Returns arrayref with FTN node flags
167  
168 =cut
169  
170 sub flags {
171 0 ▶ my $self = shift;
Subroutine flags: not called CC=1 SCAR=6.9
Pod documented
172 0 return $self->{'__flags'};
173 }
174  
175 7 1;
176  
177 =head1 AUTHORS
178  
179 Serguei Trouchelle E<lt>F<stro@railways.dp.ua>E<gt>
180  
181 =head1 LICENSE
182  
183 This program is free software; you can redistribute it and/or modify it
184 under the same terms as Perl itself.
185  
186 =head1 COPYRIGHT
187  
188 Copyright (c) 2005 Serguei Trouchelle. All rights reserved.
189  
190 =cut
191  
« Nodelist.pm ↑ Summary