Tangen...::Class(3pm)

πŸ“¦
version 0.33 Β· 4 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– Tangence::Meta::Class πŸ’–

okay bestie, so this is the manual page for Tangence::Meta::Class β€” it lives in the Perl docs, section 3pm, and it's giving very "I am the blueprint" energy. pull up a chair 🫢


✨ NAME ✨

Tangence::Meta::Class β€” a whole data structure representing one Tangence class. yeah. one (1) class. it's the little container that knows everything about a class, and no cap, it does a lot for something so small.


🌸 DESCRIPTION 🌸

okay so picture this: this data structure object stores all the info about one Tangence class. that's its whole job and it's iconic for it. πŸ’…

and here's the part that matters β€” once you've constructed it and defined it, these objects are immutable. like, frozen. locked in. no take-backs, no edits, no "wait actuallyβ€”". they are who they are. periodt. πŸ”’


πŸŽ€ CONSTRUCTOR πŸŽ€

new

$class = Tangence::Meta::Class->new( name => $name )

returns you a brand new instance representing the name you handed it. baby class, freshly born, zero definition yet. πŸ¦‹

define

$class->define( %args )

this is the glow-up moment β€” it provides a definition for the class. here's what you can pass in:

  • methods => HASH β€” optional HASH reference stuffed with metadata about methods, as instances of Tangence::Meta::Method. 🧚
  • events => HASH β€” optional HASH reference containing metadata about events, as instances of Tangence::Meta::Event.
  • properties => HASH β€” optional HASH reference containing metadata about properties, as instances of Tangence::Meta::Property.
  • superclasses => ARRAY β€” optional ARRAY reference holding your superclasses as Tangence::Meta::Class references. it's giving family tree 🌈
lowkey important: all three of methods, events and properties are optional HASH references, and they're described together as carrying metadata about methods, events and properties as instances of Tangence::Meta::Method, Tangence::Meta::Event or Tangence::Meta::Property. so you can show up with none of them. no pressure bestie πŸ’œ

πŸ”₯ ACCESSORS πŸ”₯

defined

$defined = $class->defined

returns true if a definition for the class has been provided using define. basically the "have you actually done the thing yet" check. vibe check: passed or not. βœ…

name

$name = $class->name

returns the name of the class. yeah that's it, that's the tweet. πŸ“›

perlname

$perlname = $class->perlname

returns the perl name of the class. and the way this works is so cute: it's the Tangence name, except every dot gets replaced by double colons (::). so dots become :: and now Perl can actually read it. slay. πŸŽ€

direct_superclasses

@superclasses = $class->direct_superclasses

returns the direct superclasses, as a list of Tangence::Meta::Class references. direct = the ones right above you, not the whole ancestry. just your immediate parents, not your whole family reunion. πŸ‘‘

direct_methods

$methods = $class->direct_methods

returns the methods that this class directly defines β€” as in, the ones it wrote itself, rather than inheriting them from superclasses β€” as a HASH reference mapping names to Tangence::Meta::Method instances. 🧠

direct_events

$events = $class->direct_events

returns the events that this class directly defines (again, not the inherited ones) as a HASH reference mapping names to Tangence::Meta::Event instances. πŸ“£

direct_properties

$properties = $class->direct_properties

returns the properties that this class directly defines (not inherited, we said what we said) as a HASH reference mapping names to Tangence::Meta::Property instances. πŸ’Ž


🌈 AGGREGATE ACCESSORS 🌈

okay so these ones are the main character accessors β€” they don't just look at this one class, they inspect the full inheritance tree of this class and all its superclasses. the whole lineage. the entire family group chat. 🫢

superclasses

@superclasses = $class->superclasses

returns all the superclasses, as a list of unique Tangence::Meta::Class references. unique is the key word β€” nobody's showing up twice. ⭐

methods

$methods = $class->methods

returns all the methods available to this class as a HASH reference mapping names to Tangence::Meta::Method instances. everything you can call, all in one place. πŸ”₯

method

$method = $class->method( $name )

returns the named method as a Tangence::Meta::Method instance β€” or undef if no such method exists. so if it's not there, you get nothing, not an error. undef, bestie. 😭

events

$events = $class->events

returns all the events available to this class as a HASH reference mapping names to Tangence::Meta::Event instances. the full guest list. πŸŽ‰

event

$event = $class->event( $name )

returns the named event as a Tangence::Meta::Event instance, or undef if no such event exists. same deal as method. πŸ™ˆ

properties

$properties = $class->properties

returns all the properties available to this class as a HASH reference mapping names to Tangence::Meta::Property instances. every last one. πŸ’–

property

$property = $class->property( $name )

returns the named property as a Tangence::Meta::Property instance, or undef if no such property exists. if it's missing, it's missing, and you get undef to prove it. πŸ’€


πŸ‘‘ AUTHOR πŸ‘‘

this absolute legend wrote it:

Paul Evans <leonerd@leonerd.org.uk>


and that's the whole page bestie!! πŸ¦‹βœ¨ this one's from the User Contributed Perl Documentation, version perl v5.40.0, dated 2024-09-13 β€” so go forth, represent your classes, and remember: once it's defined, it's immutable, so make it count. mwah πŸ’…πŸ’–

πŸ“¦ where this page comes from