| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Statocles::Person; |
|
2
|
|
|
|
|
|
|
our $VERSION = '0.085'; |
|
3
|
|
|
|
|
|
|
# ABSTRACT: Information about a person, including name and e-mail |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
#pod =head1 SYNOPSIS |
|
6
|
|
|
|
|
|
|
#pod |
|
7
|
|
|
|
|
|
|
#pod # site.yml |
|
8
|
|
|
|
|
|
|
#pod site: |
|
9
|
|
|
|
|
|
|
#pod $class: Statocles::Site |
|
10
|
|
|
|
|
|
|
#pod author: |
|
11
|
|
|
|
|
|
|
#pod $class: Statocles::Person |
|
12
|
|
|
|
|
|
|
#pod name: Doug Bell |
|
13
|
|
|
|
|
|
|
#pod email: doug@example.com |
|
14
|
|
|
|
|
|
|
#pod |
|
15
|
|
|
|
|
|
|
#pod # Perl code |
|
16
|
|
|
|
|
|
|
#pod my $person = Statocles::Person->new( |
|
17
|
|
|
|
|
|
|
#pod name => 'Doug Bell', |
|
18
|
|
|
|
|
|
|
#pod email => 'doug@example.com', |
|
19
|
|
|
|
|
|
|
#pod ); |
|
20
|
|
|
|
|
|
|
#pod |
|
21
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
|
22
|
|
|
|
|
|
|
#pod |
|
23
|
|
|
|
|
|
|
#pod This class stores information about a person, most commonly an author of |
|
24
|
|
|
|
|
|
|
#pod a site or a document. |
|
25
|
|
|
|
|
|
|
#pod |
|
26
|
|
|
|
|
|
|
#pod This class can parse plain strings like C<< Doug Bell <doug@example.com> >> |
|
27
|
|
|
|
|
|
|
#pod into an object with name and e-mail set correctly. |
|
28
|
|
|
|
|
|
|
#pod |
|
29
|
|
|
|
|
|
|
#pod Person objects stringify into the C<name> field, for |
|
30
|
|
|
|
|
|
|
#pod backwards-compatibility. |
|
31
|
|
|
|
|
|
|
#pod |
|
32
|
|
|
|
|
|
|
#pod =head1 SEE ALSO |
|
33
|
|
|
|
|
|
|
#pod |
|
34
|
|
|
|
|
|
|
#pod =over |
|
35
|
|
|
|
|
|
|
#pod |
|
36
|
|
|
|
|
|
|
#pod =item L<Statocles::Document/author> |
|
37
|
|
|
|
|
|
|
#pod |
|
38
|
|
|
|
|
|
|
#pod =item L<Statocles::Site/author> |
|
39
|
|
|
|
|
|
|
#pod |
|
40
|
|
|
|
|
|
|
#pod =back |
|
41
|
|
|
|
|
|
|
#pod |
|
42
|
|
|
|
|
|
|
#pod =cut |
|
43
|
|
|
|
|
|
|
|
|
44
|
68
|
|
|
68
|
|
537
|
use Statocles::Base 'Class'; |
|
|
68
|
|
|
|
|
149
|
|
|
|
68
|
|
|
|
|
564
|
|
|
45
|
|
|
|
|
|
|
use overload |
|
46
|
1728
|
|
|
1728
|
|
339887
|
q{""} => sub { shift->name }, |
|
47
|
68
|
|
|
68
|
|
463823
|
; |
|
|
68
|
|
|
|
|
242
|
|
|
|
68
|
|
|
|
|
781
|
|
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
#pod =attr name |
|
50
|
|
|
|
|
|
|
#pod |
|
51
|
|
|
|
|
|
|
#pod The author's name. Required. |
|
52
|
|
|
|
|
|
|
#pod |
|
53
|
|
|
|
|
|
|
#pod =cut |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
has name => ( |
|
56
|
|
|
|
|
|
|
is => 'rw', |
|
57
|
|
|
|
|
|
|
isa => Str, |
|
58
|
|
|
|
|
|
|
required => 1, |
|
59
|
|
|
|
|
|
|
); |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
#pod =attr email |
|
62
|
|
|
|
|
|
|
#pod |
|
63
|
|
|
|
|
|
|
#pod The author's email. Optional. |
|
64
|
|
|
|
|
|
|
#pod |
|
65
|
|
|
|
|
|
|
#pod =cut |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
has email => ( |
|
68
|
|
|
|
|
|
|
is => 'rw', |
|
69
|
|
|
|
|
|
|
isa => Str, |
|
70
|
|
|
|
|
|
|
); |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
#pod =method new |
|
73
|
|
|
|
|
|
|
#pod |
|
74
|
|
|
|
|
|
|
#pod my $person = Statocles::Person->new( |
|
75
|
|
|
|
|
|
|
#pod name => 'Doug Bell', |
|
76
|
|
|
|
|
|
|
#pod email => 'doug@example.com', |
|
77
|
|
|
|
|
|
|
#pod ); |
|
78
|
|
|
|
|
|
|
#pod |
|
79
|
|
|
|
|
|
|
#pod my $person = Statocles::Person->new( 'Doug Bell <doug@example.com>' ); |
|
80
|
|
|
|
|
|
|
#pod |
|
81
|
|
|
|
|
|
|
#pod Construct a new Person object. Arguments can be a list of name/value pairs, or |
|
82
|
|
|
|
|
|
|
#pod a single string with the format C<< Name <email@domain> >> (the e-mail part |
|
83
|
|
|
|
|
|
|
#pod is optional). |
|
84
|
|
|
|
|
|
|
#pod |
|
85
|
|
|
|
|
|
|
#pod =cut |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub BUILDARGS { |
|
88
|
440
|
|
|
440
|
0
|
62877
|
my ( $class, @args ) = @_; |
|
89
|
|
|
|
|
|
|
|
|
90
|
440
|
100
|
100
|
|
|
2671
|
return $args[0] if @args == 1 && ref $args[0] eq 'HASH'; |
|
91
|
|
|
|
|
|
|
|
|
92
|
438
|
100
|
|
|
|
1372
|
if ( @args == 1 ) { |
|
93
|
340
|
100
|
|
|
|
1199
|
if ( $args[0] =~ s/\s*<([^>]+)>\s*// ) { |
|
94
|
6
|
|
|
|
|
34
|
@args = ( |
|
95
|
|
|
|
|
|
|
name => $args[0], |
|
96
|
|
|
|
|
|
|
email => $1, |
|
97
|
|
|
|
|
|
|
); |
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
else { |
|
100
|
334
|
|
|
|
|
871
|
@args = ( |
|
101
|
|
|
|
|
|
|
name => $args[0], |
|
102
|
|
|
|
|
|
|
); |
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
|
|
106
|
438
|
|
|
|
|
7541
|
return { @args }; |
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
1; |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
__END__ |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=pod |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=encoding UTF-8 |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 NAME |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Statocles::Person - Information about a person, including name and e-mail |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 VERSION |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
version 0.085 |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
# site.yml |
|
128
|
|
|
|
|
|
|
site: |
|
129
|
|
|
|
|
|
|
$class: Statocles::Site |
|
130
|
|
|
|
|
|
|
author: |
|
131
|
|
|
|
|
|
|
$class: Statocles::Person |
|
132
|
|
|
|
|
|
|
name: Doug Bell |
|
133
|
|
|
|
|
|
|
email: doug@example.com |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
# Perl code |
|
136
|
|
|
|
|
|
|
my $person = Statocles::Person->new( |
|
137
|
|
|
|
|
|
|
name => 'Doug Bell', |
|
138
|
|
|
|
|
|
|
email => 'doug@example.com', |
|
139
|
|
|
|
|
|
|
); |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
This class stores information about a person, most commonly an author of |
|
144
|
|
|
|
|
|
|
a site or a document. |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
This class can parse plain strings like C<< Doug Bell <doug@example.com> >> |
|
147
|
|
|
|
|
|
|
into an object with name and e-mail set correctly. |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Person objects stringify into the C<name> field, for |
|
150
|
|
|
|
|
|
|
backwards-compatibility. |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head2 name |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
The author's name. Required. |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head2 email |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
The author's email. Optional. |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head1 METHODS |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=head2 new |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
my $person = Statocles::Person->new( |
|
167
|
|
|
|
|
|
|
name => 'Doug Bell', |
|
168
|
|
|
|
|
|
|
email => 'doug@example.com', |
|
169
|
|
|
|
|
|
|
); |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
my $person = Statocles::Person->new( 'Doug Bell <doug@example.com>' ); |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
Construct a new Person object. Arguments can be a list of name/value pairs, or |
|
174
|
|
|
|
|
|
|
a single string with the format C<< Name <email@domain> >> (the e-mail part |
|
175
|
|
|
|
|
|
|
is optional). |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=over |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=item L<Statocles::Document/author> |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=item L<Statocles::Site/author> |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=back |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head1 AUTHOR |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Doug Bell <preaction@cpan.org> |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
This software is copyright (c) 2016 by Doug Bell. |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
196
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=cut |