Skip to content

Commit

Permalink
ensure that the 'newspaper' key in the hash is defined when the sourc…
Browse files Browse the repository at this point in the history
…e is 'L'
  • Loading branch information
nigelhorne committed Dec 10, 2024
1 parent 8f3889d commit b56fc52
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ foreach my $dir(@dirs) {

my $prereqs = {
'autodie' => 0,
'constant' => 0,
'Carp' => 0,
'Database::Abstraction' => 0.04,
'DBD::SQLite' => 0,
Expand Down
16 changes: 11 additions & 5 deletions lib/Genealogy/ObituaryDailyTimes.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ use File::Spec;
use Module::Info;
use Genealogy::ObituaryDailyTimes::obituaries;

use constant URLS => {
# 'M' => "https://mlarchives.rootsweb.com/listindexes/emails?listname=gen-obit&page=",
'M' => "https://wayback.archive-it.org/20669/20231102044925/https://mlarchives.rootsweb.com/listindexes/emails?listname=gen-obit&page=",
'F' => "https://www.freelists.org/post/obitdailytimes/Obituary-Daily-Times-",
};

=head1 NAME
Genealogy::ObituaryDailyTimes - Lookup an entry in the Obituary Daily Times
Expand Down Expand Up @@ -128,16 +134,16 @@ sub _create_url {
}

if($source eq 'M') {
# return "https://mlarchives.rootsweb.com/listindexes/emails?listname=gen-obit&page=$page";
return "https://wayback.archive-it.org/20669/20231102044925/https://mlarchives.rootsweb.com/listindexes/emails?listname=gen-obit&page=$page";
return URLS->{'M'} . $page;
}
if($source eq 'F') {
return "https://www.freelists.org/post/obitdailytimes/Obituary-Daily-Times-$page";
return URLS->{'F'} . $page;
}
if($source eq 'L') {
return $obit->{'newspaper'};
my $newspaper = $obit->{'newspaper'} || Carp::croak(__PACKAGE__, ": undefined newspaper. Newspaper much be given when source type is 'L'");
return $newspaper;
}
Carp::croak(__PACKAGE__, ": Invalid source, '$source'");
Carp::croak(__PACKAGE__, ": Invalid source, '$source'. Valid sources are 'M', 'F' and 'L'");
}

# Helper routine to parse the arguments given to a function,
Expand Down

0 comments on commit b56fc52

Please sign in to comment.