| 177 | We now turn our focus to the callback functions. The prototype for a callback function is: |
| 178 | |
| 179 | {{{VOID callback(PMC dircfg, PMC args)}}} |
| 180 | * {{{dircfg}}}: the current directory configuration |
| 181 | * {{{args}}}: an array of arguments |
| 182 | |
| 183 | In a server scope, {{{dircfg}}} will be populated with that server's document root directory configuration (XXX verify this). |
| 184 | |
| 185 | Directive callbacks are responsible for updating the module configuration based on the arguments provided from the Apache config. In the case of {{{ParrotHandler}}}, {{{func}}} references the {{{cmd_parrothandler}}} subroutine, which will be called each time the {{{ParrotHandler}}} directive is encountered in the Apache configuration. Since it's a {{{TAKE1}}} callback, {{{args}}} will have one element. When called, it updates the directory configuration with the name of the response handler from {{{args}}}. |
| 186 | |
| 187 | ''Example: The {{{ParrotHandler}}} directive callback'' |
| 188 | |
| 189 | {{{ |
| 190 | .sub cmd_parrothandler |
| 191 | .param pmc dircfg |
| 192 | .param pmc args |
| 193 | |
| 194 | $S0 = args[0] |
| 195 | dircfg['response_handler'] = $S0 |
| 196 | .end |
| 197 | }}} |
| 198 | |