The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Scalar::Boolean - Makes scalar variables store Boolean values only

VERSION

version 0.01

SYNOPSIS

    use Scalar::Boolean;

    booleanize my $value;  # you can even use `booleanise`
    $value = [];       # $value gets set to 1
    $value = 'Perl';   # $value gets set to 1
    $value = '';       # $value gets set to 0
    $value = '0';      # $value gets set to 0
    $value = undef;    # $value gets set to 0
    $value = ();       # $value gets set to 0

    unbooleanise $value;  # same as `unbooleanize`
    $value = 'foo';  # $value gets set to 'foo'
    …

METHODS

booleanise or booleanize

Accepts scalar variables which will be booleanised. Once booleanised, the variable will convert all values that are assigned to it to their corresponding Boolean values. No effect on already booleanised variables.

unbooleanise or unbooleanize

Accepts scalar variables which will be unbooleanised if already booleanised. No effect on not already booleanised variables.

AUTHOR

Alan Haggai Alavi <alanhaggai@alanhaggai.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Alan Haggai Alavi.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 68:

Non-ASCII character seen before =encoding in '…'. Assuming UTF-8