For more information... RTFM!
NAVIGATION
PAGES THAT LINK HERE
ACCOUNT LOGIN

You are not logged in

Powered by Interchange version 5.7.0

pgbooln

Return an undefined (Perl undef) value if the body text is undefined.  Return "f" (false) if the input is either blank, "0", "f" or "false", otherwise return "t" (true).

The match is not case sensitive.

The "pgbool" filter is the same as this one, except that it treats an undefined body text value as false.

Availability

Availability

This filter was introduced in version 5.4.0, and is therefore not available for use with any earlier Interchange version.

Example

  1. [filter pgbooln]False[/filter]
  2. [filter pgbooln]f[/filter]
  3. [filter pgbooln][/filter]
  4. [filter pgbooln]true[/filter]
  5. [filter pgbooln]Kevin Walsh[/filter]

Results in:

  1. f
  2. f
  3. f
  4. t
  5. t

Source code

sub {
    my $val = shift;
    return 'f' if ! defined($val);
    $val =~ s/\s+//g;
    return 'f' if $val =~ /^(?:0|f(?:alse)?)?$/i;
    return 't';
}

Category:  Filters
Last modified by: Kevin Walsh
Modification date: Friday 23 February 2007 at 8:14 PM (EST)
Home  |  Legal nonsense  |  Privacy policy  |  Contact us