- Timestamp:
- 11/08/08 10:49:11 (2 months ago)
- Files:
-
- 1 modified
-
src/perl6/spec_highlight (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/perl6/spec_highlight
r22922 r22925 86 86 $fail++; 87 87 88 # catch those pesky CTRL-Cs89 if($CHILD_ERROR &= 127) {90 say "CTRL-C detected... bye bye";91 last;92 }93 94 88 # let us write something useful into those htmls 95 89 # when an error occurs 96 my $error_html = <<"ERROR"; 97 <html><title>Error</title><body><pre> 90 write_error_html($simple_html, $file, $log, 1); 91 write_error_html($snippet_html, $file, $log, 0); 92 write_error_html($full_html, $file, $log, 1); 93 94 say "error"; 95 } else { 96 $success++; 97 say "ok"; 98 } 99 } 100 101 # write the error log in the html file provied 102 sub write_error_html { 103 my ($html_file, $file, $log, $is_full) = @ARG; 104 105 my $error_html = ""; 106 if($is_full) { 107 $error_html = "<html><title>Error</title><body>"; 108 } 109 110 $error_html .= <<"ERROR"; 111 <pre> 98 112 99 113 An error has occured while processing this file: … … 103 117 Reason: 104 118 $log 105 </pre> </body></html>119 </pre> 106 120 ERROR 107 open SIMPLE_HTML, ">$simple_html" 108 or die "Could not open $simple_html for writing: $OS_ERROR\n"; 109 print SIMPLE_HTML $error_html; 110 close SIMPLE_HTML; 111 open FULL_HTML, ">$full_html" 112 or die "Could not open $full_html for writing: $OS_ERROR\n"; 113 print FULL_HTML $error_html; 114 close FULL_HTML; 115 say "error"; 116 } else { 117 $success++; 118 say "ok"; 121 122 if($is_full) { 123 $error_html .= "<body></html>"; 119 124 } 125 126 open FILE, ">$html_file" 127 or die "Could not open $html_file for writing: $OS_ERROR\n"; 128 print FILE $error_html; 129 close FILE; 120 130 } 121 131
