in reply to learning subroutine attributes

You might find Attribute::Handlers makes your life easier.