aws-sdk-perl
aws-sdk-perl copied to clipboard
CodeDeploy - Can't locate object method "nextToken"
+++ my $deploy = Paws->service('CodeDeploy', region => 'us-east-1'); print Dumper($deploy->ListAllApplications()); +++
The simple test script above yeilds:
Can't locate object method "nextToken" via package "Paws::CodeDeploy::ListApplicationsOutput" at /usr/local/lib/perl5/site_perl/Paws/CodeDeploy.pm line 239.
I would naturally expect it to return all applications.
Hi,
This seems a problem with the code generators. As a workaround, you can call ListApplications manually, passing the appropiate parameters to get it working.
Just for more info. What seems wrong is that everywhere it says nextToken
, it should say NextToken
. Can you confirm this works for you?
sub ListAllDeployments {
my $self = shift;
my $callback = shift @_ if (ref($_[0]) eq 'CODE');
my $result = $self->ListDeployments(@_);
my $next_result = $result;
if (not defined $callback) {
while ($next_result->nextToken) {
$next_result = $self->ListDeployments(@_, nextToken => $next_result->nextToken);
push @{ $result->deployments }, @{ $next_result->deployments };
}
return $result;
} else {
while ($result->nextToken) {
$callback->($_ => 'deployments') foreach (@{ $result->deployments });
$result = $self->ListDeployments(@_, nextToken => $result->nextToken);
}
$callback->($_ => 'deployments') foreach (@{ $result->deployments });
}
return undef
}
The code you provided doesn't differ from the code in the Paws/CodeDeploy.pm.
Same issue here with Health
use Paws;
use Data::Dumper;
my $obj = Paws->service('Health',region=>'us-east-1');
my $res = $obj->DescribeAllEvents();
print Dumper($res);
Can't locate object method "nextToken" via package "Paws::Health::DescribeEventsResponse" at /usr/local/share/perl/5.26.1/Paws/Health.pm line 103.
Any suggestions?
@provector : It should work if you change nextToken
for NextToken
in the sub DescribeAllEvents
.