此脚本适用于带有-w交换机的localhost,但不是没有.当它也可以use strict和use warning活跃.
的Apache2/error.log中:
没有开关(中止脚本):
(2)No such file or directory: exec of ... failed
Run Code Online (Sandbox Code Playgroud)
我得到的开关:
Use of uninitialized value $email_flag in string ne ...
Run Code Online (Sandbox Code Playgroud)
看起来很像我.
在实时Web服务器上都没有人工作.Perl对我来说很新,但我知道一些BASH和PHP.
我运行Debian Lenny,Apache2,Perl 5.10.
#!/usr/bin/perl -w
$| = 1;
my $mailprog = '/usr/sbin/sendmail'; # where the mail program lives
my $to = "not\@for.you"; # where the mail is sent
my ($command,$email,@pairs,$buffer,$pair,$email_flag) ;
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
# Split the pair up into …Run Code Online (Sandbox Code Playgroud)