ur test callcount - collect callcount data from running tests into one file
# run tests in a given namespace cd my_sandbox/TheApp ur test run --recurse --callcount ur test callcount --output all_tests.callcount
Callcount data can be used to find unused subroutines in your code. When the test suite is run with the callcount option, then for each *.t file run by the test suite, a corresponding *.callcount file is created containing information about how often all the defined subroutines were called.
callcount
The callcount file is a plain text file with three columns:
The number of times this subroutine was called
The name of the subroutine
Where in the code this subroutine is defined
After a test suite run with sufficient coverage, subroutines with 0 calls are candidates for removal, and subs with high call counts are candidates for optimization.
Name the *.callcount input file(s). When run from the command line, it accepts a list of files separated by ','s. Input files can also be given as plain, unnamed command line arguments (bare_args). When run as a command module within another program, the input) property can be an arrayref of pathanmes.
bare_args
input
After inputs are determined, any directories given are expanded by searching them recursively for files ending in .callcount with File::Find.
If no inputs in any form are given, then it defaults to '.', the current directory, which means all *.callcount files under the current directory are used.
The pathname to write the collected data to. The user may use '-' to print the results to STDOUT.
How the collected results should be sorted before being reported. The default is 'count', which sorts incrementally by call count (the first column). 'sub' performs a string sort by subroutine name (column 2).
The execute() method returns an arrayref of data sorted in the appropriate way. Each element is itself an arrayref of three items: count, sub name, and sub location.
execute()
To install UR, copy and paste the appropriate command in to your terminal.
cpanm
cpanm UR
CPAN shell
perl -MCPAN -e shell install UR
For more information on module installation, please visit the detailed CPAN module installation guide.