Type::Params::Signature - internal representation of a function signature
This module is not covered by the Type-Tiny stability policy.
This is mostly internal code, but can be used to provide basic introspection for signatures.
All attributes are read-only.
package ClassNameThe package we're providing a signature for. Will be used to look up any stringy type names.
subname StrThe sub we're providing a signature for.
description Strmethod ArrayRef[InstanceOf['Type::Params::Parameter']]head ArrayRef[InstanceOf['Type::Params::Parameter']]tail ArrayRef[InstanceOf['Type::Params::Parameter']]parameters ArrayRef[InstanceOf['Type::Params::Parameter']]slurpy InstanceOf['Type::Params::Parameter']on_die CodeRefstrictness Bool|ScalarRefnext CodeRefgoto_next CodeRefAlias for next.
can_shortcut BoolIndicates whether the signature has no potential to alter @_ allowing it to be returned without being copied if type checks pass. Generally speaking, you should not provide this to the constructor and rely on Type::Params::Signature to figure it out.
coderef InstanceOf['Eval::TypeTiny::CodeAccumulator']You probably don't want to provide this to the constructor. The whole point of this module is to build it for you!
is_named Boolallow_dash Boolbless Bool|ClassNameclass ClassNameconstructor Strclass_attributes HashRefHashRef suitable for passing to the import method of Class::XSAccessor. A default will be generated based on parameters
named_to_list ArrayRefCan be coerced from a bool based on parameters.
list_to_named Booloo_trace BoolDefaults to true. Indicates whether blessed $arg hashrefs created by the signature will include a '~~caller' key.
These attributes may be passed to the constructors and may do something, but no methods are provided to access the values later.
positional or pos ArrayRefnamed ArrayRefmultiple or multi ArrayRefreturns BoolShortcut for setting returns_scalar and returns_list simultaneously.
want_source Boolwant_details Boolwant_object Boolrationalize_slurpies BoolPredicate methods return true/false to indicate the presence or absence of attributes.
has_descriptionhas_headhas_tailhas_parametershas_slurpyhas_on_diehas_strictnesshas_returns_scalarhas_returns_listThese methods will be called automatically during object construction and should not typically be called. They are public methods in case it is desired to subclass Type::Params::Signature.
make_class_ppBuilds the class specified in bless by evaluating Perl code.
make_class_xsBuilds the class specified in bless using Class::XSAccessor.
make_classCalls either make_class_pp or make_class_xs.
make_class_pp_codeGenerates the code for make_class_pp.
BUILDCalled by the constructors. You should not call this.
return_wantedNormally returns the signature coderef, unless want_source, want_details, or want_object were provided to the constructor, in which case it will return the source code for the coderef, a hashref of details, or $self.
PERL_TYPE_PARAMS_XSAffects the building of accessors for $arg objects. If set to true, will use Class::XSAccessor. If set to false, will use pure Perl. If this environment variable does not exist, will use Class::XSAccessor.
If Class::XSAccessor is not installed or is too old, pure Perl will always be used as a fallback.
Please report any bugs to https://github.com/tobyink/p5-type-tiny/issues.
Type::Params, Type::Params::Parameter, Type::Params::Alternatives.
Toby Inkster <tobyink@cpan.org>.
This software is copyright (c) 2023-2025 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.