routines
Typeable Method and Function Signatures
package main; use strict; use warnings; use routines; fun hello($name) { "hello, $name" } hello("world");
This pragma is used to provide typeable method and function signtures to the calling package, as well as before, after, and around method modifiers. Additionally, when used in concert with the registry pragma, this pragma will check to determine whether a Type::Tiny registry object is associated with the calling package, and if so will use it to reify type constraints and resolve type expressions.
before
after
around
package main; use strict; use warnings; use registry; use routines; fun hello(Str $name) { "hello, $name" } hello("world");
Additionally, when used in concert with the registry pragma this pragma will check to determine whether a Type::Tiny registry object is associated with the calling package, and if so will use it to reify type constraints and resolve type expressions.
package Example; use Moo; use registry; use routines; fun new($class) { bless {} } method hello(Str $name) { "hello, $name" } around hello(Str $name) { $self->{name} = $name; $self->$orig($name); } 1;
As mentioned previously, this pragma makes the before, after, and around method modifiers available the calling package where those keywords were already present in their generic subroutine form.
Al Newkirk, awncorp@cpan.org
awncorp@cpan.org
Copyright (C) 2011-2019, Al Newkirk, et al.
This is free software; you can redistribute it and/or modify it under the terms of the The Apache License, Version 2.0, as elucidated in the "license file".
Wiki
Project
Initiatives
Milestones
Contributing
Issues
To install routines, copy and paste the appropriate command in to your terminal.
cpanm
cpanm routines
CPAN shell
perl -MCPAN -e shell install routines
For more information on module installation, please visit the detailed CPAN module installation guide.