od -x test 说明:
0000000 457f 464c 0102 0001
现在我想使用Perl来创建这样的文件.
open FH,'>','test_1';
#syswrite(FH,0x457f464c01020001); # not work
print FH 0x457f464c01020001; # not work
Run Code Online (Sandbox Code Playgroud)
如何在Perl中创建二进制文件?
我正在运行Dancer并发现它很慢 - 页面需要很长时间才能渲染.
这是Dancer :: Introduction的示例代码:
#!/usr/bin/perl
# make this script a webapp
use Dancer;
# declare routes/actions
get '/' => sub {
"Hello World";
};
get '/hello/:name' => sub {
"Hello ".param('name');
};
# run the webserver
Dancer->dance;
Run Code Online (Sandbox Code Playgroud)
它需要我的浏览器10秒钟来获取和呈现响应(在firefox中使用firebug).
和舞者的消息:
[20734] core @0.000228> request: GET / from 192.168.1.101 in /usr/lib/perl5/site_perl/5.8.8/Dancer/Handler.pm l. 57
[20734] core @0.000809> [hit #44]trying to match `/' against /^\/$/ in /usr/lib/perl5/site_perl/5.8.8/Dancer/Route.pm l. 84
[20734] core @0.000953> [hit #44] --> got …Run Code Online (Sandbox Code Playgroud) 我想http://www.foo.com/bar.html从http://www.foo.com/bar.html?key=value....
正则表达式应该做的工作.有一些模块可以做到这一点吗?我检查了URI,似乎没有这样的子.
m!PATTERN!如果PATTERN包含 /字符,我可以使用.
我也可以这样使用split /PATTERN/,EXPR,LIMIT吗?