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