![]() |
![]()
| ![]() |
![]()
NAMEModule::Dependency::Info - retrieve dependency information for scripts and modules SYNOPSISuse Module::Dependency::Info; Module::Dependency::Info::setIndex( '/var/tmp/dependence/unified.dat' ); # load the index (actually it's loaded automatically if needed so this is optional) Module::Dependency::Info::retrieveIndex(); # or $refToEntireDatabase = Module::Dependency::Info::retrieveIndex(); $listref = Module::Dependency::Info::allItems(); $listref = Module::Dependency::Info::allScripts(); # note the syntax here - the path of perl scripts, but the package name of modules. $dependencyInfo = Module::Dependency::Info::getItem( 'Foo::Bar' [, $forceReload ] ); # and $dependencyInfo = Module::Dependency::Info::getItem( './blahblah.pl' [, $forceReload ] ); $filename = Module::Dependency::Info::getFilename( 'Foo::Bar' [, $forceReload ] ); $listref = Module::Dependency::Info::getChildren( $node [, $forceReload ] ); $listref = Module::Dependency::Info::getParents( $node [, $forceReload ] ); $value = Module::Dependency::Info::relationship( 'Foo::Bar', 'strict' ); Module::Dependency::Info::dropIndex(); DESCRIPTIONThis module is used to access the data structures created by Module::Dependency::Indexer OR a third-party application that creates databases of the correct format. Although you can get at the database structure itself you should use the accessor methods. METHODS
DATA RECORDSThe database contains a list of all scripts (.pl and .plx files) encountered. We treat these as special because they form the 'top' of the dependency tree - they 'use' things, but they are not 'use'd themselves. It's just an array of all their nodenames (the filename, excluding the path to the file, e.g. 'foo.pl'). The main bit is a hash. The keys of the hash are one of two things: a) keys to module records are the name of the package, e.g. 'Foo::Bar'; b) keys to script records are the nodename of the file, e.g. 'foo.pl'. A data records looks like the right-hand half of these: # lots of Data::Dumper output snipped 'IFL::Beasts::Evol::RendererUtils' => { 'filename' => '/home/system/cgi-bin/lib/IFL/Beasts/Evol/RendererUtils.pm', 'package' => 'IFL::Beasts::Evol::RendererUtils', 'depended_upon_by' => [ 'IFL::Beasts::Evol::TextSkin', 'IFL::Beasts::Evol::HTMLSkin' ], 'depends_on' => [ 'lib', 'Exporter', 'Carp', 'IFL::Beasts::Evol::LanguageUtils', 'IFL::Beasts::Evol::MathUtils', 'EDUtemplate' ] }, # lots of Data::Dumper output snipped Or like this, for a script file: # lots of Data::Dumper output snipped 'csv_validator.pl' => { 'filename' => '/home/system/cgi-bin/education/user_reg/csv_validator.pl', 'package' => 'csv_validator.pl', 'depends_on' => [ 'CGI', 'EDUprofile', 'LWP::Simple', 'File::Find' ] }, # lots of Data::Dumper output snipped But of course you should use the accessor methods to get at the information. DEBUGGINGThere is a TRACE stub function, and the module uses TRACE() to log activity. Override our TRACE with your own routine, e.g. one that prints to STDERR, to see these messages. SEE ALSOModule::Dependency and the README files. VERSION$Id: Info.pm 6643 2006-07-12 20:23:31Z timbo $
|