The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Venus::Role::Explainable - Explainable Role

ABSTRACT

Explainable Role for Perl 5

SYNOPSIS

  package Example;

  use Venus::Class;

  has 'test';

  sub explain {
    "okay"
  }

  with 'Venus::Role::Explainable';

  package main;

  my $example = Example->new(test => 123);

  # $example->explain;

DESCRIPTION

This package modifies the consuming package and provides methods for making the object stringifiable.

METHODS

This package provides the following methods:

explain

  explain() (Any)

The explain method takes no arguments and returns the value to be used in stringification operations.

Since 0.01

explain example 1
  package main;

  my $example = Example->new(test => 123);

  my $explain = $example->explain;

  # "okay"

OPERATORS

This package overloads the following operators:

operation: ("")

This package overloads the "" operator.

example 1

  package main;

  my $example = Example->new(test => 123);

  my $string = "$example";

  # "okay"
operation: (~~)

This package overloads the ~~ operator.

example 1

  package main;

  my $example = Example->new(test => 123);

  my $result = $example ~~ 'okay';

  # 1

AUTHORS

Cpanery, cpanery@cpan.org

LICENSE

Copyright (C) 2021, Cpanery

Read the "license" file.