Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: How Are Attributes Useful?

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


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 22: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
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-03-29 05:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found