【问题标题】:Why does Perl Net::Google::Search fail for me?为什么 Perl Net::Google::Search 对我来说失败了?
【发布时间】: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


【解决方案1】:

根据this ticket 的说法,Net::Google::Search 使用的 API 从 2009 年就已经失效,从 2005 年开始甚至无法安装该模块。

我不知道这是否是您面临的问题,但这没关系。你不会用那个模块得到任何结果。

【讨论】:

  • 有什么我可以尝试的想法吗?
  • 首先找出可用的 API(如果有)
猜你喜欢
  • 1970-01-01
  • 2019-02-07
  • 2019-08-12
  • 2011-02-21
  • 1970-01-01
  • 2015-03-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多