Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

removed all indirect method calls

Replaced "new Whatever::Module" with "Whatever::Module->new" in code and
in the documentation
  • Loading branch information...
commit 8d4105fe73d0c7dfd72a1d24be5cd0536d1816b5 1 parent 45c8929
@kaoru kaoru authored
View
22 lib/WebService/Nestoria/Search.pm
@@ -62,7 +62,7 @@ You should never have to set the 'action' parameter yourself, it is implied by t
use WebService::Nestoria::Search;
- my $NS = new WebService::Nestoria::Search(
+ my $NS = WebService::Nestoria::Search->new(
place_name => 'soho',
listing_type => 'rent',
property_type => 'flat',
@@ -431,11 +431,11 @@ sub request {
if ( @_ % 2 != 0 ) {
return _carp_on_error("wrong arg count for request");
}
-
+
my %args = @_;
unless ( ref $self ) {
- $self = new $self;
+ $self = $self->new;
}
foreach my $key ( keys %GlobalDefaults ) {
@@ -469,7 +469,7 @@ sub request {
return _carp_on_error("number_of_results $args{number_of_results} too large, maximum is $Config{MaxResults}");
}
- return new WebService::Nestoria::Search::Request (\%params);
+ return WebService::Nestoria::Search::Request->new(\%params);
}
=head2 query
@@ -487,9 +487,9 @@ This is a shortcut for
sub query {
my $self = shift;
-
+
unless ( ref $self ) {
- $self = new $self;
+ $self = $self->new;
}
if ( my $request = $self->request(@_) ) {
@@ -518,9 +518,9 @@ sub results {
my $self = shift;
unless ( ref $self ) {
- $self = new $self;
+ $self = $self->new;
}
-
+
my $response = $self->query(@_);
unless ( $response ) {
@@ -590,14 +590,14 @@ sub metadata {
my $self = shift;
unless ( ref $self ) {
- $self = new $self;
+ $self = $self->new;
}
my %params = ( action => 'metadata' );
my $response = $self->query(%params, @_);
- return new WebService::Nestoria::Search::MetadataResponse($response->get_hashref);
+ return WebService::Nestoria::Search::MetadataResponse->new($response->get_hashref);
}
=head1 Warnings
@@ -608,7 +608,7 @@ Warnings is true by default, and means that errors are output to STDERR as well
or when calling C<new>
- my $NS = new WebService::Nestoria::Search(Warnings => 0);
+ my $NS = WebService::Nestoria::Search->new(Warnings => 0);
=head1 Country
View
10 lib/WebService/Nestoria/Search/Request.pm
@@ -37,7 +37,7 @@ sub uri {
my $self = shift;
unless ( $self->{_uri} ) {
- $self->{_uri} = new URI ($self->{ActionUrl}, 'http');
+ $self->{_uri} = URI->new($self->{ActionUrl}, 'http');
$self->{_uri}->query_form( %{ $self->{Params} } );
}
return $self->{_uri};
@@ -71,7 +71,7 @@ sub fetch {
$WebService::Nestoria::Search::RecentRequestUrl = $self->url;
- $UA ||= new LWP::UserAgent (agent => $self->{AppId});
+ $UA ||= LWP::UserAgent->new(agent => $self->{AppId});
my $response = $UA->get($WebService::Nestoria::Search::RecentRequestUrl);
sleep 2;
@@ -87,7 +87,7 @@ sub fetch {
my $response_obj = from_json($raw);
if ( ref $response_obj ) {
- return new WebService::Nestoria::Search::Response ($response_obj, $raw);
+ return WebService::Nestoria::Search::Response->new($response_obj, $raw);
}
else {
return;
@@ -103,14 +103,14 @@ sub fetch {
}
if (ref($response_obj)) {
- return new WebService::Nestoria::Search::Response ($response_obj, $raw);
+ return WebService::Nestoria::Search::Response->new($response_obj, $raw);
}
else {
return;
}
}
else {
- return new WebService::Nestoria::Search::Response ({}, $raw);
+ return WebService::Nestoria::Search::Response->new({}, $raw);
}
}
View
3  lib/WebService/Nestoria/Search/Response.pm
@@ -30,7 +30,8 @@ sub new {
$result->{ordinal} = $i;
$result->{response} = $self->{data};
- $self->{results}[$i] = new WebService::Nestoria::Search::Result ($result);
+ $self->{results}[$i]
+ = WebService::Nestoria::Search::Result->new($result);
}
return bless $self, $class;
Please sign in to comment.
Something went wrong with that request. Please try again.