Author image Michael De La Rue

NAME

Module::MetaInfo::AutoGuess - Guess meta information from perl modules

USAGE

  use Module::MetaInfo::AutoGuess;
  $mod=new Module::MetaInfo::AutoGuess(perl-module-file.tar.gz);
  $desc=$mod->description();

DESCRIPTION

This module provides functions for guessing meta information from old perl modules which have no explicit meta information storage. The aim is to provide a transition mechnism through which meta information can be supported for the majority of perl modules without any extra work from the module maintainers.

FUNCTIONS

The meta information which should be generated can be worked out from the needs of packaging systems such as RPM (RedHat Package Manager: for RedHat Linux and related Linux distributions), DPKG (Debian Packager - for Debian GNU/Linux).

description

This function tries to get a description for the module. It does this by searching for files which might have description information then looking in each one in order (from the most likely to the least - heuristic guessing) until it finds something which seems to be a reasonable description.

The description returned should be treated as plain text. In the current version however, it may contain unconverted POD directives. In future these will probably be converted to text. Possibly some options should be given about the kind of text to be produced?

docs

This function returns an array (or reference to an array in a scalar context) which contains all of the files in the perl module which are thought to be documentation.

UNIMPLEMENTED FUNCTIONS

Currently there are no dependency related functions (requires / provides / suggests). The first two of these can be taken from programs included in RPM > 3.0.4 if they are needed. Please indicate that you need this to the author. There isn't a function to return a module summary. This would be a one line summary of the function. Probably best would be to take this from the CPAN modules.txt file.

description

This function finds and returns a description of the perl module.

In the current implementation we use a set of wierd heuristics to guess what is the best description available.

When creating an rpm, for example, it's a good idea to proceed the description with something to the effect of:

  this rpm contains the perl module XXX

where XXX is the name you are using for the perl module.

doc_files

We give a list of files or directories which it is good to treat as documentation and include within any binary distribution.

We like to include usage documentation, copyrights and release information. Probably we don't care too much about implementation documentation. Right now we just doo fairly simple file name guessing in the top level directory of the distribution.

doc_files returns a list of files to a list context and a reference to an array of files to a scalar context.

requires / provides

These functions would try to guess which perl modules are needed to run this one / which perl libraries this module provides.. They aren't implmeneted yet.

Currently we haven't distinguished pre-requisite modules needed to run the module from ones needed merely to install it.

There is code in perl.prov and perl.req in the lib directory of RPM (the RedHat Package Manager) which can determine this information, however, it requires the module to have been build correctly and installed in a temporary directory hierarchy.

FUTURE FUNCTIONS

There are a number of other things which should be implemented. These can be guessed from looking at the possible meta-information which can be stored in the RPM or DPG formats, for example. Examples include

  • copyright - GPL / as perl / redistributable / etc.

  • application area - Database / Internet / WWW / HTTP etc.

  • suggests - related applications

In many cases this data is generated currently by package building tools simply by using a fixed string. The function should do better than that in almost all cases or else it is't worth having...

FUTURE DEVELOPMENT

Incorporate a mechanism for deliberately storing meta information inside perl modules, e.g. by adding a directory structure inside. I already have a prototype for this included into makerpm.

COPYRIGHT

You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README.

AUTHOR

Michael De La Rue.

SEE ALSO

pm-metainfo