- open($input_fh, "<", $input);
- open($output_fh, ">", $output);
+ if ($input eq "-") {
+ $input_fh = *STDIN;
+ $input_abs = File::Spec->rel2abs(".");
+ } else {
+ if (not open($input_fh, "<", $input)) {
+ error(4, "%s: %s\n", $input, $!);
+ }
+ $input_abs = File::Spec->rel2abs($input);
+ }
+ if ($output eq "-") {
+ $output_fh = *STDOUT;
+ } else {
+ if (not open($output_fh, ">", $output . "~")) {
+ error(4, "%s: %s\n", $output . "~", $!);
+ }
+ }
+
+ # CGI::SSI uses SCRIPT_FILENAME to determine the value of LAST_MODIFIED.
+ %ENV = (
+ "DOCUMENT_NAME" => $input,
+ "DOCUMENT_URI" => $input,
+ "DOCUMENT_ROOT" => $root,
+ "SCRIPT_FILENAME" => $input_abs,
+ );