diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index 31195988..6c2b1b6e 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -46,10 +46,11 @@ jobs: cpanm --skip-satisfied -qn Module::Info Locale::CA Locale::US CHI cpanm --skip-satisfied -qn Locale::SubCountry Lingua::EN::AddressParse cpanm --skip-satisfied -qn Geo::StreetAddress::US Log::Dispatch::File - cpanm --skip-satisfied -qn warnings::unused + cpanm --skip-satisfied -qn warnings::unused YAML::XS Mo cpanm -ivn --installdeps . env: AUTHOR_TESTING: 1 + AUTOMATED_TESTING: 1 - name: Run Tests run: | perl -c -Ilib -MO=Lint cgi-bin/page.fcgi diff --git a/Changes b/Changes index 7772dc01..97ae8a27 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ Revision history for Geo-Coder-Free +0.37 + Allow new() to take HASH ref + 0.36 Fri Jul 5 08:56:52 EDT 2024 Handle wide characters Latest VWF diff --git a/lib/Geo/Coder/Free.pm b/lib/Geo/Coder/Free.pm index 9883ee9e..ac5ec52b 100644 --- a/lib/Geo/Coder/Free.pm +++ b/lib/Geo/Coder/Free.pm @@ -87,8 +87,8 @@ but that can't be guaranteed to work. =cut sub new { - my($proto, %args) = @_; - my $class = ref($proto) || $proto; + my $class = shift; + my %args = (ref($_[0]) eq 'HASH') ? %{$_[0]} : @_; if(!defined($class)) { # Using Geo::Coder::Free->new not Geo::Coder::Free::new diff --git a/lib/Geo/Coder/Free/Config.pm b/lib/Geo/Coder/Free/Config.pm index 6b86523b..8193d1ae 100644 --- a/lib/Geo/Coder/Free/Config.pm +++ b/lib/Geo/Coder/Free/Config.pm @@ -43,12 +43,11 @@ use File::Spec; =cut -sub new { - my $proto = shift; +sub new +{ + my $class = shift; my %args = (ref($_[0]) eq 'HASH') ? %{$_[0]} : @_; - my $class = ref($proto) || $proto; - my $info = $args{info} || CGI::Info->new(); if($args{'logger'}) { diff --git a/lib/Geo/Coder/Free/Local.pm b/lib/Geo/Coder/Free/Local.pm index 4441e67b..beaa9ce3 100644 --- a/lib/Geo/Coder/Free/Local.pm +++ b/lib/Geo/Coder/Free/Local.pm @@ -60,9 +60,10 @@ Geo::Coder::Free::Local provides an interface to your own location data. =cut -sub new { - my($proto, %args) = @_; - my $class = ref($proto) || $proto; +sub new +{ + my $class = shift; + my %args = (ref($_[0]) eq 'HASH') ? %{$_[0]} : @_; if(!defined($class)) { # Geo::Coder::Free::Local->new not Geo::Coder::Free::Local::new diff --git a/lib/Geo/Coder/Free/MaxMind.pm b/lib/Geo/Coder/Free/MaxMind.pm index 988137b7..355b8a5b 100644 --- a/lib/Geo/Coder/Free/MaxMind.pm +++ b/lib/Geo/Coder/Free/MaxMind.pm @@ -104,9 +104,10 @@ The admin2.db is far from comprehensive, see Makefile.PL for some entries that a =cut -sub new { - my($proto, %args) = @_; - my $class = ref($proto) || $proto; +sub new +{ + my $class = shift; + my %args = (ref($_[0]) eq 'HASH') ? %{$_[0]} : @_; if(!defined($class)) { # Geo::Coder::Free::Local->new not Geo::Coder::Free::Local::new