Perl(windows和linux的区别)
我在 Ubuntu 中使用以下 Perl 代码没有任何问题,但是当我在 XP 中使用 activeperl 尝试它时,它挂起,没有错误消息,只是一个空白屏幕。在标准 Perl 和活动 Perl 或 Windows 和 ubuntu 之间移动代码时,有什么我应该注意的问题吗?
*sub do_search
{
my $term = shift @_;
my $page = 1;
my @results;
while (scalar @results < $opts{maxresults})
{
my $rset = $handle->search({query=>$term, page => $page, rpp => $opts{rpp} });
print "Searching for $term (page $page)\n" if $opts{verbose};
if (ref $rset eq 'HASH' && exists $rset->{results})
{
# break out if no results came back
last unless @{$rset->{results}};
push @results, @{$rset->{results}};
printf "Now we have %d entries\n", scalar @results if $opts{verbose};
}
# go to the next page
$page++;
}
print_post($_) foreach @results;
}*
来源:http://www.ibm.com/developerworks/web/library/l-perl-twitter/index.html
- 谢谢
I use the following Perl code without any problems in Ubuntu, but when I try it in XP using activeperl it hangs, no error messages, just a blank screen. Are there any issues I should be aware of when moving code between standard perl and active perl or windows and ubuntu?
*sub do_search
{
my $term = shift @_;
my $page = 1;
my @results;
while (scalar @results < $opts{maxresults})
{
my $rset = $handle->search({query=>$term, page => $page, rpp => $opts{rpp} });
print "Searching for $term (page $page)\n" if $opts{verbose};
if (ref $rset eq 'HASH' && exists $rset->{results})
{
# break out if no results came back
last unless @{$rset->{results}};
push @results, @{$rset->{results}};
printf "Now we have %d entries\n", scalar @results if $opts{verbose};
}
# go to the next page
$page++;
}
print_post($_) foreach @results;
}*
source:http://www.ibm.com/developerworks/web/library/l-perl-twitter/index.html
-Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
关于特定于 Windows 的 Perl 问题有相当广泛的手册页 - perlwin32。
该脚本使用的唯一非核心包是 Net::Twitter,这似乎在 Windows 下获得良好的测试结果 - 平台测试矩阵。
There is quite extensive manual page about Windows-specific perl problems - perlwin32.
Only non-core package the script is using is Net::Twitter, which seems to have good test results under Windows - platform test matrix.