Devel::...ileInfo(3)

πŸ“¦
version 6.14 Β· 3 versions
, in fedora 43

πŸ’– NAME πŸ’–

Devel::NYTProf::FileInfo β€” bestie, this is the one, straight out of the User Contributed Perl Documentation manual. Say hi to the module, she's iconic. πŸŽ€


✨ METHODS ✨

🌸 sub_call_lines 🌸

$hash = $fi->sub_call_lines;

Okay so this hands you back a reference to a hash stuffed with info about subroutine calls made at individual lines inside the source file. And if there's no subroutine calling info to be found? It gives you undef. No data, no drama. πŸ’€

The keys of that returned hash are line numbers. The values are references to hashes that use fully qualified subroutine names as their keys. And each of those hash values is a reference to an array holding two things:

  • an integer call count β€” like, how many times the sub was called from that line of that file
  • an inclusive time β€” how much time was spent inside the sub when it was called from that line of that file

Let's make it real. Say this was line 42 of a file called foo.pl:

++$wiggle if foo(24) == bar(42);

That line got executed once, and foo and bar were imported from pkg1. Then sub_call_lines() would return something like:

{
    42 => {
      'pkg1::foo' => [ 1, 0.02093 ],
      'pkg1::bar' => [ 1, 0.00154 ],
    },
}

See how it all lines up? 42 β†’ the line. pkg1::foo β†’ [ count, time ]. Chef's kiss. πŸ‘‘


πŸ¦‹ evals_by_line πŸ¦‹

# { line => { fid_of_eval_at_line => $fi, ... }, ... }
$hash = $fi->evals_by_line;

This one returns a reference to a hash carrying info about string evals executed at individual lines within a source file. String evals, bestie. They're out here living on their own lines. 😭

The keys of the returned hash are line numbers. The values are references to hashes where the keys are file id integers and the values are FileInfo objects.

And that's the whole page. Two methods, zero fluff, all facts intact. πŸ’…


perl v5.42.0 Β· 2025-07-25 β€” mwah, that's a wrap on this User Contributed Perl Documentation moment. Go forth and profile, bestie. 🫢✨🌸

πŸ“¦ where this page comes from