I am getting a strange error with perl's inbuilt script flush.pl. I am callling this script in my other script but it kept throwing error:
flush.pl did not return a true value at ./abc.pl line 1
abc.pl has:
require 'flush.pl';
Not sure why this error is coming. Can someone pls throw some light on how to rectify this error. Just to let you know, I can't remove flush.pl from my script.
All Perl modules that are use d or require d have to "return" a true value. Simplest way: write a single 1; on a stand-alone line at the very bottom of your module.
I agree with you.. But this is the perl's own script residing in its own libraries so I can't modify it. And also this script already has 1; at the end of it. Pls see below code snippet of this script:
Hm, on my system with Perl 5.10.1 it's no problem to run
perl -we 'require "flush.pl"; &flush(*STDOUT);'
Can you post any more code, your Perl version used, ... any information that might be relevant.
As a side note, the file explicitly states that
# This library is no longer being maintained, and is included for backward
# compatibility with Perl 4 programs which may require it.
#
# In particular, this should not be used as an example of modern Perl
# programming techniques.
so it might be better to switch to IO::Handle, or change the value of $| (see [url=http://perldoc.perl.org/perlvar.html]perldoc perlvar[/icode] for a description)