Class::Value::Boolean - A boolean value object


Class-Value documentation Contained in the Class-Value distribution.

Index


Code Index:

NAME

Top

Class::Value::Boolean - A boolean value object

VERSION

Top

version 1.100840

SYNOPSIS

Top

    my $v = Class::Value::Boolean->new('Y');

DESCRIPTION

Top

This is an enumerator value object that only accepts the value 0 and 1.

METHODS

Top

as_plaintext

Returns the value.

get_valid_values_list

Returns the list of valid values: 0 and 1.

get_value_normalization_hashref

Returns a hash reference that shows how to normalize values. Any of the characters [JjYy] will be normalized to 1, any of the characters [Nn] will be normalized to 0.

INSTALLATION

Top

See perlmodinstall for information and options on installing Perl modules.

BUGS AND LIMITATIONS

Top

No bugs have been reported.

Please report any bugs or feature requests through the web interface at http://rt.cpan.org/Public/Dist/Display.html?Name=Class-Value.

AVAILABILITY

Top

The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit http://www.perl.com/CPAN/ to find a CPAN site near you, or see http://search.cpan.org/dist/Class-Value/.

The development version lives at http://github.com/hanekomu/Class-Value/. Instead of sending patches, please fork this project using the standard git and github infrastructure.

AUTHOR

Top

  Marcel Gruenauer <marcel@cpan.org>

COPYRIGHT AND LICENSE

Top


Class-Value documentation Contained in the Class-Value distribution.

use 5.008;
use strict;
use warnings;

package Class::Value::Boolean;
our $VERSION = '1.100840';
# ABSTRACT: A boolean value object
use parent 'Class::Value::Enum';
sub get_valid_values_list { (0, 1) }

sub get_value_normalization_hashref {
    {   J => 1,
        j => 1,
        Y => 1,
        y => 1,
        N => 0,
        n => 0,
    };
}

# override to just use the value, no denormalization
sub as_plaintext { $_[0]->value }
1;


__END__