{"id":20550250,"url":"https://github.com/dnmfarrell/sub-attributes","last_synced_at":"2026-04-20T00:02:17.180Z","repository":{"id":56831402,"uuid":"61589549","full_name":"dnmfarrell/Sub-Attributes","owner":"dnmfarrell","description":"Meta programming with subroutine attributes","archived":false,"fork":false,"pushed_at":"2016-06-30T03:25:50.000Z","size":12,"stargazers_count":1,"open_issues_count":4,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-16T16:49:27.349Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://metacpan.org/pod/Sub::Attributes","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dnmfarrell.png","metadata":{"files":{"readme":"README.pod","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-21T00:23:12.000Z","updated_at":"2017-01-27T04:48:54.000Z","dependencies_parsed_at":"2022-09-09T18:01:30.984Z","dependency_job_id":null,"html_url":"https://github.com/dnmfarrell/Sub-Attributes","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnmfarrell%2FSub-Attributes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnmfarrell%2FSub-Attributes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnmfarrell%2FSub-Attributes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnmfarrell%2FSub-Attributes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dnmfarrell","download_url":"https://codeload.github.com/dnmfarrell/Sub-Attributes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242157180,"owners_count":20081036,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T02:24:07.814Z","updated_at":"2026-04-20T00:02:12.160Z","avatar_url":"https://github.com/dnmfarrell.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"=head1 NAME\n\nSub::Attributes - meta programming with subroutine attributes\n\n=head1 SYNOPSIS\n\n  package Point;\n  use base 'Sub::Attributes';\n\n  # croak if not called as a class method\n  sub new :ClassMethod {\n    ...\n  }\n\n  # croak if not called as object method\n  sub add : Method {\n    ...\n  }\n\n  # private subroutine, will croak unless called from within Point package\n  sub _internal_logic : Private Method {\n    ...\n  }\n\n  # Typical method modifiers ala LISP \u0026 Class::Method::Modifiers\n  # before, after \u0026 around all occur at compile time\n  sub check_state : Before(add) {\n    ...\n  }\n\n  sub doubleme : After(add) {\n    ...\n  }\n  # orig is a coderef to add, it needs to be given $self becase it's an object\n  # method\n  sub filter_calls : Around(add) {\n    my ($orig, $self, @args) = @_;\n    my $result = $orig-\u003e($self, @args);\n    ...\n  }\n\n  package main;\n  my $p = Point-\u003enew(3,8);\n  $p-\u003esub_attributes(); # { add =\u003e ['Method'], _internal_logic =\u003e ['Private','Method'], ... }\n\n=head1 METHODS\n\n=head2 sub_attributes\n\nReturns a hashref of subroutine names and their attributes.\n\n=head1 SEE ALSO\n\n=over 4\n\n=item * L\u003cClass::Method::Modifiers|https://metacpan.org/pod/Class::Method::Modifiers\u003e\n\n=item * L\u003cMooseX::MethodAttributes|https://metacpan.org/pod/MooseX::MethodAttributes\u003e\n\n=back\n\n=head1 AUTHOR\n\nE\u003ccopy\u003e 2016 David Farrell\n\n=head1 LICENSE\n\nSee LICENSE\n\n=head1 REPOSITORY\n\nL\u003chttps://github.com/dnmfarrell/Sub-Attributes\u003e\n\n=head2 BUGTRACKER\n\nL\u003chttps://github.com/dnmfarrell/Sub-Attributes/issues\u003e\n\n\n=cut\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdnmfarrell%2Fsub-attributes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdnmfarrell%2Fsub-attributes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdnmfarrell%2Fsub-attributes/lists"}