The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Data::Object::Scalar - A Scalar Object for Perl 5

VERSION

version 0.13

SYNOPSIS

    use Data::Object::Scalar;

    my $scalar = Data::Object::Scalar->new(qr/\w/);

DESCRIPTION

Data::Object::Scalar provides common methods for operating on Perl 5 scalar objects. Scalar methods work on data that meets the criteria for being a scalar.

METHODS

and

    # given 12345;

    $scalar->and(56789); # 56789

    # given 0;

    $scalar->and(56789); # 0

The and method performs a short-circuit logical AND operation using the string as the lvalue and the argument as the rvalue and returns the last truthy value or false. This method returns a data type object to be determined after execution.

not

    # given 0;

    $scalar->not; # 1

    # given 1;

    $scalar->not; # ''

The not method performs a logical negation of the string. It's the equivalent of using bang (!) and return true (1) or false (empty string). This method returns a data type object to be determined after execution.

or

    # given 12345;

    $scalar->or(56789); # 12345

    # given 00000;

    $scalar->or(56789); # 56789

The or method performs a short-circuit logical OR operation using the string as the lvalue and the argument as the rvalue and returns the first truthy value. This method returns a data type object to be determined after execution.

xor

    # given 1;

    $scalar->xor(1); # 0
    $scalar->xor(0); # 1

The xor method performs an exclusive OR operation using the string as the lvalue and the argument as the rvalue and returns true if either but not both is true. This method returns a data type object to be determined after execution.

SEE ALSO

AUTHOR

Al Newkirk <anewkirk@ana.io>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Al Newkirk.

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