我正在尝试向ASP页发出回发请求,所以 我安装了WWW :: Mechanize :: Chrome 0.23及其所有必需的模块,并尝试执行该库随附的示例脚本,并出现以下错误:
Can't call method "new" without a package or object reference at C:/Strawberry/perl/vendor/lib/Chrome/DevToolsProtocol/Transport.pm line 42.
这是javascript示例(https://metacpan.org/pod/release/CORION/WWW-Mechanize-Chrome-0.23/lib/WWW/Mechanize/Chrome/Examples.pm#Example:-javascript.pl)的代码:
#!perl -w
use strict;
use WWW::Mechanize::Chrome;
my $mech = WWW::Mechanize::Chrome->new(tab => undef);
$mech->get_local('links.html');
$mech->eval_in_page(<<'JS');
alert('Hello Frankfurt.pm');
JS
<>;
=head1 NAME
javascript.pl - execute Javascript in a page
=head1 SYNOPSIS
javascript.pl
=head1 DESCRIPTION
B<This program> demonstrates how to execute simple
Javascript in a page.
=cut