- - PR -
Linuxでは動くのに、WindowsのActivePerlでは動かないんです・・
1
投票結果総投票数:2 | |||
---|---|---|---|
Windows | ![]() |
1票 | 50.00% |
Linux | ![]() |
1票 | 50.00% |
|
投稿者 | 投稿内容 |
---|---|
|
投稿日時: 2005-10-27 21:19
初めて投稿させていただきます。
WindowsのActivePelrに関する質問ですので、ここに投稿するのは違うかもしれませんが ご教授願えないでしょうか。 以下のようなプログラムを作成しましたが このプログラムをLinuxで動かすと hoge.pl 1->キーボードで打ち込んだ内容が表示される hoge.pl < hoge.pl 2->自分自身のプログラムを表示して終了 hoge.pl hoge.pl 3->自分自身のプログラムを表示して終了 なのですが、このプログラムをWindowsの ActivePerlで実行すると 上記1はLinuxと同じになるのですが、 2,3 はファイル内容が出力されません。 どうしてなのか、ご教授願えないでしょうか? ↓以下ソースです ------------------------------------------------------ #!/usr/bin/perl use strict; use Getopt::Std; use File::Basename; use FileHandle; use IO::File; ########################### ### ### 処理メインブロック開始 ### ########################### sub MyPrint { my ($infh,$ofh) = @_; while( <$infh> ) { print $ofh $_; } } my $stdout = new IO::File; $stdout = \*STDOUT; print $stdout "this is hoge\n"; my $stdin = new FileHandle; if( @ARGV ) { for my $file (@ARGV) { open ($stdin,"< $file" ) or do { print STDERR "cannot open $file. $!\n"; next; }; MyPrint( $stdin,$stdout ); close( $stdin ); } } else { open( $stdin,"<-" ) or die "cannot open stdin\n"; MyPrint( $stdin,$stdout ); } ------------------------------------------------------ 何卒よろしくお願い致します。 |
1