Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added practical stringification of Language (locale) and Location (co…

…untry_code)
  • Loading branch information...
commit 7ed02ae005161c7306354a3c4285fdda4b1d836e 1 parent bf46432
@Getty Getty authored
Showing with 10 additions and 0 deletions.
  1. +5 −0 lib/DDG/Language.pm
  2. +5 −0 lib/DDG/Location.pm
View
5 lib/DDG/Language.pm
@@ -30,4 +30,9 @@ has $_ => (
default => sub { '' }
) for (@language_attributes);
+use overload '""' => sub {
+ my $self = shift;
+ return $self->locale;
+}, fallback => 1;
+
1;
View
5 lib/DDG/Location.pm
@@ -33,4 +33,9 @@ has geo_ip_record => (
predicate => 'has_geo_ip_record',
);
+use overload '""' => sub {
+ my $self = shift;
+ return $self->country_code;
+}, fallback => 1;
+
1;
Please sign in to comment.
Something went wrong with that request. Please try again.