App-RoboBot

 view release on metacpan or  search on metacpan

lib/App/RoboBot/Plugin/Core/Compare.pm  view on Meta::CPAN

package App::RoboBot::Plugin::Core::Compare;
$App::RoboBot::Plugin::Core::Compare::VERSION = '4.004';
use v5.20;

use namespace::autoclean;

use Moose;
use MooseX::SetOnce;

extends 'App::RoboBot::Plugin';

=head1 core.compare

Exports functions for performing various types of vaue comparisons.

=cut

has '+name' => (
    default => 'Core::Compare',
);

has '+description' => (
    default => 'Provides functions for performing comparisons between values.',
);

=head2 eq

=head3 Description

String equality test. Returns 1 if both operands are the same in a string
context, 0 if they are not.

=head3 Usage

<operand> <operand>

=head2 lt

=head3 Description

String ordinality test. Returns 1 if ``a`` sorts before ``b`` according to the
collation rules of the locale in which the bot is running. Returns 0 otherwise.

=head3 Usage

<operand a> <operand b>

=head3 Examples

    (lt "abc" "def")

=head2 gt

=head3 Description

String ordinality test. Returns 1 if ``a`` sorts after ``b`` according to the
collation rules of the locale in which the bot is running. Returns 0 otherwise.

=head3 Usage

<operand a> <operand b>

=head3 Examples

    (gt "zyx" "abc")

=head2 ne

=head3 Description

String inequaity test. Returns 1 if both operands are different in a string
context, 0 otherwise.

=head3 Usage

<operand a> <operand b>

=head2 cmp

=head3 Description

String comparison. Returns -1 if ``a`` collates before ``b``, 1 if ``b``
collates first, and 0 if they are equal. Collation uses the locale under which
the bot is running.

=head3 Usage

<operand a> <operand b>

=head2 ==

=head3 Description

Numeric equality test. Returns 1 if both operands the same numerically, 0
otherwise.

=head3 Usage

<operand a> <operand b>

=head3 Examples

    (== 1 1.0000000)

=head2 <

=head3 Description

Numeric less-than test. Returns 1 if ``a`` is less than ``b``, 0 otherwise.

=head3 Usage

<operand a> <operand b>

=head3 Examples

    (< 1 2)

=head2 >

=head3 Description

Numeric greater-than test. Returns 1 if ``a`` is greater than ``b``, 0
otherwise.

=head3 Usage

<operand a> <operand b>

=head3 Examples

    (> 50 10)

=head2 !=

=head3 Description

Numeric inequality test. Returns 1 if both operands are different numbers, 0
otherwise.

=head3 Usage

<operand a> <operand b>



( run in 2.387 seconds using v1.01-cache-2.11-cpan-ceb78f64989 )