Skip to content

Commit

Permalink
Allow new() to take a ref to a hash of arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Oct 15, 2023
1 parent 4502661 commit f89bd3c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Revision history for Genealogy::ObituaryDailyTimes

0.10
Latest DB.pm from NJH-Snippets
Allow new() to take a ref to a hash of arguments

0.09 Sat Jun 24 09:14:41 EDT 2023
create_db failed on 5.36.1
Expand Down
5 changes: 3 additions & 2 deletions lib/Genealogy/ObituaryDailyTimes.pm
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ Takes two optionals arguments:
=cut

sub new {
my($proto, %args) = @_;
my $class = ref($proto) || $proto;
my $class = $_[0];
shift;
my %args = (ref($_[0]) eq 'HASH') ? %{$_[0]} : @_;

if(!defined($class)) {
# Use Genealogy::ObituaryDailyTimes->new, not Genealogy::ObituaryDailyTimes::new
Expand Down

0 comments on commit f89bd3c

Please sign in to comment.