Tangerine - Examine perl files and report dependency metadata
use Tangerine; use version 0.77; my $scanner = Tangerine->new(file => $file, mode => 'all'); $scanner->run; print "$file contains the following modules: ". join q/, /, sort keys %{$scanner->package}."\n"; print "$file requires Exporter, at runtime, on the following lines: ". join q/, /, sort map $_->line, @{$scanner->runtime->{Exporter}}."\n"; my $v = 0; for (@{$scanner->compile->{'Test::More'}}) { $v = $_->version if $_->version && qv($v) < qv($_->version) } print "The minimum version of Test::More required by $file is $v.\n";
Tangerine examines perl files and reports dependency metadata -- provided modules, and both compile-time and run-time dependencies, along with line numbers, versions and possibly other related information.
Currently, PPI is used for the initial parsing and statement extraction.
new
Creates the Tangerine object. Takes the following two named arguments:
'file', the file to examine 'mode', determines what to look for; may be one of 'all', 'package', 'compile', or 'runtime'.
Both arguments are optional, however, 'file' needs to be set before running the scanner, e.g.
my $scanner = Tangerine->new; $scanner->file($file); $scanner->run;
run
Runs the analysis.
package
Returns a hash reference. Keys are the modules provided, values references to lists of Tangerine::Occurence objects.
compile
Returns a hash reference. Keys are the modules required at compile-time, values references to lists of Tangerine::Occurence objects.
runtime
Returns a hash reference. Keys are the modules required at run-time, values references to lists of Tangerine::Occurence objects.
provides
requires
uses
Deprecated. These are provided for backwards compatibility only.
Tangerine::Occurence
https://github.com/contyk/tangerine.pm
Petr Šabata <contyk@redhat.com>
Copyright (c) 2014-2016 Petr Šabata
See LICENSE for licensing details.
To install Tangerine, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tangerine
CPAN shell
perl -MCPAN -e shell install Tangerine
For more information on module installation, please visit the detailed CPAN module installation guide.