Specio::DeclaredAt(3)

πŸŽ€ NAME πŸŽ€

Okay bestie, this is the Specio::DeclaredAt(3) page from User Contributed Perl Documentation, and the whole thing is about Specio::DeclaredAt β€” a class to represent where a type or coercion was declared. Literally its whole job. πŸ’…


🌈 VERSION 🌈

Version 0.49, no cap. ✨


✨ SYNOPSIS ✨

my $declared = Specio::DeclaredAt->new_from_caller(1);

print $declared->description;

This is the entire flex: build one from caller depth 1, then print its description. Obsessed. 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

This class is a thin wrapper around some of the return values from Perl's caller built-in. It's used internally to identify where types and coercions are being declared, which is super useful when generating error messages. Like, it's giving "who declared this type and where" energy, and that's iconic for error messages. πŸ”₯


πŸŽ€ API πŸŽ€

This class provides the following methods, bestie:

  • Specio::DeclaredAt->new_from_caller($depth) β€” given a call stack depth, this method returns a new Specio::DeclaredAt object. Slay. ✨
  • $declared_at->package, $declared_at->filename, $declared_at->line β€” these return the call stack information recorded when the object was created. These values are always populated, periodt. πŸ’–
  • $declared_at->subroutine β€” returns the subroutine from the call stack. This may be an "udnef". πŸ™ˆ
  • $declared_at->has_subroutine β€” returns true if there is a subroutine name associated with this object. βœ…
  • $declared_at->description β€” puts all the information together into a single string like declared in package Foo::Bar (.../Foo/Bar.pm) at line 42 in sub named blah. Cute, concise, iconic. 🌸

πŸ’– SUPPORT πŸ’–

Bugs may be submitted at https://github.com/houseabsolute/Specio/issues. If something's cursed, that's the spot. 🫢


🌸 SOURCE 🌸

The source code repository for Specio can be found at https://github.com/houseabsolute/Specio. Go browse, bestie. πŸ’»


πŸ‘‘ AUTHOR πŸ‘‘

Dave Rolsky <autarch@urth.org> β€” icon, legend, author. πŸ‘‘


This software is Copyright (c) 2012 - 2024 by Dave Rolsky.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)

The full text of the license can be found in the LICENSE file included with this distribution. Read it, bestie β€” it's giving legal realness. πŸ“œβœ¨


πŸ’« cute sign-off: source/version is perl v5.42.0, dated 2024-12-24, and it's the manual for Specio::DeclaredAt(3). Byeee, go declare your types responsibly! πŸ«ΆπŸŽ€

πŸ“¦ where this page comes from