Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I expect MyClass->xmlrpc_methods() to return foo, but it returns an empty list. Ideas? Thank you.package Dispatcher; use strict; use warnings; use Attribute::Handlers; sub xmlrpc_methods { my @methods = (); my $package = shift; { no strict 'refs'; for my $key ( %{$package.'::'} ) { next unless my $code = *{$package.'::'.$key}{CODE}; push @methods, $key if grep { $_ eq 'xmlrpc' } attributes::get($code); } } return @methods; } 1; sub xmlrpc :ATTR(CODE) {} package MyClass; use base qw(Dispatcher); sub foo : xmlrpc { } 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Trying to figure out subroutine attributes
by friedo (Prior) on Dec 08, 2006 at 21:59 UTC | |
by Anonymous Monk on Dec 08, 2006 at 22:12 UTC | |
by pemungkah (Priest) on Dec 09, 2006 at 01:36 UTC | |
by Anonymous Monk on Dec 11, 2006 at 15:37 UTC | |
by pemungkah (Priest) on Dec 11, 2006 at 19:54 UTC |