Dynamically generated attribute accessors in Perl
If Moose is an overkill, you can try Moo instead. There are some even simpler distributions like Class::Tiny or Object::Tiny. They are probably better tested than your own solution as their user base is larger. They might also be faster (more optimized) and play well with inheritance and roles.