Tags:
create new tag
, view all tags

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

TWiki version: TWikiRelease04Sep2004
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Debian Linux
Web server: Apache 1.3
Perl version: 5.8
Client OS:  
Web Browser: Firefox
Categories:  

-- BramVanOosterhout - 21 Jan 2006

Answer

ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list 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

 
Topic revision: r4 - 2006-01-22 - PeterThoeny
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.