【发布时间】:2022-01-02 08:52:30
【问题描述】:
让Net::Google::Search 工作时遇到以下问题。我从 google 获得了一个 API 密钥,所以我假设我尝试使用的是 copacci。
use strict;
use Net::Google::Search;
my %args = (
key => 'MyGoogleAPIKey',
starts_at => 0,
max_results => 5,
);
my $search = Net::Google::Search->new(\%args);
执行此代码我得到:
Use of uninitialized value in concatenation (.) or string at /home/richard/perl5/lib/perl5/Net/Google/Service.pm line 80.
Service description 'file:' can't be loaded: 404 File `' does not exist
【问题讨论】:
-
你试过
new(%args)而不是new(\%args)吗?这更像是我所期望的 perl 接口。我认为,它应该使用的方式可能类似于Net::Google::Search->new(key => 'MyGoogleAPIKey', max_results => 5)。 -
感谢您的回复,但不幸的是
my $search = Net::Google::Search->new(key => 'MyGoogleAPIKey', max_results => 5);给了我完全相同的结果。 -
重新“相关?”切换到 Google::Search 很有可能无济于事。至少从 2012 年开始,该模块的文档说它使用了已弃用的 API。但是,这可能值得一试。
标签: perl