Test2::Util::Sub(3) | Perl Programmers Reference Guide | Test2::Util::Sub(3) |
Test2::Util::Sub - Tools for inspecting and manipulating subs.
Utilities used by Test2::Tools to inspect and manipulate subroutines.
All exports are optional, you must specify subs to import.
{ ref => \&code, cobj => $cobj, name => "Some::Mod::code", file => "Some/Mod.pm", package => "Some::Mod", # Note: These have been adjusted based on guesswork. start_line => 22, end_line => 42, lines => [22, 42], # Not a bug, these lines are different! all_lines => [23, 25, ..., 39, 41], };
The lines are obtained by walking the ops. As such, the first line is the line of the first statement, and the last line is the line of the last statement. This means that in multi-line subs the lines are usually off by 1. The lines in these keys will be adjusted for you if it detects a multi-line sub.
The source code repository for Test2-Suite can be found at https://github.com/Test-More/Test2-Suite/.
Copyright 2018 Chad Granum <exodist@cpan.org>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://dev.perl.org/licenses/
2024-04-28 | perl v5.40.0 |