The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

NAME

Venus::Role::Stashable - Stashable Role

ABSTRACT

Stashable Role for Perl 5

SYNOPSIS

package Example;
attr 'test';
package main;
my $example = Example->new(test => time);
# $example->stash;

DESCRIPTION

This package modifies the consuming package and provides methods for stashing data within the object.

METHODS

This package provides the following methods:

stash

stash(any $key, any $value) (any)

The stash method is used to fetch and stash named values associated with the object. Calling this method without arguments returns all values.

Since 0.01

stash example 1
package main;
my $example = Example->new(test => time);
my $stash = $example->stash;
# {}
stash example 2
package main;
my $example = Example->new(test => time);
my $stash = $example->stash('test', {1..4});
# { 1 => 2, 3 => 4 }
stash example 3
package main;
my $example = Example->new(test => time);
my $stash = $example->stash('test');
# undef

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.