in reply to Sub attributes

John M. Dlugosz,
I posted How Are Attributes Useful? a long time ago. I wasn't the only one who felt a little underwhelmed by how useful user defined attributes were. I just want to point out that it is not clear in your question if you are asking about perl 5's sub attributes or Catalyst's use of them. If the latter, I would suggest #catalyst on irc.perl.org.

Cheers - L~R

Replies are listed 'Best First'.
Re^2: Sub attributes
by John M. Dlugosz (Monsignor) on Jun 09, 2009 at 18:10 UTC
    I mean specifically the Perl 5 feature. The docs say it is an error to use one that is not recognized. So how do strings you want to use as attributes become "recognized"? If you can just use anything (warning if all lower case), the doc is wrong.
      John M. Dlugosz,
      I will quote the section germane to the conversation:

      An attempt to set an unrecognized attribute is a fatal error. (The error is trappable, but it still stops the compilation within that eval.) Setting an attribute with a name that's all lowercase letters that's not a built-in attribute (such as "foo") will result in a warning with -w ...

      I agree that the docs could use some explanation (echo'd by others in the thread I pointed to). On that front I can't offer you any insight other than to say that if you ignore the attributes pragma and use one of the modules, it does just seem to work. The only module I found useful (run arbitrary code at different phases) though (Attribute::Handlers::Prospective) used source filters.

      Cheers - L~R

        Isn't ...::Prospective just an early draft of Attribute::Handlers? It looks like he called it Prospective during public testing.