https://github.com/awncorp/routines
Typeable Method and Function Signatures
https://github.com/awncorp/routines
perl perl5 signatures
Last synced: 1 day ago
JSON representation
Typeable Method and Function Signatures
- Host: GitHub
- URL: https://github.com/awncorp/routines
- Owner: awncorp
- License: other
- Created: 2020-10-03T19:06:37.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-03T20:36:15.000Z (over 5 years ago)
- Last Synced: 2025-11-10T19:07:07.139Z (8 months ago)
- Topics: perl, perl5, signatures
- Language: Perl
- Size: 30.3 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
- Changelog: CHANGES
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
NAME
routines
ABSTRACT
Typeable Method and Function Signatures
SYNOPSIS
package main;
use strict;
use warnings;
use routines;
fun hello($name) {
"hello, $name"
}
hello("world");
DESCRIPTION
This pragma is used to provide typeable method and function signtures
to the calling package, as well as before, after, around, augment and
override method modifiers.
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 {}, $class
}
method hello(Str $name) {
"hello, $name"
}
around hello(Str $name) {
$self->{name} = $name;
$self->$orig($name);
}
1;
This functionality is based on Function::Parameters and uses Perl's
keyword plugn API to provide new keywords. As mentioned previously,
this pragma makes the before, after, around, augment, and override
method modifiers available to the calling package where that
functionality is already present in its generic subroutine callback
form.
AUTHOR
Al Newkirk, awncorp@cpan.org
LICENSE
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"
.
PROJECT
Wiki
Project
Initiatives
Milestones
Contributing
Issues