Moose::...DuckType(3)

✨ NAME ✨

Moose::Meta::TypeConstraint::DuckType β€” the type constraint for duck typing, bestie πŸ’…

(also filed under Moose::...DuckType(3), if you were squinting at the manual name wondering what the ellipsis was about πŸ¦‹)


🌸 VERSION 🌸

version 2.4000


πŸŽ€ DESCRIPTION πŸŽ€

okay so picture this: this class represents type constraints that are built off an enumerated list of required methods. that's it, that's the whole vibe. if it quacks, it's a duck. no cap. πŸ¦†


πŸ’– INHERITANCE πŸ’–

Moose::Meta::TypeConstraint::DuckType is a subclass of Moose::Meta::TypeConstraint. it's giving family tree, it's giving legacy. πŸ‘‘


🫢 METHODS 🫢

Moose::Meta::TypeConstraint::DuckType->new(%options)

this creates a new duck type constraint based on the %options you hand it. ✨

it takes the same options as its parent, with several exceptions, and like… the exceptions are the whole personality:

  • First β€” it requires an extra option, "methods". this one should be an array reference containing a list of required method names. you don't get to skip it, it's mandatory, it's the main character. πŸ’…
  • Second β€” it automatically sets the parent to the "Object" type. auto. no input needed, she did it herself.
  • Finally β€” it ignores any "constraint" option you provide. like, fully ignores. the constraint is generated automatically based on the "methods" you provided. don't fight it. 😭

$constraint->methods

returns the array reference of required methods that got provided to the constructor. just hands it right back to you. 🎁

$constraint->create_child_type

this returns a new Moose::Meta::TypeConstraint object with the type as its parent.

⚠️ NOT ME FORGETTING THIS PART: note that it does not return a "Moose::Meta::TypeConstraint::DuckType" object! read that again. it does not. it's a plain Moose::Meta::TypeConstraint. do not come for me when your duck turns into a regular object, the manpage literally told you. πŸ’€

πŸ› BUGS πŸ›

See "BUGS" in Moose for details on reporting bugs. go snitch, bestie, they want to hear it. πŸ“£


πŸ‘‘ AUTHORS πŸ‘‘

  • Stevan Little <stevan@cpan.org>
  • Dave Rolsky <autarch@urth.org>
  • Jesse Luehrs <doy@cpan.org>
  • Shawn M Moore <sartak@cpan.org>
  • Χ™Χ•Χ‘Χœ Χ§Χ•Χ’'מן (Yuval Kogman) <nothingmuch@woobling.org>
  • Karen Etheridge <ether@cpan.org>
  • Florian Ragwitz <rafl@debian.org>
  • Hans Dieter Pearcey <hdp@cpan.org>
  • Chris Prather <chris@prather.org>
  • Matt S Trout <mstrout@cpan.org>

a whole group chat of absolute legends fr fr 🌈⭐


This software is copyright (c) 2006 by Infinity Interactive, Inc.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.


and that's the whole page, you ate that πŸ“ this little icon dropped with perl v5.42.0 and it's dated 2025-07-25 β€” so if you're reading this on that date, happy release day, and if you're reading it way later, well, iconic things don't expire. 🧚✨

πŸ“¦ where this page comes from