Firstly you will need to have all of that in a BEGIN block in order for @EXPORT_OK to have the values in it when import is called by the use gen_var.
Also I would eschew the second eval and simply do something likeL
BEGIN
{
foreach my $variable (@variables) {
eval "our \$$variable = $counter; push \@exported_symbols, \
+$$variable";
$counter++;
push @EXPORT_OK, "\$$variable";
}
}
I do something similar in
Sys::Utmp for what it's worth. Actually it's worse because there I export the symbols into one module that then exports them to the callers namespace :-O
/J\