my $formType = "HR-Recruitment"; # hard coded
my $lastVerion = "hr_re_v12"; # hard coded
eval "use parent 'somepack::$formType::$lastVersion';";
If values are hardcoded, then why not just:
use parent 'somepack::HR-Recruitment::hr_re_v12';
Answering your question, I would probably wrote a function to generate a package from the name and data unique to this package, and then just generate all the packages. Details depend on your particular case. Have a look onto Class::MOP::Class
, and Moose::Meta::Class
, though you can do it without Moose too.