++ed by:

1 PAUSE user

Tim Bunce


pmd_dump.pl - Query and print Module::Dependency info


    pmd_dump.pl [options] object-patterns

object-patterns can be:

    f=S    - Select objects where field f equals string S
    f!=S   - Select objects where field f does not equal S
    f=~R   - Select objects where field f matches regex R
    f!~R   - Select objects where field f does not match R
    S$     - Same as filename=~S$ to match by file suffix
    S      - Same as key=S (i.e. package or filename)

For example:

    package=Foo::Bar         - that specific package
    package=~^Foo::          - all packages that start with Foo::
    filename=~sub/dir/path   - everything with that path in the filename
    filename=~'\.pm$'        - all modules
    restart.pl$              - all files with names ending in restart.pl
    foo                      - same as key=foo

Fields available are:

    filename         - "dir/subdir/foo.pl"
    package          - "strict"
    key              - same as package for packages, or filename for other files
    filerootdir      - "/abs/path"
    depends_on       - "Carp strict Foo::Bar"
    depended_upon_by - "Other::Module dir/subdir/foo.pl dir2/bar.pl Another:Module"

Selected objects can be augmented using:

    -P=N   Also pre-select N levels of parent objects
    -C=N   Also pre-select N levels of child objects

Then filtered:

    -F=P   Filter OUT objects matching the object-pattern P
    -S=P   Only SELECT objects matching the object-pattern P

Then merged:

    -M     Merge data for selected objects into a single pseudo-object.
           Removes internally resolved dependencies.
           Handy to see all external dependencies of a group of files.
           The -P and -C flags are typically only useful with -M.

Then modified:

    -D     Delete dependencies on modules which weren't indexed but can
           be found in @INC

Then dumped:

    -f=f1,f2,... - only dump these fields (otherwise all)

And for each one dumped:

    -p=N   Recurse to show N levels of indented parent objects first
    -c=N   Recurse to show N levels of indented child objects after
    -i=S   Use S as the indent string (default is a tab)
    -u     Unique - only show a child or parent once for a given item
    -U     Unique - only show a child or parent once in complete output
    -k     Don't show key in header, just the fieldname
    -h     Don't show header (like grep -h), used with -f=fieldname
    -s     sort by name
    -r=P   Show the relationship between the item and those matching P

Other options:

    -A     Dump all the data using Data::Dumper
    -help  Displays this help
    -t     Displays tracing messages
    -o=F   the location of the datafile
    -r     State the relationship, if any, between item1 and item2 - both may be scripts or modules.


    pmd_dump.pl -o ./unified.dat Module::Dependency::Info

Select and merge everything in the database (which removes internally resolved dependencies) and list the names of all unresolved packages:

    pmd_dump.pl -f=depends_on -h -M ''

Do the same but feed the results back into pmd_dump.pl to get details of what depends on those unresolved items:

    pmd_dump.pl -f=depended_upon_by `pmd_dump.pl -f=depends_on -h -M ''` | less -S


Module::Dependency modules rely on a database of dependencies. This tool allows you to query the index, verify that it contains what it should contain, look up module dependencies, etc.

The default location for the index file is $ENV{PERL_PMD_DB} or else /var/tmp/dependence/unified.dat but you can select another file using the -o option.


$Id: pmd_dump.pl 6570 2006-06-27 15:01:04Z timbo $