开发者

How flush file in perl under mac?

开发者 https://www.devze.com 2023-03-03 02:27 出处:网络
I have perl, v5.10.0 built for darwin-thread-multi-2level in remote iMac. And I want to run some perl script which prints to file some data and flushes aft开发者_JAVA技巧er each line of output.

I have perl, v5.10.0 built for darwin-thread-multi-2level in remote iMac. And I want to run some perl script which prints to file some data and flushes aft开发者_JAVA技巧er each line of output.

  1. $file_handle->flush();
  2. autoflush $file_handle;

I have tried this two versions with use IO::Handle; in top of the file, but the result I'm getting is Can't locate object method "autoflush" via package "FileHandle".


Where are you getting your $file_handle from? Looks like it's a FileHandle instance, not an IO::Handle object.

You could try

use FileHandle;

at the top of the script, instead of IO::Handle. Alternatively, change your code so that $file_handle is no longer a FileHandle instance.

PS: you really shouldn't be running 5.10.0, it's got quite a few bugs. 5.10.1 or anything newer is a lot better.


Are you sure the "use IO::Handle;" doesn't have a typo?

It looks to me like the module hasn't loaded.


use FileHandle; solved my issue. I was having issues with Net::SCP::Expect. This happened under CentOS 6.3.

I was getting errors like:
-can't locate object method autoflush via package filehandle
-can't locate object method blocking via package filehandle

0

精彩评论

暂无评论...
验证码 换一张
取 消