The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Sepia::Xref - Generates cross reference database for use by Perl programs.

SYNOPSIS

    use Sepia::Xref qw(rebuild defs callers);

    rebuild;
    for (defs 'foo') {
        printf "%s:%d: sub %s\::foo() defined\n", @{$_}[0..2];
    }

    for (callers 'foo') {
        printf "%s:%d: sub foo() called by %s\::%s().\n", @{$_}[0..3];
    }

DESCRIPTION

Sepia::Xref is intended as a programmatic interface to the information supplied by B::Xref. It is intended to be a component for interactive Perl development, with other packages providing a friendly interface to the raw information it extracts. B::Xref could be seen as an example of this sort of user-level tool, if it weren't for the fact that this module was created later, and stole most of its code.

Variables

%call

A map of subs to call locations and callers

%callby

A map of subs to subs called.

%var_use

A map of global/package variables to uses.

%var_def

A map of global/package variables to definitions (usually empty, since it only picks up local (...) declarations.

guess_module_file($pack, $ofile)

XXX: it turns out that rooting around trying to figure out the file ourselves is more reliable than what we grab from the op. Are we doing this wrong?

Functions

rebuild()

Rebuild the Xref database.

forget($func [, $mod])

Forget that $func was defined.

redefined($func [, $pack])

Recompute xref info for $func, or $pack::$func if $pack given.

callers($func)

List callers of $func.

callees($func)

List callees of $func.

var_defs($var)

Find locations where $var is defined.

var_uses($var)

Find locations where $var is used.

var_assigns($var)

Find locations where $var is assigned to.

mod_files($mod)

Find file for module $mod.

file_modules($file)

List the modules defined in file $file.

var_apropos($expr)

Find variables matching $expr.

EXPORTS

Nothing by default, but all sub and variable described above can be imported. Sepia::Xref also defines the tags :most for the above-listed functions, and :all for those and the variables as well.

BUGS

See B::Xref. Also, we currently ignore module names when looking up a sub by name. Finally, there is some evil in the way we guess file and line numbers, both of which should be done more cleanly and effectively.

SEE ALSO

B::Xref, from which Sepia::Xref is heavily derivative.

AUTHOR

B::Xref by Malcolm Beattie, m(angl|odifi)ed by Sean O'Rourke (seano@cpan.org).

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 119:

'=item' outside of any '=over'

Around line 484:

You forgot a '=back' before '=head2'