From 62cb3a4b9c92841e7be8f18f8c985d6e789d1f55 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Fri, 2 Oct 2009 14:21:29 -0500 Subject: [PATCH] correct error detection code in export --- lib/WebGUI/AssetExportHtml.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/WebGUI/AssetExportHtml.pm b/lib/WebGUI/AssetExportHtml.pm index 708004fa1..95b522d41 100644 --- a/lib/WebGUI/AssetExportHtml.pm +++ b/lib/WebGUI/AssetExportHtml.pm @@ -791,14 +791,15 @@ sub exportWriteFile { my $dest = $self->exportGetUrlAsPath; my $parent = $dest->parent; - eval { $parent->absolute->mkpath }; - if($@) { - WebGUI::Error->throw(error => "could not make directory " . $parent->absolute->stringify); + $parent->absolute->mkpath( {error => \my $err} ); + if (@$err) { + (undef, my $message) = %{ $err->[0] }; + WebGUI::Error->throw(error => "Could not make directory " . $parent->absolute->stringify . ": " . $message); } # next, get the contents, open the file, and write the contents to the file. my $fh = eval { $dest->open('>:utf8') }; - if($@) { + if(! $fh) { WebGUI::Error->throw(error => "can't open " . $dest->absolute->stringify . " for writing: $!"); } $self->session->asset($self);