Jonathan Vanasco wrote: > > It was annoying to get my head around this. the 'magic' part of it > holds true and makes it confusing. > > for the longest time, i would just print $var, ref $var and other stuff > to STDERR to try and get my head around it > > I never quite did completely understand it, but doing the above trained > me to code for it
well, it's actually not all that magical :) the :method attribute is a core perl feature - it's how you mark a subroutine as being a method. see $ perldoc attributes for more details there. now, since that subroutine is marked as being a method deep within in the perl API, mod_perl can see that and do something special with it. hopefully you understand by now that mod_perl is really just a fancy dispatching engine: browser -> calls apache -> calls mod_perl -> calls your perl subroutine -> unwind so, when mod_perl calls your Perl*Handler it can (essentially) my $rc = My::PerlResponseHandler::handler(); or my $rc = My::PerlResponseHandler->handler(); it does the former by default, but if it sees the :method attribute set on the handler() subroutine it uses the latter syntax. HTH --Geoff