Subject: | Errors in example code? |
I'm new to mod_perl coding so am not sure if I'm misreading the cookbook or whether I've got something more serious happening. I followed the code in the eg/public-pl/login.pl example which extracts the destination and authcookiereason from the args method. It turns out I was having authcookiereason set to destination when first coming to my form (i.e., both arguments were empty).
Page 87 of Mod_perl Cookbook says that args is a method that returns the string following the ?. The example code is calling it as though it were a function that returns the value of a key. It apparently also sets the string which is the behavior I appear to be getting. I changed that code to look like the following (copied from Apache::AuthCookie) and am getting the expected behavior:
if (my %args = $r->args()) {
$destination = $args{ 'destination' };
$authcookiereason = $args{ 'AuthCookieReason' };
}
Thanks,
William