You can't declare subs (or variables) using attributes that have not been "defined" yet. To define your own attributes, you can use a module like Attribute::Handlers. For each attribute, you specify a handler that gets called whenever a sub (or variable) is defined using that attribute.