NAME

Venus::Role::Unpackable - Unpackable Role

ABSTRACT

Unpackable Role for Perl 5

SYNOPSIS

package Example;

use Venus::Class;

with 'Venus::Role::Unpackable';

sub execute {
  return shift;
}

package main;

my $example = Example->new;

# $example->unpack("hello", 123, 1.23)->signature(
#   'string', 'number', 'float',
# );

DESCRIPTION

This package modifies the consuming package and provides methods for unpacking and validating argument lists.

METHODS

This package provides the following methods:

unpack

unpack(any @args) (Venus::Unpack)

The unpack method passes the arguments provided to Venus::Unpack for unpacking and validating arbitrary argument lists.

Since 2.01

unpack example 1
package main;

my $example = Example->new;

my $results = $example->unpack("hello", 123, 1.23)->signature(
  'any',
);

# ["hello", 123, 1.23]
unpack example 2
package main;

my $example = Example->new;

my $results = $example->unpack("hello", 123, 1.23)->signature(
  'string',
  'number | float',
);

# ["hello", 123, 1.23]
unpack example 3
package main;

my $example = Example->new;

my $results = $example->unpack("hello", 123, 1.23)->signature(
  'string',
  'number',
  'float',
);

# ["hello", 123, 1.23]

AUTHORS

Awncorp, awncorp@cpan.org

LICENSE

Copyright (C) 2022, Awncorp, awncorp@cpan.org.

This program is free software, you can redistribute it and/or modify it under the terms of the Apache license version 2.0.