【发布时间】:2014-01-11 10:11:48
【问题描述】:
最近,我找到了 plot.ly 网站并正在尝试使用它。 但是,当我使用 Perl API 时,我无法成功。 我的步骤如下。
- 我用谷歌账号注册了 plot.ly
- 已安装 Perl 模块(WebService::Plotly)
- 键入基本示例(“https://plot.ly/api/perl/docs/line-scatter”)
..跳过..
use WebService::Plotly;
use v5.10;
use utf8;
my $user = "MYID";
my $key = "MYKEY";
my $py= WebService::Plotly->new( un => $user, key => $key );
say __LINE__; # first say
my $x0 = [1,2,3,4];
my $y0 = [10,15,13,17];
my $x1 = [2,3,4,5];
my $y1 = [16,5,11,9];
my $response = $py->plot($x0, $y0, $x1, $y1);
say __LINE__ ; # second say
..跳过...
然后,执行示例 perl 代码 =>> 但是,在这一步中,$py->plot 总是返回“HTTP::Response=HASH(0x7fd1a4236918)” 第二个说没有执行 (我使用的 Perl 版本是 5.16.2 和 5.19.1,操作系统是 MacOS X)
在手上,python example("https://plot.ly/api/python/docs/line-scatter") 总是成功的。
请告诉我这个问题。 非常感谢!
【问题讨论】:
-
在脚本开头添加这一行并显示输出
use Carp; $SIG{__DIE__} = sub { confess @_; }; -
我已将您的代码添加到脚本的开头行。我得到的结果是 12 和 HTTP::Response=HASH(0x100e5e568) 我应该怎么做?谢谢!