line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Genealogy::ObituaryDailyTimes; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
495854
|
use warnings; |
|
4
|
|
|
|
|
32
|
|
|
4
|
|
|
|
|
129
|
|
4
|
4
|
|
|
4
|
|
25
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
76
|
|
5
|
4
|
|
|
4
|
|
19
|
use Carp; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
190
|
|
6
|
4
|
|
|
4
|
|
23
|
use File::Spec; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
97
|
|
7
|
4
|
|
|
4
|
|
2176
|
use Module::Info; |
|
4
|
|
|
|
|
27031
|
|
|
4
|
|
|
|
|
118
|
|
8
|
4
|
|
|
4
|
|
2026
|
use Genealogy::ObituaryDailyTimes::DB; |
|
4
|
|
|
|
|
20
|
|
|
4
|
|
|
|
|
171
|
|
9
|
4
|
|
|
4
|
|
1801
|
use Genealogy::ObituaryDailyTimes::DB::obituaries; |
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
1733
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Genealogy::ObituaryDailyTimes - Lookup an entry in the Obituary Daily Times |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 VERSION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Version 0.08 |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=cut |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our $VERSION = '0.08'; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 SYNOPSIS |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use Genealogy::ObituaryDailyTimes; |
26
|
|
|
|
|
|
|
my $info = Genealogy::ObituaryDailyTimes->new(); |
27
|
|
|
|
|
|
|
# ... |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head2 new |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Creates a Genealogy::ObituaryDailyTimes object. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Takes an optional argument, directory, that is the directory containing obituaries.sql. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=cut |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub new { |
40
|
3
|
|
|
3
|
1
|
2855
|
my($proto, %param) = @_; |
41
|
3
|
|
66
|
|
|
21
|
my $class = ref($proto) || $proto; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# Use Genealogy::ObituaryDailyTimes->new, not Genealogy::ObituaryDailyTimes::new |
44
|
3
|
100
|
|
|
|
12
|
return unless($class); |
45
|
|
|
|
|
|
|
|
46
|
2
|
|
33
|
|
|
22
|
my $directory = $param{'directory'} || Module::Info->new_from_loaded(__PACKAGE__)->file(); |
47
|
2
|
|
|
|
|
364
|
$directory =~ s/\.pm$//; |
48
|
|
|
|
|
|
|
|
49
|
2
|
|
|
|
|
116
|
Genealogy::ObituaryDailyTimes::DB::init(directory => File::Spec->catfile($directory, 'database'), %param); |
50
|
2
|
|
|
|
|
14
|
return bless { }, $class; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head2 search |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
my $obits = Genealogy::ObituaryDailyTimes->new(); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
# Returns an array of hashrefs |
58
|
|
|
|
|
|
|
my @smiths = $obits->search(last => 'Smith'); # You must at least define the last name to search for |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
print $smiths[0]->{'first'}, "\n"; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub search { |
65
|
3
|
|
|
3
|
1
|
1246
|
my $self = shift; |
66
|
|
|
|
|
|
|
|
67
|
3
|
100
|
|
|
|
14
|
my %params = (ref($_[0]) eq 'HASH') ? %{$_[0]} : @_; |
|
1
|
|
|
|
|
5
|
|
68
|
|
|
|
|
|
|
|
69
|
3
|
50
|
|
|
|
13
|
if(!defined($params{'last'})) { |
70
|
3
|
|
|
|
|
11
|
Carp::carp("Value for 'last' is mandatory"); |
71
|
3
|
|
|
|
|
920
|
return; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
0
|
|
|
|
$self->{'obituaries'} ||= Genealogy::ObituaryDailyTimes::DB::obituaries->new(no_entry => 1); |
75
|
|
|
|
|
|
|
|
76
|
0
|
0
|
|
|
|
|
if(!defined($self->{'obituaries'})) { |
77
|
0
|
|
|
|
|
|
Carp::croak("Can't open the obituaries database"); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
0
|
0
|
|
|
|
|
if(wantarray) { |
81
|
0
|
|
|
|
|
|
my @obituaries = @{$self->{'obituaries'}->selectall_hashref(\%params)}; |
|
0
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
foreach my $obit(@obituaries) { |
83
|
0
|
|
|
|
|
|
$obit->{'url'} = _create_url($obit); |
84
|
|
|
|
|
|
|
} |
85
|
0
|
|
|
|
|
|
return @obituaries; |
86
|
|
|
|
|
|
|
} |
87
|
0
|
0
|
|
|
|
|
if(defined(my $obit = $self->{'obituaries'}->fetchrow_hashref(\%params))) { |
88
|
0
|
|
|
|
|
|
$obit->{'url'} = _create_url($obit); |
89
|
0
|
|
|
|
|
|
return $obit; |
90
|
|
|
|
|
|
|
} |
91
|
0
|
|
|
|
|
|
return; # undef |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub _create_url { |
95
|
0
|
|
|
0
|
|
|
my $obit = shift; |
96
|
0
|
|
|
|
|
|
my $source = $obit->{'source'}; |
97
|
0
|
|
|
|
|
|
my $page = $obit->{'page'}; |
98
|
|
|
|
|
|
|
|
99
|
0
|
0
|
|
|
|
|
if(!defined($page)) { |
100
|
4
|
|
|
4
|
|
32
|
use Data::Dumper; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
933
|
|
101
|
0
|
|
|
|
|
|
::diag(Data::Dumper->new([$obit])->Dump()); |
102
|
0
|
|
|
|
|
|
Carp::croak(__PACKAGE__, ': undefined $page'); |
103
|
|
|
|
|
|
|
} |
104
|
0
|
0
|
|
|
|
|
if(!defined($source)) { |
105
|
0
|
|
|
|
|
|
Carp::croak(__PACKAGE__, ": $page: undefined source"); |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
0
|
0
|
|
|
|
|
if($source eq 'M') { |
109
|
0
|
|
|
|
|
|
return "https://mlarchives.rootsweb.com/listindexes/emails?listname=gen-obit&page=$page"; |
110
|
|
|
|
|
|
|
} |
111
|
0
|
0
|
|
|
|
|
if($source eq 'F') { |
112
|
0
|
|
|
|
|
|
return "https://www.freelists.org/post/obitdailytimes/Obituary-Daily-Times-$page"; |
113
|
|
|
|
|
|
|
} |
114
|
0
|
|
|
|
|
|
Carp::croak(__PACKAGE__, ": Invalid source, '$source'"); |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 AUTHOR |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Nigel Horne, C<< >> |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 BUGS |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 SEE ALSO |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
The Obituary Daily Times, L |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 SUPPORT |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
perldoc Genealogy::ObituaryDailyTimes |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
You can also look for information at: |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=over 4 |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=item * MetaCPAN |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
L |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
L |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=item * CPANTS |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
L |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=item * CPAN Testers' Matrix |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
L |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=item * CPAN Ratings |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
L |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=item * CPAN Testers Dependencies |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
L |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=back |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
Copyright 2020-2023 Nigel Horne. |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
This program is released under the following licence: GPL2 |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=cut |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
1; |