Skip to content

Commit

Permalink
Allow new() to take HASH ref
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Aug 28, 2024
1 parent e62a669 commit 2b7195a
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/Geo/Coder/Free.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions lib/Geo/Coder/Free/Config.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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'}) {
Expand Down
7 changes: 4 additions & 3 deletions lib/Geo/Coder/Free/Local.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions lib/Geo/Coder/Free/MaxMind.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2b7195a

Please sign in to comment.