LoginSignup
0
0

More than 5 years have passed since last update.

print() on closed filehandle ...

Posted at

print() on closed filehandle ...

Perlでpostfixのaliasesファイル操作をしようとしていたところ,上記エラーが発生.

発生状況

open(ALIASES,">> /hoge/hoge/aliases");
for my $mail (@$refmail){
    print ALIASES $mail.",";
}
close(ALIASES);

ALIASESをファイルハンドラとしてデータベースから引っ張ってきたメールアドレスをクラスの方で配列として,そのリファレンスを返してもらい,foreach文でデリファレンスして$mailとして回しながらaliasesに追記していこうとしたところうまくいかず,aliasesファイルには何も追記されない.

結論

単純な話,ファイルの書き込み権限がないだけだった.
Perlうんぬんというより,権限をしっかり確認しましょうというお話.
でも,そもそもこのままだと権限ゆるゆるなので考えなければいけない.

未熟者は精進したします.

0
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0