The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Object::KVC::Integer - Integer wrapper class

SYNOPSIS

  use Object::KVC::Integer;
  
  my $integer_1 = Object::KVC::Integer->new( 2 );
  my $integer_2 = Object::KVC::Integer->new( 3 );

  print $integer_1->as_string();

  $integer_1->equals( $integer_2 ) ? print "Yes, the objects are equal";

DESCRIPTION

Object::KVC::Integer is a integer wrapper class for use as a value in a Object::KVC::Hash object.

METHODS

new()

The constructor.

   my $object = Object::KVC::Integer->new( 345 );

Integer to be wrapped must be provided as an argument. Leading and trailing whitespace is stripped.

equals( <Object::KVC::Integer> )

Returns true if the wrapped integers are '=='

  $integer_1->equals( $integer_2 );

contains( <Object::KVC::Integer> )

Returns true if the wrapped integers are '=='

  $integer_1->contains( $integer_2 );

intersects( <Object::KVC::Integer> )

Returns true if the wrapped strings are '=='

  $integer_1->intersects( $integer_2 );

gt( <Object::KVC::Integer> )

Returns true if this integer object is '>' other

  $integer_1->gt( $integer_2 );

lt( <Object::KVC::Integer> )

Returns true if this integer object is '<' other

  $integer_1->lt( $integer_2 );

incr( <Object::KVC::Integer> )

Add 1 to the integer. '++'

  $integer_1->incr();

decr( <Object::KVC::Integer> )

Subtract 1 from the integer. '--'

  $integer_1->decr();

number()

Returns the integer value

  $integer_1->number();
  

as_string()

Returns the integer value

  $integer_1->as_string();

COPYRIGHT AND LICENSE

Object::KVC::Integer Copyright (C) 2012 Trystan Johnson

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.