Sub::Attribute(3)

πŸ“¦
version 0.07 Β· 3 versions
, in epel 9

πŸ¦‹ Sub::Attribute β€” reliable subroutine attribute handlers πŸ¦‹

okay bestie, you're on the Sub::Attribute(3) page and it's literally all about making subroutine attribute handlers reliable. no cap. let's get into it πŸ’…


✨ NAME ✨

Sub::Attribute β€” reliable subroutine attribute handlers, periodt. πŸŽ€

🌸 VERSION 🌸

This document describes Sub::Attribute version 0.05. yes ma'am, 0.05. πŸ’–

🧚 SYNOPSIS 🧚

okay so here's the whole vibe in code, copied exactly because we do not mess with code in this house:

        package Attribute::Foo;
        use Sub::Attribute;

        sub Foo :ATTR_SUB{
                my($class, $sym_ref, $code_ref, $attr_name, $attr_data) = @_;

                # ...
        }

        # and later
        package main;
        use parent qw(Attribute::Foo);

        sub something :Foo(xyzzy){
                # ...
        }
        # apply: __PACKAGE__->Foo(\*something, \&something, 'Foo', 'xyzzy')

πŸ’« DESCRIPTION πŸ’«

Sub::Attribute is a role to define attribute handlers for specific subroutine attributes. that's the whole assignment. 🫢

The feature of this module is similar to that of Attribute::Handlers, but it has less functionality and more reliability. That is, while Attribute::Handlers provides many options for ATTR(CODE), Sub::Attribute provides no options for ATTR_SUB. However, the attribute handlers defined by Sub::Attribute are always called with informative arguments. Attribute::Handlers's ATTR(CODE) is not called in run-time eval(), so ATTR(CODE) is not reliable. πŸ’€

🌈 INTERFACE 🌈

πŸͺ„ The ATTR_SUB meta attribute πŸͺ„

  • ATTR_SUB β€” defines a method as a subroutine attribute handler. it's giving "you're the handler now" πŸ’…

βš™οΈ CONFIGURATION AND ENVIRONMENT βš™οΈ

πŸ› The $ENV{SUB_ATTRIBUTE_DEBUG} check πŸ›

If true, it reports how attributes are applied, using the warn() function. so if you turn this on, you get the tea about attribute application via warn(). πŸ“

🧸 DEPENDENCIES 🧸

Perl 5.8.1 or later, and a C compiler. that's the whole list, bestie. πŸŽ€

πŸ’€ BUGS πŸ’€

No bugs have been reported. iconic behavior, honestly. ✨

Please report any bugs or feature requests to the author. they want the feedback, fr fr. 🫢

πŸ‘€ SEE ALSO πŸ‘€

  • attributes.
  • "Subroutine Attributes" in perlsub.
  • Attribute::Handlers.

πŸ‘‘ AUTHOR πŸ‘‘

Goro Fuji (gfx) <gfuji(at)cpan.org>. the author, the main character. πŸ’–

Copyright (c) 2009-20010, Goro Fuji (gfx). Some rights reserved. yep, that's the exact copyright line β€” keep it cute and keep it accurate. πŸ’…

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. slay, free software rights. 🌈


xoxo, your fave manual page πŸ’– β€” perl v5.32.1, 2025-01-18, Sub::Attribute(3).

πŸ“¦ where this page comes from