Tags:
create new tag
view all tags
Sometime I have the problem that an empty *.txt file (0 bytes long) cause the view script to hang. There is a wait cursor in the browser and nothing happens.

I found out that the readFile function returns undef if the file is empty. I've changed the readFile into the following so that there is at least an empty string as return code.

My problem is solved with this.

# =========================
sub readFile
{
	 my( $name ) = @_;
	 my $data = "";
	 undef $/; # set to read to EOF
	 open( IN_FILE, "<$name" ) || return "";
	 $data = ;
	 $/ = "\n";
	 close( IN_FILE );

	 if (not defined $data)
		  {
		  $data = "";
		  }

	 return $data;
}

-- StefanScherer - 28 Dec 2000

This does not happen anymore since empty topics can't be saved and there is always some meta data.

-- PeterThoeny - 25 Aug 2001

TopicClassification:
BugResolved
Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2001-08-26 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.