in reply to Resource Not Found error
First off I'd restructure that somewhat to separate the business logic from generating the HTML. That makes it possible to see the actual code. Along the way I'd switch to using a lexical file handle.
But most importantly I'd trap runtime error and report any error returned by open if it fails. Putting that all together along with modern strictures you get:
use warnings; use strict; use CGI; my $result; eval { my @query = split(/=/, $ENV{'QUERY_STRING'}); my $term = $query[$#query]; my $file = 'd:\\apps\\AETrigger\\' . $term . '.txt'; $result = open (my $fh, '>', $file) ? "Trigger for $term ($query[0]) has been created." : "Error '$!' creating trigger; please contact support."; return 1; } or do { $result = "Error: $@"; }; print <<HTML; Content-type: text/html <html>\n<head>\n<meta http-equiv="Content-Type" content="text/html; ch +arset=iso-8859-1" /> <link rel="stylesheet" href="http://pctldocs/doc_style.css" type="text +/css" /> <title>Trigger Result</title>\n</head> <body> Result:<br /> $result </body>\n</html> HTML
If that doesn't get you a page reporting the error then more likely you have a configuration error somewhere. Have you tried a simple "Hello World" program?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Resource Not Found error
by StorminN61 (Initiate) on May 07, 2025 at 13:08 UTC | |
by GrandFather (Saint) on May 07, 2025 at 21:30 UTC |