--- loncom/xml/londefdef.pm 2010/09/14 03:48:36 1.423 +++ loncom/xml/londefdef.pm 2010/10/19 19:33:21 1.424 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Tags Default Definition Module # -# $Id: londefdef.pm,v 1.423 2010/09/14 03:48:36 raeburn Exp $ +# $Id: londefdef.pm,v 1.424 2010/10/19 19:33:21 raeburn Exp $ # # # Copyright Michigan State University Board of Trustees @@ -43,7 +43,6 @@ use Apache::lonnet; use strict; use Apache::lonxml; use Apache::lontable; -use Apache::File(); use Image::Magick; use Apache::lonmenu(); use Apache::lonmeta(); @@ -4616,13 +4615,13 @@ sub get_eps_image { #if replication failed try to produce eps file dynamically $src=~s/\.ps$/\.eps/; - my $temp_file; - open(FILE,">>/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.dat"); - my $newsrc=$orig_src; - $newsrc =~ s|(.*)/res/|/home/httpd/html/res/|; - &Apache::lonxml::debug("queueing $newsrc for dynamic eps production."); - print FILE ("$newsrc\n"); - close(FILE); + if (open(FILE,">>/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.dat")) { + my $newsrc=$orig_src; + $newsrc =~ s|(.*)/res/|/home/httpd/html/res/|; + &Apache::lonxml::debug("queueing $newsrc for dynamic eps production."); + print FILE ("$newsrc\n"); + close(FILE); + } $src=~s|/home/httpd/html/res|/home/httpd/prtspool|; $src=~s|/home/([^/]*)/public_html/|/home/httpd/prtspool/$1/|; if ($sext ne "") { # Put the ext. back in to uniquify. @@ -4655,8 +4654,10 @@ sub get_eps_image { sub eps_generation { my ($src,$file,$width_param) = @_; my $filename = "/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.dat"; - my $temp_file = Apache::File->new('>>'.$filename); - print $temp_file "$src\n"; + if (open(my $tmpfile,">>$filename")) { + print $tmpfile "$src\n"; + close($tmpfile); + } my $newsrc = $src; $newsrc =~ s/(\.bmp|\.gif|\.jpg|\.jpeg)$/\.eps/i; $newsrc=~s{/home/httpd/html/res}{};