Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^2: How Are Attributes Useful?

by Limbic~Region (Chancellor)
on Jan 18, 2005 at 19:58 UTC ( [id://423235]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: How Are Attributes Useful?
in thread How Are Attributes Useful?

Zaxo,
Reflect that that attribute is more than a tag that you may query at runtime like some kind of metadata. I'm not sure how I'd go about querying that.

Really. I haven't found a single example of how one might modify the behavior of a subroutine using attributes outside the few built-ins. As far as querying the attributes - it was in the synopsis of perldoc attributes

use attributes (); # optional, to get subroutine declarations my @attrlist = attributes::get(\&foo);
I have looked at Attribute::Handlers and still felt unsatisfied. Attribute::Handlers::Prospective looks promising after glancing at the documentation but I find it hard to believe that there are no code examples outside the module. Why is this I wonder. It seems to me that you are right - the majority of us are in the dark and so attributes, if useful at all as others have implied, are way underdeveloped in perl.

Cheers - L~R

Replies are listed 'Best First'.
Re^3: How Are Attributes Useful?
by redlemon (Hermit) on Jan 19, 2005 at 17:27 UTC

    Check Bot-CPAN. It's Glue module uses Attribute::Handlers to define well.. attributes to methods. That lets you define a bot command like:

    sub list :help ("lists available modules") :private :adminCmd { # implements list() }

    I thought that was a rather elegant way of doing this.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://423235]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.