NAME

Devel::Ladybug::Scalar - Scalar object class

DESCRIPTION

Extends Devel::Ladybug::Object to handle Perl scalar values as Devel::Ladybug Objects.

SYNOPSIS

use Devel::Ladybug::Scalar;

{
  my $scalar = Devel::Ladybug::Scalar->new("Hello World");
  print "$scalar\n";

  # Hello World
}

{
  my $scalar = Devel::Ladybug::Scalar->new(5);
  my $result = $scalar + $scalar;
  print "$scalar + $scalar = $result\n";

  # 5 + 5 = 10
}

PUBLIC CLASS METHODS

  • $class->new($scalar)

    Instantiate a new Devel::Ladybug::Scalar. Accepts an optional scalar value as a prototype object

    Usage is cited in the SYNOPSIS section of this document.

PUBLIC INSTANCE METHODS

  • $self->get()

    Abstract method, not implemented.

    Delegates to superclass if class method.

  • $self->set( )

    Abstract method, not implemented.

    Delegates to superclass if class method.

  • $self->length

    Object wrapper for Perl's built-in length() function. Functionally the same as length(@$ref).

    my $scalar = Devel::Ladybug::Scalar->new("Testing");
    
    my $length = $scalar->length(); # returns 7
  • $self->isEmpty()

    Returns a true value if self contains no values, otherwise false.

    my $array = Devel::Ladybug::Scalar->new("");
    
    if ( $self->isEmpty() ) {
      print "Is Empty\n";
    }
    
    # Expected Output:
    #
    # Is Empty
    #
  • $self->clear()

    Truncate self to zero length.

  • $self->value()

    Returns the actual de-referenced value of self. Same as ${ $self };

  • $self->sprint()

    Overrides superclass to sprint the actual de-referenced value of self.

  • $self->say()

    Prints the de-referenced value of self with a line break at the end.

SEE ALSO

perlfunc

This file is part of Devel::Ladybug.

REVISION

$Id: $