in reply to Where subroutine attributes will be used?

My advice is to avoid them in almost all circumstances. They make your code harder to read and since they are just strings and not parsed by perl they get really ugly when people try to jam anything that looks like code into them.
  • Comment on Re: Where subroutine attributes will be used?

Replies are listed 'Best First'.
Re^2: Where subroutine attributes will be used?
by tirwhan (Abbot) on Mar 11, 2009 at 12:32 UTC
    My advice is to avoid them in almost all circumstances.

    I was reading Ovid's article on Test::Class just now, and noticed that Test::Class does use subroutine attributes rather extensively.

    I'd appreciate if you could comment on that. Is Test::Class the exception in "almost"? Or do you and the author of Test::Class simply disagree on the usefulness of attributes?


    All dogma is stupid.
      I use Test::Class. The sub attributes it uses are relatively simple (nothing too perl), which is good because it makes them harder to screw up. However, I don't find them an improvement over a simple config data structure.