Class::ModuleByFile - Can read the module name from file
use Class::ModuleByFile; print Class::ModuleByFile::get_name('/tmp/Local/Bar.pm'); # may print 'Local::Bar' use Class::ModuleByFile 'get_module_by_file'; # imports the function get_module_by_file() # to use it directly.
You can use that class to get the module name (package) by filename. It reads the file and returns the package entry.
Exporter
FileHandle
5.006
get_module_by_file();
alias for get_name()
my $modulename = get_name($filename);
Returns the modulename for the given file. It reads the text of the file and returns the package entry
Andreas Hernitscheck ahernit(AT)cpan.org
You can redistribute it and/or modify it under the conditions of LGPL.
To install Class::ModuleByFile, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Class::ModuleByFile
CPAN shell
perl -MCPAN -e shell install Class::ModuleByFile
For more information on module installation, please visit the detailed CPAN module installation guide.