You can use Module::Extract::Namespaces under the same terms as Perl itself.