我有一个casperjs脚本,当我在linux服务器上运行时会给出所需的结果,但是当我从笔记本电脑运行时,它不起作用.
我该如何调试?工作日志:
[info] [phantom] Starting...
[info] [phantom] Running suite: 3 steps
[debug] [phantom] opening url: http://caspertest.grsrv.com/, HTTP GET
[debug] [phantom] Navigation requested: url=http://caspertest.grsrv.com/, type=Other, willNavigate=true, isMainFrame=true
[debug] [phantom] Navigation requested: url=https://caspertest.grsrv.com/my_app, type=Other, willNavigate=true, isMainFrame=true
[debug] [phantom] Navigation requested: url=https://caspertest.grsrv.com/my_app/, type=Other, willNavigate=true, isMainFrame=true
[debug] [phantom] url changed to "https://caspertest.grsrv.com/my_app/"
[debug] [phantom] Navigation requested: url=https://caspertest.grsrv.com/my_app/#/auth, type=Other, willNavigate=true, isMainFrame=true
[debug] [phantom] url changed to "https://caspertest.grsrv.com/my_app/#/auth"
[debug] [phantom] Successfully injected Casper client-side utilities
[info] [phantom] Step anonymous 2/3 https://caspertest.grsrv.com/my_app/#/auth (HTTP 200)
[info] [remote] attempting …Run Code Online (Sandbox Code Playgroud) 我正在学习Perl并编写了一个小脚本来打开perl文件并删除注释
# Will remove this comment
my $name = ""; # Will not remove this comment
#!/usr/bin/perl -w < - 不要删除此特别评论
要编辑的文件名称通过终端作为参数传递
die "You need to a give atleast one file-name as an arguement\n" unless (@ARGV);
foreach (@ARGV) {
$^I = "";
(-w && open FILE, $_) || die "Oops: $!";
/^\s*#[^!]/ || print while(<>);
close FILE;
print "Done! Please see file: $_\n";
}
Run Code Online (Sandbox Code Playgroud)
现在我通过终端运行它:
perl removeComments file1.pl file2.pl file3.pl
我得到了输出:
Done! Please see file:
这个脚本正如我所期待的那样完全正常工作
问题1:为什么$_不打印文件名?
问题2:由于循环运行3次,为什么 …
我正在使用Xshell来ssh Unix服务器,我正在尝试搜索包含特定文本的文件.
我正在使用的命令是: grep -ilr "blah_blah_text" ./
它找到了我想要的东西,但它也发出了这些警告:
grep:警告:./ snn/pages/dvorak/xhtml/mh370/core/dvorak/found:递归目录循环
grep:警告:./ snn/pages/dvorak/xhtml/mh370/ocean/dvorak/testing/sea:递归目录循环
grep:警告:./ snn/pages/dvorak/xhtml/mh370/asia/dvorak/testing /found:递归目录循环
grep:警告:./ snn/pages/dvorak/xhtml/mh370/ocean/testing/dvorak/found:递归目录循环
grep:警告:./ snn/pages/dvorak/xhtml/mh370/asia/testing/dvorak/monday:递归目录循环
grep:警告:./ snn/pages/dvorak/xhtml/mh370/inse/testing /found:递归目录循环
grep:警告:./ snn/pages/dvorak/xhtml/mh370/testing/dvorak/copa/sea:递归目录循环
grep:警告:./ snv/pages/dvorak/xhtml/mh370/testing/devorak/copa/monday:递归目录循环
grep:警告:./ snn/pages/dvorak/xhtml/mh370/testing/devorak/monday:递归目录循环
grep:警告:./ snn/pages/dvorak/xhtml/mh370/testing/copan/dvorak/found:递归目录循环
grep:警告:./ snn/pages/dvorak/xhtml/mh370/testing/ocean/dvorak/monday:递归目录循环
grep:警告:./ snv/pages/dvorak/xhtml/mh370/testing/copan/monday:递归目录循环
grep:警告:./ snn/pages/gulf/xhtml/qwerty/copa/dvorak/found:递归目录循环
grep:警告:./ snv/pages/gulf/xhtml/qwerty/copa/dvorak/testing/sea:递归目录循环
grep:警告:./ snn/pages/gulf/xhtml/qwerty/copa/dvorak/testing/found:递归目录循环
grep:警告:./ snv/pages/gulf/xhtml/qwerty/copan/testing/dvorak/found:递归目录循环
grep:警告:./ snv/pages/gulf/xhtml/qwerty/copan/testing/dvorak/monday:递归目录循环
grep:警告:./ svn/pages/gulf/xhtml/qwerty/core/testing /found:递归目录循环
grep:警告:./ snn/pages/gulf/xhtml/qwerty/dvorak/copa/sea:递归目录循环
grep:警告:./ snn/pages/gulf/xhtml/qwerty/dvorak/copa/testing/sea:递归目录循环
grep:警告:./ snv/pages/gulf/xhtml/qwerty/dvorak/copa/testing/find:递归目录循环
grep:警告:./ snn/pages/gulf/xhtml/qwerty/dvorak/testing/sea:递归目录循环
grep:警告:./ snn/pages/gulf/xhtml/qwerty/dvorak/testing/core/sea:递归目录循环
grep:警告:./ snv/pages/gulf/xhtml/qwerty/dvorak/testing/copan/monday:递归目录循环
grep:警告:./ snn/pages/india/xhtml/abcd/testing/dvorak/copa/sea:递归目录循环
grep:警告:./ snn/pages/india/xhtml/abcd/testing/dvorak/copa/monday:递归目录循环
grep:警告:./ snn/pages /india/xhtml/abcd/testing/dvorak/monday:递归目录循环
grep:警告:./ snn/pages/india/xhtml/abcd/testing/core/dvorak/found:递归目录循环
grep:警告:./ snn/pages/india/xhtml/abcd/testing/copa/dvorak/monday:递归目录循环
grep:警告:./ snn/pages /india/xhtml/abcd/testing/core/monday:递归目录循环
grep:warning:./ snn/pages /india/xhtml/abcd/dvorak/copa/sea:递归目录循环
grep:警告:./ snn/pages/india/xhtml/abcd/dvorak/copa/testing/sea:递归目录循环
grep:警告:./ snn/pages/india/xhtml/abcd/dvorak/copa/testing/find:递归目录循环 …
在Perl中是否有办法以IMAGE格式获取URL的内容?
我可以use LWP::Simple获取HTML,但仍然无法弄清楚如何以JPEG格式获取它
我正在学习参考资料.在中级Perl(第2版):第5章(参考和范围)一书中,给出了以下代码:
my $ref;
{
my @skipper = qw(blue_shirt hat jacket preserver sunscreen); # ref count is 1
$ref = \@skipper; # ref count is 2
print "$ref?>[2]\n"; # prints jacket\n
}
print "$ref?>[2]\n"; # still prints jacket\n # ref count is 1
Run Code Online (Sandbox Code Playgroud)
当我运行此代码时,它给出了输出:
ARRAY(0x83fc890)?>[2]
ARRAY(0x83fc890)?>[2]
以为它应该打印夹克.
当我尝试在没有引号的情况下运行它时,我得到了输出:
Unrecognized character \xE2; marked by <-- HERE after print $ref<-- HERE near column 12 at prog.pl line 5.
我试了一下:
$$ref[2] #Worked
${$ref}[2] #Worked
所以,
书中给出的代码是错误的吗?(我被告知这是一本好书 - 我正在读它,我发现它很棒.不确定这是印刷错误还是我做错了什么)