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?

Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond

Replies are listed 'Best First'.
Re^2: Resource Not Found error
by StorminN61 (Initiate) on May 07, 2025 at 13:08 UTC

    I have been able to run other Perl scripts on that server, so I don't think it is a configuration error with Perl. I tried your suggestion, but still get the "404 - File or directory not found. The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable." error.

      A 404 error is from the server so either the URL is broken or there is a configuration error somewhere. Nothing you can do in the code can fix the issue.

      Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond