Type::P...ignature(3)

πŸ’… Type::Params::Signature(3) β€” bestie edition

ok so this is a page from the User Contributed Perl Documentation, and the module is Type::Params::Signature. sit down, grab a strawberry drink πŸ“, and let's get into it.


✨ NAME ✨

Type::Params::Signature β€” the internal representation of a function signature. like, it's the vibe of your function's arguments, encoded as an object. main character energy fr.

🚦 STATUS 🚦

Real talk: this module is not covered by the Type-Tiny stability policy. so like... it could change on you. no cap. πŸ™ˆ

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so mostly this is internal code β€” like, backstage crew, not the performer β€” but plot twist, you can use it to get basic introspection for signatures. it's giving "peek behind the curtain." πŸ‘‘

πŸŽ€ Constructors

  • new(%attributes) β€” the normal one, takes a hash of attributes.
  • new_from_compile($style, %attributes) β€” takes a $style plus the attributes.
  • new_from_v2api(\%attributes) β€” takes a hashref of attributes. very old-school, very demure.

πŸ’– Attributes

heads up bestie: all attributes are read-only. you look, you don't touch. πŸ‘€

  • package β€” ClassName. the package we're providing a signature for. it gets used to look up any stringy type names. iykyk.
  • subname β€” Str. the sub we're providing a signature for.
  • description β€” Str. a lil description, as a treat.
  • method β€” 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 β€” CodeRef.
  • strictness β€” Bool|ScalarRef.
  • next β€” CodeRef.
  • goto_next β€” CodeRef. literally just an alias for next. that's it. slay.
  • can_shortcut β€” Bool. tells you whether the signature has no potential to alter @_, which means it can be returned without being copied if the type checks pass. generally speaking, do not pass this to the constructor β€” just let Type::Params::Signature figure it out. it's got this. 🫢
  • coderef β€” InstanceOf['Eval::TypeTiny::CodeAccumulator']. you probably don't want to provide this to the constructor either. the whole point of this module is to build it for you! that's the job. πŸ’…
  • is_named β€” Bool.
  • allow_dash β€” Bool.
  • bless β€” Bool|ClassName.
  • class β€” ClassName.
  • constructor β€” Str.
  • class_attributes β€” HashRef. this is a HashRef suitable for passing to the import method of Class::XSAccessor. a default gets generated based on parameters.
  • named_to_list β€” ArrayRef. this one can be coerced from a bool based on parameters.
  • list_to_named β€” Bool.
  • oo_trace β€” Bool. defaults to true. indicates whether blessed $arg hashrefs created by the signature will include a '~~caller' key.

🧚 Bare attributes

these attributes may be passed to the constructors and may do something, but no methods are provided to access the values later. so like... they're there. ghosting you, respectfully. πŸ’€

  • positional or pos β€” ArrayRef.
  • named β€” ArrayRef.
  • multiple or multi β€” ArrayRef.
  • returns β€” Bool. shortcut for setting returns_scalar and returns_list simultaneously. two for one, we love efficiency.
  • want_source β€” Bool.
  • want_details β€” Bool.
  • want_object β€” Bool.
  • rationalize_slurpies β€” Bool. yes that's the real name. no i will not be commenting further.

πŸ”₯ Methods

⭐ Predicates

predicate methods return true/false to indicate the presence or absence of attributes. very "are they or aren't they" energy.

  • has_description
  • has_head
  • has_tail
  • has_parameters
  • has_slurpy
  • has_on_die
  • has_strictness
  • has_returns_scalar
  • has_returns_list

πŸ‘‘ Class making methods

these get called automatically during object construction and you should not typically call them yourself. they're public methods in case you wanna subclass Type::Params::Signature β€” which, honestly, go off. 🌈

  • make_class_pp β€” builds the class specified in bless by evaluating Perl code.
  • make_class_xs β€” builds the class specified in bless using Class::XSAccessor.
  • make_class β€” calls either make_class_pp or make_class_xs. it picks. it's ✨decisive✨.
  • make_class_pp_code β€” generates the code for make_class_pp.

πŸŽ€ Other methods

  • BUILD β€” called by the constructors. you should not call this. like seriously bestie, hands off πŸ™…β€β™€οΈ.
  • return_wanted β€” normally returns the signature coderef, unless want_source, want_details, or want_object were provided to the constructor. in that case it returns the source code for the coderef, a hashref of details, or $self respectively. it's versatile! it contains multitudes! πŸ’œ

🌍 ENVIRONMENT 🌍

  • PERL_TYPE_PARAMS_XS β€” affects the building of accessors for $arg objects. if set to true, it will use Class::XSAccessor. if set to false, it will use pure Perl. if this environment variable does not exist, it will use Class::XSAccessor.
also important: if Class::XSAccessor is not installed or is too old, pure Perl will always be used as a fallback. safety net, iconic behavior.

πŸ› BUGS πŸ›

please report any bugs to <https://github.com/tobyink/p5-type-tiny/issues>. be nice about it, the maintainer is doing great. 🫢

πŸ‘€ SEE ALSO πŸ‘€

Type::Params, Type::Params::Parameter, Type::Params::Alternatives. the whole friend group, honestly.

✍️ AUTHOR ✍️

Toby Inkster <tobyink@cpan.org>. legend behavior.

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. periodt. πŸ’…

⚠️ DISCLAIMER OF WARRANTIES ⚠️

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.

like, no promises. no refunds. she said what she said. 😭


and that's the whole page bestie!! this was rendered by perl v5.42.2 and dated 2026-04-07 β€” mwah, go touch grass, ily πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from