- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
重要更新:问题与 Apache 或 mod_perl 无关。
最简单的演示:
> perl -le 'use PerlIO::via::QuotedPrint; binmode(\*STDERR, ":via(PerlIO::via::QuotedPrint):utf8"); open (ERROR, ">&STDERR");'
zsh: segmentation fault perl -le
binmode
由我的代码和
open (ERROR, ">&STDERR");
执行由 Parse::RecDescent 提供。
require Parse::RecDescent
内声明
Spreadsheet::WriteExcel
包裹。
[pid 31253] dup(2) = 8
[pid 31253] ioctl(8, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fffcf66a328) = -1 ENOTTY (Inappropriate ioctl for device)
[pid 31253] lseek(8, 0, SEEK_CUR) = 0
[pid 31253] --- SIGSEGV (Segmentation fault) @ 0 (0) ---
Parse::RecDescent
的代码并注意到类似
open (ERROR, ">&STDERR");
的声明
use strict;
use warnings;
# DANGEROUS
use PerlIO::via::QuotedPrint;
binmode(\*STDERR, ":via(PerlIO::via::QuotedPrint):utf8");
my $app = sub {
my $env = shift;
open (ERROR, ">&STDERR"); # segmenatation fault
return [
'200',
[ 'Content-Type' => 'text/plain' ],
[ "hello world" ],
];
};
$app;
PerlIO::via::QuotedPrint
,但效果是一样的)
binmode(\*STDERR, ":via(PerlIO...
, apache 没有段错误。
STDERR
, apache 没有段错误。
binmode
在 STDERR 上,但效果不佳。
perl -v |grep version
This is perl 5, version 14, subversion 2 (v5.14.2) built for x86_64-linux-gnu-thread-multi
uname -a
Linux thinkpad 3.2.0-32-generic #51-Ubuntu SMP Wed Sep 26 21:33:09 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
lsb_release -c
Codename: precise
dpkg -l |grep mod-perl
ii libapache2-mod-perl2 2.0.5-5ubuntu1 Integration of perl with the Apache2 web server
uname -a
FreeBSD liruoko.ru 9.1-RELEASE-p5 FreeBSD 9.1-RELEASE-p5 #7 r253740: Sun Jul 28 16:53:08 MSK 2013 roman@thor.cmc.msu.ru:/usr/obj/usr/src/sys/MINI amd64
pkg info |grep apache
apache22-itk-mpm-2.2.25 Version 2.2.x of Apache web server with itk MPM.
pkg info |grep mod_perl
ap22-mod_perl2-2.0.8,3 Embeds a Perl interpreter in the Apache2 server
perl -v |grep version
This is perl 5, version 14, subversion 4 (v5.14.4) built for amd64-freebsd
最佳答案
如果没有 binmode
也能工作设置,那么也许你有一个解决方案(如果不是为什么会发生这种情况的真正答案)。比照此摘录自 perldoc -f binmode
:
On some systems (in general, DOS- and Windows-based systems) binmode() is
necessary when you're not working with a text file. For the sake of portability
it is a good idea always to use it when appropriate, and never to use it when it
isn't appropriate. Also, people can set their I/O to be by default UTF8-encoded
Unicode, not bytes.
In other words: regardless of platform, use binmode() on binary data, like
images, for example. ...
perldoc
的独特风格中我认为这可能暗示您可以设置
binmode
对于某些文件句柄/套接字,而不是为其他文件句柄/套接字进行调整,直到“错误”(如果是一个)不出现。
perl
的调试版本尝试跟踪错误,它在
liberperl.so
中- 某处
PerlIOBase_dup()
.我也在 IRC 上向知道的人提到了这一点,他们得出结论,这是一个真实的(即可报告的)
perl
漏洞。
gdb
:
(gdb) run -Dx -le 'use PerlIO::via::QuotedPrint; binmode(\*STDERR,
":via(PerlIO::via::QuotedPrint):utf8"); open (ERROR, ">&STDERR");'
Program received signal SIGSEGV, Segmentation fault.
PerlIOBase_dup (f=0x0, o=0x801551060, param=0x0, flags=2) at perlio.c:2307
2307 PerlIOBase(f)->flags |= PERLIO_F_UTF8;
perl
更好的!
关于perl - binmode + mod_perl 2.0.5 + Parse::RecDescent = 段错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18533538/
使用 binmode 时,是否应该从以前可能使用的 binmode 中弹出图层? #!/usr/bin/env perl use warnings; use 5.012; use autodie; o
我需要禁用 HTTP 响应的渐进式缓冲。 我已经使用文件句柄类在 Perl 中进行了这项工作: $|=1; $TIE = tie(*STDOUT,__PACKAGE__); 打印语句存储在一个数组中,
为什么 binmode as raw 会产生元音变音?能否详细说明“Zurich”字符串在 Perl 中的内部存储方式?只是有点迷路。 use strict; use warnings; my $fi
这个电话 my $th = threads->create(\&print, "Hello thread World!\n"); $th->join(); 工作正常。但是一旦我添加了 binmode(
我的脚本开头有以下块: #!/usr/bin/perl5 -w use strict; binmode(STDIN, ":utf8"); binmode(STDOUT, ":utf8"); binmo
我正在尝试从现有的 Perl 代码逆向工程一个 Julia 脚本,到目前为止一切顺利,但我现在必须在 Julia 中编写一堆二进制文件,这是我不熟悉的和。我想知道是否有人对该任务有任何经验,而且语法是
重要更新:问题与 Apache 或 mod_perl 无关。 最简单的演示: > perl -le 'use PerlIO::via::QuotedPrint; binmode(\*STDERR, "
我是一名优秀的程序员,十分优秀!