小编Chr*_*ris的帖子

Docker httpd apache 并让 cgi-bin 执行 perl 脚本

Docker 新手,正在尝试让 cgi-bin 在 httpd 映像中工作。我的 Dockerfile 如下。SED 行将 perl 位置添加到图像附带的示例脚本的第一行:

FROM httpd:2.4.46
RUN sed -i '1c#!/usr/bin/perl' /usr/local/apache2/cgi-bin/printenv
Run Code Online (Sandbox Code Playgroud)

然后我构建并运行:

docker build -t my-apache2 .
docker run -dit --name my-running-app -p 8080:80 my-apache2
Run Code Online (Sandbox Code Playgroud)

然后,我导航到localhost:8080/cgi-bin/printenv但不是执行脚本,而是将代码显示为文本。看来 httpd 映像默认启用了 ScriptAlias。有什么想法吗?

apache perl docker

5
推荐指数
1
解决办法
2627
查看次数

是什么导致 GNU Make 出壳

GNU make 如何决定是直接运行规则中的一行还是通过批处理文件运行?我在Windows Server 2008平台上使用GNU Make v3.80,所以我的shell是cmd.exe。

打开调试 (-d) 并注意到规则中的某些行不是通过子 shell 运行(在我的例子中使用 cmd.exe 进行批处理),而是似乎由 make 直接调用。

请参阅下面的示例。看看xcopy命令是如何直接运行的:

CreateProcess(C:\Windows\system32\xcopy.exe,xcopy /?,...)
Run Code Online (Sandbox Code Playgroud)

但 echo 命令是通过批处理文件运行的:

Creating temporary batch file C:\Users\fbloggs\AppData\Local\Temp\95\make732002.bat
Run Code Online (Sandbox Code Playgroud)

示例生成文件:

stackoverflow :
    xcopy /?
    @echo Done
Run Code Online (Sandbox Code Playgroud)

完整的 dDebug 输出:

GNU Make 3.80 Tool Version v1.3  build for Linux on 20060503
Copyright (C) 2002  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
find_and_set_shell …
Run Code Online (Sandbox Code Playgroud)

makefile

3
推荐指数
1
解决办法
1562
查看次数

Perl正则表达式匹配字符串没有结束的东西

什么正则表达式会正确匹配这个?我想识别不以特定文本结尾的字符串(_array).我试图使用负向前瞻但无法使其正常工作.(注意显而易见的答案是反向(m {_array $}),但有一个原因我不想这样做).TIA

 use strict;
 use warnings;
 while(<DATA>) {
    #
    ## If the string does not end with '_array' print No, otherwise print Yes
    m{(?!_array)$} ? print "No  = " : print "Yes = ";
    print;
 }
 __DATA__
 chris
 hello_world_array
 another_example_array
 not_this_one
 hello_world
Run Code Online (Sandbox Code Playgroud)

我想要的输出应该是:

 No  = chris
 Yes = hello_world_array
 Yes = another_example_array
 No  = not_this_one
 No  = hello_world
Run Code Online (Sandbox Code Playgroud)

regex perl negative-lookahead

1
推荐指数
1
解决办法
2763
查看次数

Ghostscript postscript pswrite是编码文本

为什么Ghostscript pswrite在其输出中编码我的文本?考虑以下MWE:

%!PS-Adobe-3.0 
%%Title: mwe.ps
%%Pages: 001
%%BoundingBox: 0 0 595 842
%%EndComments

%%Page: 1 1
%%PageBoundingBox: 0 0 595 842
0 0 1 setrgbcolor
0 0 595 842 rectfill
1 0 0 setrgbcolor
247 371 100 100 rectfill
/Times-Roman findfont
72 scalefont
setfont
newpath
247 300 moveto
(Chris) show
showpage
Run Code Online (Sandbox Code Playgroud)

将此MWE保存到文件并在GSview中查看将显示一个蓝色页面,其中包含红色方块和我的名字.现在使用以下命令行通过Ghostscript 9.06运行此文件:

"c:\Program Files\gs\gs9.06\bin\gswin64c.exe" ^
  -dSAFER -dBATCH -dNOPAUSE ^
  -sDEVICE=pswrite -sPAPERSIZE=a4 -r72 -sOutputFile=mwe_gs.ps mwe.ps
Run Code Online (Sandbox Code Playgroud)

请参阅下面的Ghostscript输出.有人可以解释一下这里发生了什么.虽然两个rectfill命令仍然很明显,但我的文本(Chris)已经编码,不再可以区分.

是否有替代的postscript设备可以保留我的文本?

<snip>
%%Page: 1 1
%%PageBoundingBox: 0 0 595 842
%%BeginPageSetup
GS_pswrite_2_0_1001 begin
595 …
Run Code Online (Sandbox Code Playgroud)

matlab postscript ghostscript

1
推荐指数
1
解决办法
2600
查看次数