UR::Na...llcount(3pm)
π NAME π
bestie, you've landed on UR::Na...llcount(3pm) and honestly? it's giving utility excellence. it's the page for ur test callcount β the command that collects callcount data from your running tests and dumps it all into one single file. one file. no chaos. we love that for us π
πΈ SYNOPSIS πΈ
okay so here's the vibe, literally just type this:
# run tests in a given namespace
cd my_sandbox/TheApp
ur test run --recurse --callcount
ur test callcount --output all_tests.callcount
like, run the tests with --callcount on, then gather everything up. that's it. that's the whole ritual β¨
π¦ DESCRIPTION π¦
so WHY do you care about callcount data? to find unused subroutines in your code, bestie. dead code? exposed. π΅οΈββοΈ
here's the deal: when the test suite is run with the "callcount" option, then for each *.t file run by the test suite, a corresponding *.callcount file gets created, and it contains info about how often all the defined subroutines were called. every single one.
the callcount file is a plain text file, and it's got three columns:
- the number of times this subroutine was called
- the name of the subroutine
- where in the code this subroutine is defined
so after you've run the test suite with sufficient coverage, the math is basically:
- subroutines with
0calls β candidates for removal (bye girl π) - subs with high call counts β candidates for optimization (get her a glow-up π )
periodt. that's the whole strategy.
β¨ OPTIONS β¨
--inputβ names the*.callcountinput file(s). when you're running from the command line, it accepts a list of files separated by','s (commas, bestie). input files can also be handed over as plain, unnamed command line arguments (bare_args). when it's run as a command module inside another program, theinputproperty can be an arrayref of pathanmes. once the inputs are figured out, any directories you gave get expanded by searching them recursively for files ending in.callcountwithFile::Find. and if no inputs in any form are given at all? it defaults to'.', the current directory, which means all*.callcountfiles under the current directory are used. cozy. π--outputβ the pathname to write the collected data to. and ooh, cute trick: you can use'-'to print the results toSTDOUT. terminal printer go brrr π¨οΈ--sortβ how the collected results should be sorted before being reported. the default is'count', which sorts incrementally by call count (that's the first column).'sub'instead performs a string sort by subroutine name (column 2). pick your fighter βοΈ
π execute() π
the execute() method returns an arrayref of data sorted in the appropriate way (aka whatever your --sort said). each element of that arrayref is itself an arrayref of three items: count, sub name, and sub location. three lil items, one tidy package. π
ngl bestie, this one's genuinely iconic β zero-call subs are just sitting there taking up space and this page hands you the receipts. no cap. πβ¨
and that's the whole page, fr fr β it's from the User Contributed Perl Documentation, perl v5.32.1, dated 2022-01-17, and the page itself is UR::Na...llcount(3pm). go forth and count some calls, queen π«ΆπΈπ¦
π¦ where this page comes from
- debian bookworm: libur-perl 0.470+ds-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libur-perl 0.470+ds-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libur-perl 0.470+ds-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms