line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
2
|
1
|
|
|
1
|
|
733
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package App::Addex::AddressBook::Abook 0.009; |
6
|
1
|
|
|
1
|
|
5
|
use base qw(App::Addex::AddressBook); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
527
|
|
7
|
|
|
|
|
|
|
# ABSTRACT: use the "abook" program as the addex source |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
21902
|
use App::Addex::Entry::EmailAddress; |
|
1
|
|
|
|
|
372
|
|
|
1
|
|
|
|
|
28
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
558
|
use File::HomeDir; |
|
1
|
|
|
|
|
5659
|
|
|
1
|
|
|
|
|
56
|
|
12
|
1
|
|
|
1
|
|
7
|
use File::Spec; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
33
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
{ |
15
|
|
|
|
|
|
|
package |
16
|
|
|
|
|
|
|
App::Addex::AddressBook::Abook::INI::Reader; |
17
|
1
|
|
|
1
|
|
503
|
use Config::INI::Reader; # probably already loaded, but... -- rjbs, 2007-05-09 |
|
1
|
|
|
|
|
35922
|
|
|
1
|
|
|
|
|
52
|
|
18
|
1
|
|
|
1
|
|
500
|
BEGIN { our @ISA = 'Config::INI::Reader' } |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub can_ignore { |
21
|
35
|
|
|
35
|
|
128
|
my ($self, $line) = @_; |
22
|
35
|
100
|
|
|
|
124
|
return $line =~ /\A\s*(?:[;#]|$)/ ? 1 : 0; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub preprocess_line { |
26
|
35
|
|
|
35
|
|
2730
|
my ($self, $line) = @_; |
27
|
35
|
|
|
|
|
53
|
${$line} =~ s/\s+[;#].*$//g; |
|
35
|
|
|
|
|
115
|
|
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
#pod =head1 SYNOPSIS |
32
|
|
|
|
|
|
|
#pod |
33
|
|
|
|
|
|
|
#pod This module implements the L<App::Addex::AddressBook> interface for the |
34
|
|
|
|
|
|
|
#pod Mutt-friendly "abook" program. |
35
|
|
|
|
|
|
|
#pod |
36
|
|
|
|
|
|
|
#pod =head1 CONFIGURATION |
37
|
|
|
|
|
|
|
#pod |
38
|
|
|
|
|
|
|
#pod The following configuration options are valid: |
39
|
|
|
|
|
|
|
#pod |
40
|
|
|
|
|
|
|
#pod filename - the address book file to read; defaults to ~/.abook/addressbook |
41
|
|
|
|
|
|
|
#pod sig_field - the address book entry property that stores the "sig" field |
42
|
|
|
|
|
|
|
#pod folder_field - the address book entry property that stores the "sig" field |
43
|
|
|
|
|
|
|
#pod |
44
|
|
|
|
|
|
|
#pod =cut |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub new { |
47
|
1
|
|
|
1
|
1
|
549
|
my ($class, $arg) = @_; |
48
|
|
|
|
|
|
|
|
49
|
1
|
|
|
|
|
2
|
my $self = bless {} => $class; |
50
|
|
|
|
|
|
|
|
51
|
1
|
|
33
|
|
|
5
|
$arg->{filename} ||= File::Spec->catfile( |
52
|
|
|
|
|
|
|
File::HomeDir->my_home, |
53
|
|
|
|
|
|
|
'.abook', |
54
|
|
|
|
|
|
|
'addressbook', |
55
|
|
|
|
|
|
|
); |
56
|
|
|
|
|
|
|
|
57
|
1
|
|
|
|
|
2
|
eval { |
58
|
|
|
|
|
|
|
$self->{config} = App::Addex::AddressBook::Abook::INI::Reader |
59
|
1
|
|
|
|
|
14
|
->read_file($arg->{filename}); |
60
|
|
|
|
|
|
|
}; |
61
|
1
|
50
|
|
|
|
107
|
Carp::croak "couldn't read abook address book file: $@" if $@; |
62
|
|
|
|
|
|
|
|
63
|
1
|
|
|
|
|
31
|
$self->{$_} = $arg->{$_} for qw(sig_field folder_field); |
64
|
|
|
|
|
|
|
|
65
|
1
|
|
|
|
|
4
|
return $self; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub _entrify { |
69
|
3
|
|
|
3
|
|
5
|
my ($self, $person) = @_; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
return unless my @emails = |
72
|
3
|
|
|
|
|
34
|
map { App::Addex::Entry::EmailAddress->new($_) } |
73
|
3
|
100
|
100
|
|
|
21
|
split /\s*,\s*/, ($person->{email}||''); |
74
|
|
|
|
|
|
|
|
75
|
2
|
|
|
|
|
33
|
my %field; |
76
|
2
|
|
|
|
|
11
|
$field{ $_ } = $person->{ $self->{"$_\_field"} } for qw(sig folder); |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
return App::Addex::Entry->new({ |
79
|
|
|
|
|
|
|
name => $person->{name}, |
80
|
|
|
|
|
|
|
nick => $person->{nick}, |
81
|
2
|
|
|
|
|
14
|
emails => \@emails, |
82
|
|
|
|
|
|
|
fields => \%field, |
83
|
|
|
|
|
|
|
}); |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub entries { |
87
|
1
|
|
|
1
|
1
|
418
|
my ($self) = @_; |
88
|
|
|
|
|
|
|
|
89
|
3
|
|
|
|
|
122
|
my @entries = map { $self->_entrify($self->{config}{$_}) } |
90
|
4
|
|
|
|
|
21
|
sort grep { /\A\d+\z/ } |
91
|
1
|
|
|
|
|
2
|
keys %{ $self->{config} }; |
|
1
|
|
|
|
|
5
|
|
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
1; |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
__END__ |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=pod |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=encoding UTF-8 |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 NAME |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
App::Addex::AddressBook::Abook - use the "abook" program as the addex source |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 VERSION |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
version 0.009 |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 SYNOPSIS |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
This module implements the L<App::Addex::AddressBook> interface for the |
113
|
|
|
|
|
|
|
Mutt-friendly "abook" program. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 PERL VERSION SUPPORT |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
This module has the same support period as perl itself: it supports the two |
118
|
|
|
|
|
|
|
most recent versions of perl. (That is, if the most recently released version |
119
|
|
|
|
|
|
|
is v5.40, then this module should work on both v5.40 and v5.38.) |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Although it may work on older versions of perl, no guarantee is made that the |
122
|
|
|
|
|
|
|
minimum required version will not be increased. The version may be increased |
123
|
|
|
|
|
|
|
for any reason, and there is no promise that patches will be accepted to lower |
124
|
|
|
|
|
|
|
the minimum required perl. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 CONFIGURATION |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
The following configuration options are valid: |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
filename - the address book file to read; defaults to ~/.abook/addressbook |
131
|
|
|
|
|
|
|
sig_field - the address book entry property that stores the "sig" field |
132
|
|
|
|
|
|
|
folder_field - the address book entry property that stores the "sig" field |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 AUTHOR |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Ricardo SIGNES <rjbs@semiotic.systems> |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
This software is copyright (c) 2006 by Ricardo SIGNES. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
143
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=cut |