Parse:...:Param(3pm)

πŸ“¦
version 1.003019 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

🌸 Parse::Method::Signatures::Param πŸ’…

okay bestie, so this is a page from the User Contributed Perl Documentation and the manual name is Parse:...:Param(3pm) β€” say it with me, it's a whole vibe. πŸŽ€


✨ NAME ✨

Parse::Method::Signatures::Param β€” literally just a parsed parameter that came out of a signature. that's it, that's the whole thing πŸ¦‹


πŸ”’ ATTRIBUTES πŸ”’

heads up: every single attribute on this class is read-only. no take-backs, no edits, no touching. look with your eyes only, bestie. πŸ‘€

  • required β€” is this parameter required (true) or optional (false)? that's the whole question. 🌈
  • sigil β€” the effective sigil of this parameter. and it's one of '$', '@' or '%', periodt. πŸ’…
  • type_constraints β€” 🫢
    • Type: Parse::Method::Signatures::TypeConstraint
    • Predicate: has_type_constraints
    • this is the representation of the type constraint for this parameter. but lowkey, most of the time you're just gonna call meta_type_constraint and not come anywhere near this attribute directly. iykyk. ✨
  • default_value β€” πŸ“
    • Type: Str
    • Predicate: has_default_value
    • a string that should be eval'd or injected to get the default value for this parameter. for example:
$name = 'bar'

would give a default_value of "'bar'". yeah, the quotes come along for the ride, that's just how it is. πŸ™ˆ

  • constraints β€” πŸ’œ
    • Type: ArrayRef[Str]
    • Predicate: has_constraints
    • these are the "where" constraints for this type. each member of the array is the string (including the enclosing braces) of the where constraint block. so brace yourself, literally. 🧚
  • param_traits β€” πŸ‘‘
    • Type: ArrayRef[ Tupple[Str,Str] ]
    • Predicate: has_traits
    • the traits that this parameter is declared to have. for instance:
$foo does coerce

would have a trait of:

['does', 'coerce']

cute, right? 🌸


πŸ› οΈ METHODS πŸ› οΈ

  • to_string β€” the name says it all bestie, it turns the thing into a string. ✨
  • meta_type_constraint β€” get the Moose::Meta::TypeConstraint for this parameter. but FIRST, check that the type actually has a type constraint, because you don't wanna be that girl:
$tc = $param->meta_type_constraint if $param->has_type_constraints;
fr fr, don't skip the check. use has_type_constraints first or you're just asking for chaos. 😭

πŸ‘€ SEE ALSO πŸ‘€

Parse::Method::Signatures. go read that one next, it's giving main character energy. πŸ”₯


πŸ’– AUTHORS πŸ’–

  • Ash Berlin <ash@cpan.org>.
  • Florian Ragwitz <rafl@debian.org>.

absolute icons, we stan. 🫢


πŸ“œ LICENSE πŸ“œ

Licensed under the same terms as Perl itself. slay. βœ…


and that's the whole page, bestie! this was perl v5.34.0, dated 2022-06-16, brought to you by the Parse:...:Param(3pm) manual. mwah, go forth and parse responsibly πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from