Bubblegum
view release on metacpan or search on metacpan
lib/Bubblegum/Object/Scalar.pm view on Meta::CPAN
# ABSTRACT: Common Methods for Operating on Scalars
package Bubblegum::Object::Scalar;
use 5.10.0;
use namespace::autoclean;
use Bubblegum::Class 'with';
use Bubblegum::Constraints -isas, -types;
with 'Bubblegum::Object::Role::Output';
with 'Bubblegum::Object::Role::Value';
our @ISA = (); # non-object
our $VERSION = '0.45'; # VERSION
sub and {
my ($self, $other) = @_;
return $self && $other;
}
sub not {
my ($self) = @_;
return !$self;
}
sub or {
my ($self, $other) = @_;
return $self || $other;
}
sub print {
my $self = CORE::shift;
return CORE::print $self, @_;
}
sub repeat {
my $self = CORE::shift;
my $number = type_number CORE::shift;
return $self x $number;
}
sub say {
my $self = CORE::shift;
return print($self, @_, "\n");
}
sub xor {
my ($self, $other) = @_;
return ($self CORE::xor $other) ? 1 : 0;
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Bubblegum::Object::Scalar - Common Methods for Operating on Scalars
=head1 VERSION
( run in 0.837 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )