Tangerine - Analyse perl files and report module-related information
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->provides}."\n"; print "$file requires Exporter on the following lines: ". join q/, /, sort map $_->line, @{$scanner->requires->{Exporter}}."\n"; my $v = 0; for ( @{$scanner->uses->{Test::More}}) { $v = $_->version if $_->version && qv($v) < qv($_->version) } print "The minimum version of Test::More required by $file is $v\n";
Tangerine statically analyses perl files and reports various information about provided, used (compile-time dependencies) and required (runtime dependencies) modules.
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 analyse 'mode', what should we look for; may be one of 'all', 'prov', 'dep', 'req' or 'use'. 'dep' implies both 'req' and 'use'. Single letter abbreviations are also accepted.
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.
provides
Returns a hash reference. Keys are the modules provided, values references to lists of Tangerine::Occurence objects.
requires
Returns a hash reference. Keys are the modules required at run-time, values references to lists of Tangerine::Occurence objects.
uses
Returns a hash reference. Keys are the modules required at compile-time, values references to lists of Tangerine::Occurence objects.
Tangerine::Occurence
Petr Šabata <contyk@redhat.com>
Copyright (c) 2014 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.