The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Class::ModuleByFile - Can read the module name from file

SYNOPSIS

 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.

DESCRIPTION

You can use that class to get the module name (package) by filename. It reads the file and returns the package entry.

REQUIRES

Exporter

FileHandle

5.006

METHODS

get_module_by_file

 get_module_by_file();

alias for get_name()

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

AUTHOR

Andreas Hernitscheck ahernit(AT)cpan.org

LICENSE

You can redistribute it and/or modify it under the conditions of LGPL.