Perlについての質問箱 12箱目
■ このスレッドは過去ログ倉庫に格納されています
0514_gunzip
NGNG記憶によればclient-side PerlScriptではopen CMD, "anycommand -opt |"や
backquoteは使えないのではなかったか。
system("anycommand >outfile")でいったんファイルに落として読みなおすのが素直かも。
Windows環境が今ちょっと手元にないので試してないが大体以下のような感じ。
<script language = "PerlScript">
sub execute_command {
my $command = shift || return;
my $tempfile = "tempfile.txt"; #or File::Temp
my $endcode = system("$command >$tempfile");
if ($endcode != 0) {
#blah, blah, blah
}
open TEMP, $tempfile or return;
my @result = <TEMP>;
close TEMP;
unlink $tempfile;
return wantarrary ? @result : \@result;
}
sub button1_click {
my $host = $window->document->form->host->{"value"};
$window->document->write(execute_command("tracert $host"));
}
</script>
後は同じ。
■ このスレッドは過去ログ倉庫に格納されています