From d3893aec7519986b7410c7b1ded1a64bad369150 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Fri, 27 Aug 2010 12:44:46 -0500 Subject: [PATCH] POD for macro transform --- lib/WebGUI/Macro.pm | 48 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/lib/WebGUI/Macro.pm b/lib/WebGUI/Macro.pm index 26971ed71..6f5811f50 100644 --- a/lib/WebGUI/Macro.pm +++ b/lib/WebGUI/Macro.pm @@ -225,6 +225,54 @@ sub _processParameters { return \@params; } +=head2 transform ( $session, \$content, $sub ) + +Transforms the macro calls in $content accoring to $sub. For each macro call found, $sub will be called with a hash of information about the call. The return value of the sub should be either undef to leave the macro call untouched, or a string to replace the macro call with. Macros are not processed recursively. If recursive processing is needed, trannsform can be called again inside $sub. + +=head3 $session + +The WebGUI session to use. + +=head3 \$content + +A reference to a string to transform macros in. The string will be modified in place. + +=head3 $sub + +A sub reference to call for each macro call. + +The hash passed to $sub will contain: + +=over 4 + +=item session + +The session passed in. + +=item macro + +The name of the macro called. + +=item macroPackage + +The module name for the macro from the config file. + +=item originalText + +The full original text of the macro call. + +=item parameters + +An array reference to the parameters passed to the macro. + +=item parameterString + +The full original text of the parameters. + +=back + +=cut + sub transform { my $session = shift; my $content = shift;