NAME

Sub::Conveyor - Subroutine chaining with types

VERSION

Version 0.02

SYNOPSIS

use Sub::Conveyor;
use Types::Standard qw/Int StrMatch Any/;

my $conveyor = Sub::Conveyor->new(
	[ Int ] => sub { return $_[0] },
	[ StrMatch[qr{^[a-zA-Z]+$}] ] => sub { return length $_[0] },
	[ Int ] => sub { return $_[0] / 2 },
);

$conveyor->add(Any, sub {
	return sprintf "The result is %s", $_[0];
});

$conveyor->call(100); # The result is 50
$conveyor->call('Hello'); # The result is 2.5

...

$conveyor->install('Test', 'testing');

Test->testing(100); # The result is 50

SUBROUTINES/METHODS

new

Instantiate a new Sub::Conveyor chain.

my $conveyor = Sub::Conveyor->new();

add

Add to the conveyor chain.

$conveyor->add(Any, Str, Int, \&cb);

call

Call the conveyor chain.

$conveyor->call(@params);

install

Install the conveyor chain into a package.

$conveyor->install($package, $method);

AUTHOR

LNATION, <email at lnation.org>

BUGS

Please report any bugs or feature requests to bug-sub-conveyor at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Sub-Conveyor. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Sub::Conveyor

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

This software is Copyright (c) 2025 by LNATION.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)