3.27.9. PostProcessingHook Previous topic Parent topic Child topic Next topic

This optional parameter allows you to define a Perl function that will be called during packet processing. PostProcessingHook is called for each request after all authentication methods have been called and just before a reply is sent back to the requesting NAS. A reference to the current request is passed as the first argument, and a reference to the reply packet currently being constructed is passed as the second argument. If the processing results in no reply (for example, if the request is proxied) then PostProcessing-Hook is not called.
The hook code is compiled by Perl when Radiator starts up. Compilation errors in your hook code will be reported to the log file at start-up time. Runtime errors in your hook will also be reported to the log file when your hook executes. Multiline hooks (i.e. with trailing backslashes (\)) are parsed by Radiator into one long line. Therefore, you should not use trailing comments in your hook.
PostProcessingHook can be an arbitrarily complicated Perl function, that might run external processes, consult databases, change the contents of the current reply or many other things.
# Fake a new attribute into the reply
PostProcessingHook sub { ${$_[1]}->add_attr('Class', \
      'billing rate 1');}