|
NAMEModule::Info::File - retrieve module information from a fileVERSIONThis POD describes version 1.00 of Module::Info::FileSYNOPSISuse Module::Info::File; my $module = Module::Info::File->new_from_file('path/to/Some/Module.pm'); $module->name(); $module->version(); $module->file(); $module->inc_dir(); DESCRIPTIONModule::Info (SEE REFERENCES), are lacking functionality of being able to extract certain data when parsing a module directly from a file. I have therefor created Module::Info::File, which inherits from Module::Info and replaces the new_from_file method so the lacking data can be accessed (dir and name attributes). Apart from that you can use all the neat accessors from Module::Info.Given the following structure in a file: package Foo; 1; package Bar; 1; Module::Info::File returns: Foo Given the following structure in a file: package Foo; $VERSION = '0.01'; 1; SUBROUTINES/METHODSnew_from_fileGiven a file, it will interpret this as the module you want information about. You can also hand it a perl script.After construction has been completed three attributes have been set in the object:
So by using the inherited methods from Module::Info you can access the attributes. In the script folder in this distribution is a small script called version.pl, which was the beginning of this module.
new_from_dataA helper method to streamline the result setIn general please refer to the documentation on Module::Info for more details. In list context the module returns and array of Module::Info::File objects, with which you can use the above accessors. The information in the objects might not be complete though (SEE: CAVEATS). In the t/ directory of this distribution there is a test (Info.t), it includes some tests. These tests will test your installation of Module::Info (required by Module::Info::File), if the tests fail, Module::Info::File will be obsolete and can be discontinued. SEE ALSO
BUGS AND LIMITATIONSThe module can somewhat handle several package definitions in one file, but the information is not complete yet, such as version information etc.The method currently only support the following version number lines: $VERSION = '0.01'; $VERSION = 0.01; INCOMPATIBILITIESEric D. Paterson scanned his complete CPAN installation and got and came across a few problems:
DIAGNOSTICS
CONFIGURATION AND ENVIRONMENTThere is a such no configuration necessary and Module::Info::File is expected to work on the same environments as perl itself.DEPENDENCIESThis module is a sub-class of Module::Info, so the following direct dependencies have to be met:
ACKNOWLEDGEMENTSIn no particular order
AUTHORjonasbn <jonasbn@cpan.org>LICENSE AND COPYRIGHTModule::Info::File and related modules are free software and is released under the Artistic License 2.0.Module::Info::File is (C) 2003-2017 Jonas B. Nielsen (jonasbn) <jonasbn@cpan.org>
Visit the GSP FreeBSD Man Page Interface. |