Aion
view release on metacpan or search on metacpan
lib/Aion/Meta/Subroutine.pm view on Meta::CPAN
=encoding utf-8
=head1 NAME
Aion::Meta::Subroutine - describes a function with a signature
=head1 SYNOPSIS
use Aion::Types qw(Int);
use Aion::Meta::Subroutine;
my $subroutine = Aion::Meta::Subroutine->new(
pkg => 'My::Package',
subname => 'my_subroutine',
signature => [Int, Int],
referent => undef,
);
$subroutine->stringify # => my_subroutine(Int => Int) of My::Package
=head1 DESCRIPTION
Used to declare the required function in interfaces and abstract classes.
In this case, C<referent ~~ Undef>.
It also creates a wrapper function that checks the signature.
=head1 SUBROUTINES
=head2 new (%args)
Constructor.
=head2 wrap_sub ()
Creates a wrapper function that checks the signature.
=head2 compare ($subroutine)
Checks its (expected) signature against the one declared by the function in the module and throws an exception if the signatures do not match.
=head2 stringify ()
String description of the function.
=head2 pkg ()
Returns the name of the package in which the function is declared.
=head2 subname ()
Returns the name of the function.
=head2 signature ()
Returns the function signature.
=head2 referent ()
Returns a reference to the original function.
=head2 wrapsub ()
Returns a wrapper function that checks the signature.
=head1 AUTHOR
Yaroslav O. Kosmina L<mailto:dart@cpan.org>
=head1 LICENSE
â B<GPLv3>
=head1 COPYRIGHT
The Aion::Meta::Subroutine module is copyright © 2025 Yaroslav O. Kosmina. Rusland. All rights reserved.
( run in 0.593 second using v1.01-cache-2.11-cpan-99c4e6809bf )