I present my module Module::Underscore. It allow you to do that :
underscore_to_module('test_app') => Test::App
underscore_to_module('test_') => Test::
underscore_to_module('Hello World!') => Hello::World::
module_to_underscore('Test::App') => test_app
module_to_underscore('Test::App::') => test_app_
module_to_underscore('Hello World!') => hello_world_
I use it for config file for example :
routes: test_app: / test_app_auth: /auth
More simple that write this :
routes: Test::App: / Test::App::auth: /auth