$r->custom_response(SERVER_ERROR => 'yikes');
the (difficult to spot) problem is that => makes the SERVER_ERROR constant (500) into the string "SERVER_ERROR". so, you needed to use a comma instead, making the code look like this:
$r->custom_response(SERVER_ERROR, 'yikes');
well, with mod_perl 2.0 and perl-5.8.0 and later, you can use the => operator and still get your constant, so
$r->custom_response(Apache::SERVER_ERROR => 'yikes');
will now work in mod_perl 2.0-land. well, most of the time...
as it turns out, there is a caveat: the constant needs to be defined at least one level deep, meaning that if you imported the constants into your own namespace instead of the Apache:: namespace (as mod_perl 2.0 will let you) this
$r->custom_response(SERVER_ERROR => 'yikes');
still doesn't work. oh, well.
for those that don't give a hoot about mod_perl, (or are otherwise thus far confused), give this script a whirl with a few different perl versions:
package My;
use constant FOO => 0; # My::FOO
package main;
use constant FOO => 1; # main::FOO
args(FOO => 'arrow');
args(FOO, 'comma');
args(main::FOO => 'arrow');
args(main::FOO, 'comma');
args(My::FOO => 'arrow');
args(My::FOO, 'comma');
sub args {
print join ':', @_, "\n";
}
no constant (Score:1)
However, you can make the arrow operator stuff work by calling SERVER_ERROR as SERVER_ERROR().