tchatz has asked for the wisdom of the Perl Monks concerning the following question:

I have the following lines in my global.asa
if ($path[0] eq 'cms' && ($path[1] eq 'auth' || $path[1] eq 'upload')) + { $Response->{Status} = 403; $Response->End(); return; }
The problem is that status is undef if i warn Dumper($Response), and also in the headers of the response on the client side the status is 200

Only if I use $Server->Transfer( "index.asp" ) instead of $Response->End(); only then I get the 403 status but then I get the following error in the logs.

error executing code for include /opt/apache/htdocs/..../index.asp: no + include
Which makes sense because the index.asp does not exist.

But why when there is an error then the status does change to 403, and when I just use $Reponse->End() or just return, it doesn't work?

I would appreciate if someone shares some light into this Thanks for you time and consideration

Replies are listed 'Best First'.
Re: Apache::ASP issue
by tchatz (Initiate) on Jan 30, 2025 at 23:43 UTC

    Apparently in ScriptOnFlush I had my $status = $Response->Status() which set the status to 0, I changed it to my $status = $Response->{Status} and it works

    Thanks again everyone who read this

      The difference is that by this: $Response->Status() you call a function, and by this you get the value of the "property" named Status from object or hash named $Response: $Response->{Status} . In the former case, you get a warning if no such sub exists: can't locate object method 'Status' .... It's intuitive to assume there should be setters/getters rather than accessing an object's internal properties like above. I would check my code for more of these. Btw the Apache::ASP and Changelog therein mentions some changes to what Status is set by default etc.

      bw, bliako