line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
$VERSION = "0.10"; |
2
|
|
|
|
|
|
|
package News::GroupInfo::Entry; |
3
|
|
|
|
|
|
|
our $VERSION = "0.10"; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# -*- Perl -*- # Wed Apr 28 09:38:34 CDT 2004 |
6
|
|
|
|
|
|
|
############################################################################### |
7
|
|
|
|
|
|
|
# Written by Tim Skirvin . Copyright 2003-2004, |
8
|
|
|
|
|
|
|
# Tim Skirvin. Redistribution terms are below. |
9
|
|
|
|
|
|
|
############################################################################### |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
News::GroupInfo::Entry - an object for storing specific group information |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use News::GroupInfo::Entry; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
See News::GroupInfo and below for more specific information about related |
20
|
|
|
|
|
|
|
functions. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 DESCRIPTION |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
News::GroupInfo::Entry contains the actual newsgroup entries for |
25
|
|
|
|
|
|
|
News::GroupInfo. Each entry consists of a group name, timestamp of |
26
|
|
|
|
|
|
|
creation, creator name, and group description. Within that, it is a very |
27
|
|
|
|
|
|
|
simple module (significantly more lines dedicated to documentation than |
28
|
|
|
|
|
|
|
actual code). |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 USAGE |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
News::GroupInfo::Entry is accessed through the following functions: |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=cut |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
############################################################################### |
37
|
|
|
|
|
|
|
### main() #################################################################### |
38
|
|
|
|
|
|
|
############################################################################### |
39
|
|
|
|
|
|
|
|
40
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
477
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 Functions |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=over 4 |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=item new ( STRING ) |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Creates and returns a new News::GroupInfo::Entry object. C is a |
49
|
|
|
|
|
|
|
scalar containing the group name, timestamp of creation, creator name, and |
50
|
|
|
|
|
|
|
group description, separated by '::'. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Only the group name is really required; the rest will be worked on on |
53
|
|
|
|
|
|
|
their own. Therefore, just passing in the group name will work fine. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub new { |
58
|
0
|
|
|
0
|
1
|
|
my ($proto, $string) = @_; |
59
|
0
|
|
|
|
|
|
my ($group, $time, $creator, $desc) = split('::', $string); |
60
|
0
|
0
|
|
|
|
|
return undef unless $group; |
61
|
0
|
|
0
|
|
|
|
my $class = ref($proto) || $proto; |
62
|
0
|
|
0
|
|
|
|
my $self = { |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
63
|
|
|
|
|
|
|
'name' => $group || '', |
64
|
|
|
|
|
|
|
'desc' => $desc || '', |
65
|
|
|
|
|
|
|
'creator' => $creator || '', |
66
|
|
|
|
|
|
|
'time' => $time || 0, |
67
|
|
|
|
|
|
|
}; |
68
|
0
|
|
|
|
|
|
bless $self, $class; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item name ( [STRING] ) |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=item desc ( [STRING] ) |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item creator ( [STRING] ) |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item time ( [STRING] ) |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Returns the relevant information from the object, as indicated above. If |
80
|
|
|
|
|
|
|
an argument is passed to these functions, then the value is set to that |
81
|
|
|
|
|
|
|
value; otherwise, we just return the existing value. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |
84
|
|
|
|
|
|
|
|
85
|
0
|
0
|
0
|
0
|
1
|
|
sub name { defined $_[1] ? $_[0]->{name} = $_[1] : $_[0]->{name} || "" } |
86
|
0
|
0
|
0
|
0
|
1
|
|
sub desc { defined $_[1] ? $_[0]->{desc} = $_[1] : $_[0]->{desc} || "" } |
87
|
0
|
0
|
0
|
0
|
1
|
|
sub creator { defined $_[1] ? $_[0]->{creator} = $_[1] : $_[0]->{creator} || ""} |
88
|
0
|
0
|
0
|
0
|
1
|
|
sub time { defined $_[1] ? $_[0]->{'time'} = $_[1] : $_[0]->{'time'} || 0 } |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=item arrayref () |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Returns an array reference containing C |
93
|
|
|
|
|
|
|
C (the same information stored by INN's various newsgroup files). |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |
96
|
|
|
|
|
|
|
|
97
|
0
|
|
|
0
|
1
|
|
sub arrayref { my ($self) = @_; [ $self->time, $self->creator, $self->desc ]; } |
|
0
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item print () |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Makes a human-readable string containing the information from arrayref(). |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |
104
|
|
|
|
|
|
|
|
105
|
0
|
|
|
0
|
1
|
|
sub print { join("\t", @{shift->arrayref}) } |
|
0
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=item output () |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Returns the string that is needed by new() - ie, a string containing |
110
|
|
|
|
|
|
|
name() and arrayref(), separated by '::'. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=cut |
113
|
|
|
|
|
|
|
|
114
|
0
|
|
|
0
|
1
|
|
sub output { my $self = shift; join("::", $self->name, @{$self->arrayref}) } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=back |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
1; |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 REQUIREMENTS |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
B |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 SEE ALSO |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
B |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 AUTHOR |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Tim Skirvin |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 HOMEPAGE |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
B |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 LICENSE |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
This code may be redistributed under the same terms as Perl itself. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 COPYRIGHT |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Copyright 2003-2004, Tim Skirvin. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=cut |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
############################################################################### |
149
|
|
|
|
|
|
|
##### Version History ######################################################### |
150
|
|
|
|
|
|
|
############################################################################### |
151
|
|
|
|
|
|
|
# v0.10 Wed Apr 28 09:44:47 CDT 2004 |
152
|
|
|
|
|
|
|
### First documented version; it's been working since last year, though. |