Issac Goldstand wrote: > Reposting a question (and the answer) that geoff and I discussed in the > IRC room, as I think it's worthwhile to mention... > > I had the following line of code (actually many of the sort): > $r->custom_response(FORBIDDEN=>"File size exceeds quota."); > > And kept getting errors like: > [Tue Apr 23 19:46:14 2002] null: Argument "FORBIDDEN" isn't numeric in > subroutine entry at /usr/local/httpd/lib/perl/Mine/Pic/Application.pm > line 1343. > > The answer to the problem is that by using '=>' instead of ',', I was > making 'FORBIDDEN' become '"FORBIDDEN"' (string instead of numeric 403). > > Moral of the story: don't use => with Apache::Constants!
In fact, don't use constants at all. At least not the kind created by the "use constants" pragma and similar tricks. They have all kinds of problems like this. Use package variables instead ($FORBIDDEN). Maybe some day Perl will have real constants, but I'm perfectly happy with package variables in the meantime. - Perrin