Question
The TWiki plugin template uses extractNameValuePair to get the parameters with the variable.
The code construct suggests:
$tmp = TWiki::Func::extractNameValuePair( $args, "headerrows" );
$headerRows = $tmp if( $tmp );
This protects agains assigning undef variables. AND it also
makes it impossible to return "" and 0
extractNameValuePair initialises the return variable as "";
As a consequence, using if (defined $tmp ) will always return TRUE.
Is it possible to initialise the return value from extractNameValuePair as undef ( $value );
That way variables that are set to "" and to 0 are returned and set correctly.
regards...
Environment
--
BramVanOosterhout - 21 Jan 2006
Answer
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
True if you expect something else than a number, although headerrows suggests a number. Where did you find this?
--
PeterThoeny - 21 Jan 2006
I took the construct from TablePlugin.
I checked again and saw that there the construct varies depending on the type of data expected.
So it checks $tmp ne ""; $tmp <1; etc.
I think I take a leaf out of that book and extend the tests.
Thanks for waking me up!
--
BramVanOosterhout - 22 Jan 2006