Bubblegum::Object::Scalar - Common Methods for Operating on Scalars
version 0.22
use Bubblegum; my $variable = 12345; say $variable->or(56789); # 12345
Scalar methods work on data that meets the criteria for being a defined. It is not necessary to use this module as it is loaded automatically by the Bubblegum class.
my $variable = 12345; $variable->and(56789); # 56789 $variable = 0; $variable->and(56789); # 0
The and method performs a short-circuit logical AND operation using the subject as the lvalue and the argument as the rvalue and returns the last truthy value or false.
my $variable = 0; $variable->not; # 1 $variable = 1; $variable->not; # ''
The not method performs a logical negation of the subject. It's the equivalent of using bang (!) and return true (1) or false (empty string).
my $variable = 12345; $variable->or(56789); # 12345 $variable = 00000; $variable->or(56789); # 56789
The or method performs a short-circuit logical OR operation using the subject as the lvalue and the argument as the rvalue and returns the first truthy value.
my $variable = 12345; $variable->repeat(2); # 1234512345 $variable = 'yes'; $variable->repeat(2); # yesyes
The repeat method returns a string consisting of the subject repeated the number of times specified by the argument.
my $variable = 1; $variable->xor(1); # 0 $variable->xor(0); # 1
The xor method performs an exclusive OR operation using the subject as the lvalue and the argument as the rvalue and returns true if either but not both is true.
Al Newkirk <anewkirk@ana.io>
This software is copyright (c) 2013 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.
To install Bubblegum, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bubblegum
CPAN shell
perl -MCPAN -e shell install Bubblegum
For more information on module installation, please visit the detailed CPAN module installation guide.