Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^6: Runtime introspection: What good is it?

by lodin (Hermit)
on Jul 08, 2008 at 19:35 UTC ( #696303=note: print w/replies, xml ) Need Help??


in reply to Re^5: Runtime introspection: What good is it?
in thread Runtime introspection: What good is it?

For your own code you can use attributes (experimental feature) to signal what's a method and what's not.

sub foo :method { my $self = shift; # ... return; } sub bar { # ... return; } use attributes; sub is_a_method { scalar grep $_ eq 'method', attributes::get($_[0]); } for ([ foo => \&foo ], [ bar => \&bar ]) { print "$_->[0] is a " . (is_a_method($_->[1]) ? 'method' : 'function +') . "\n"; } __END__ foo is a method bar is a function

lodin

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://696303]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2022-01-25 00:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (65 votes). Check out past polls.

    Notices?