You make some variable potentially available by listing them in
@EXPORT_OK, but you never import then when using the module. Either make the variable available by default, using
@EXPORT instead of
@EXPORT_OK, or tell the import routine which variables you want, by listing them in the use statement.
And next time, don't post a gazillion lines - you could have written a short example with the same problem.