NAME
String::BooleanSimple - Gets the boolean representative of a string
SYNOPSIS
# imports all functions
use String::BooleanSimple ':all';
# imports only is_true()
use String::BooleanSimple qw(is_true);
DESCRIPTION
Some static functions returning a boolean value (0 or 1) of a string like 'true', 'false', etc.
REQUIRES
METHODS
boolean
my $boolean = boolean($string);
Returns 1 if the string matches to a postive pattern like "true". Returns 0 if the string matches to a negative pattern like "false".
isFalse
my $boolean = isFalse($string);
If you like the java style, you may import that alias
isTrue
my $boolean = isTrue($string);
If you like the java style, you may import that alias
is_false
my $boolean = is_false($string);
Returns 1 if the string matches to a negative pattern like "false".
is_true
my $boolean = is_true($string);
Returns 1 if the string matches to a positive pattern like "true".
Matches
Supports these strings:
true yes active enabled on y ok positive 1 2 3 4 5 6 7 8 9
false no inactive disabled off n not ok negative 0
If the string does not match, it causes an error. Whitespace at the beginning or end will be automatically removed.
AUTHOR
Andreas Hernitscheck ahernit(AT)cpan.org
LICENSE
You can redistribute it and/or modify it under the conditions of LGPL.