archive_me1Add my vote for this tag create new tag
, view all tags

Add isTrue() to TWiki::Func

Currently TWiki uses TWiki::isTrue to determine whether a boolean option to a tag represents true or false.

The values interpreted are 1, 0, on, off.

The proposal is to:

  1. Extend the range of values to recognise true, false, yes and no.
  2. Add isTrue to TWiki::Func for the benefit of plugins authors.


isTrue( $value, $default ) -> $boolean

Returns 1 (true) if $value is true, and 0 otherwise. true means set to something that Perl interprets as a Perl true value, i.e. anything except the empty string or numeric 0, with the special cases that off, false and no (case insensitive) all mean false. Leading and trailing spaces in $value are ignored.

If (and only if) $value is undef then $default is returned. If $default is not specified it is taken as 0 (false).

Since: $TWiki::Plugins::VERSION 1.13


Note that the pod doc on TWiki::isTrue is currently wrong; false is currenty interpreted as true.


-- Contributors: CrawfordCurrie - 25 Mar 2007


Sounds like a very useful extension to me which will make life easier for plugin authors. And fully compatible.

-- KennethLavrsen - 25 Mar 2007

Good idea; no-brainer.

-- PeterThoeny - 25 Mar 2007

No concern raised. No need for release meeting decision. Accepted by 14-day rule.

-- KennethLavrsen - 09 Apr 2007

Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r6 - 2007-04-25 - KennethLavrsen
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.