.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "Sub::Info 3pm" .TH Sub::Info 3pm "2018-12-07" "perl v5.24.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Sub::Info \- Tool for inspecting subroutines. .SH "DESCRIPTION" .IX Header "DESCRIPTION" Tool to inspect subroutines. .SH "EXPORTS" .IX Header "EXPORTS" All exports are optional, you must specify subs to import. .ie n .IP "my $hr = sub_info(\e&code)" 4 .el .IP "my \f(CW$hr\fR = sub_info(\e&code)" 4 .IX Item "my $hr = sub_info(&code)" .PD 0 .ie n .IP "my $hr = sub_info(\e&code, @line_numbers)" 4 .el .IP "my \f(CW$hr\fR = sub_info(\e&code, \f(CW@line_numbers\fR)" 4 .IX Item "my $hr = sub_info(&code, @line_numbers)" .PD This returns a hashref with information about the sub: .Sp .Vb 6 \& { \& ref => \e&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], \& }; .Ve .RS 4 .ie n .IP "$info\->{ref} => \e&code" 4 .el .IP "\f(CW$info\fR\->{ref} => \e&code" 4 .IX Item "$info->{ref} => &code" This is the original sub passed to \f(CW\*(C`sub_info()\*(C'\fR. .ie n .IP "$info\->{cobj} => $cobj" 4 .el .IP "\f(CW$info\fR\->{cobj} => \f(CW$cobj\fR" 4 .IX Item "$info->{cobj} => $cobj" This is the c\-object representation of the coderef. .ie n .IP "$info\->{name} => ""Some::Mod::code""" 4 .el .IP "\f(CW$info\fR\->{name} => ``Some::Mod::code''" 4 .IX Item "$info->{name} => Some::Mod::code" This is the name of the coderef. For anonymous coderefs this may end with \&\f(CW\*(Aq_\|_ANON_\|_\*(Aq\fR. Also note that the package 'main' is special, and 'main::' may be omitted. .ie n .IP "$info\->{file} => ""Some/Mod.pm""" 4 .el .IP "\f(CW$info\fR\->{file} => ``Some/Mod.pm''" 4 .IX Item "$info->{file} => Some/Mod.pm" The file in which the sub was defined. .ie n .IP "$info\->{package} => ""Some::Mod""" 4 .el .IP "\f(CW$info\fR\->{package} => ``Some::Mod''" 4 .IX Item "$info->{package} => Some::Mod" The package in which the sub was defined. .ie n .IP "$info\->{start_line} => 22" 4 .el .IP "\f(CW$info\fR\->{start_line} => 22" 4 .IX Item "$info->{start_line} => 22" .PD 0 .ie n .IP "$info\->{end_line} => 42" 4 .el .IP "\f(CW$info\fR\->{end_line} => 42" 4 .IX Item "$info->{end_line} => 42" .ie n .IP "$info\->{lines} => [22, 42]" 4 .el .IP "\f(CW$info\fR\->{lines} => [22, 42]" 4 .IX Item "$info->{lines} => [22, 42]" .PD These three fields are the \fIadjusted\fR start line, end line, and array with both. It is important to note that these lines have been adjusted and may not be accurate. .Sp 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. .ie n .IP "$info\->{all_lines} => [23, 25, ..., 39, 41]" 4 .el .IP "\f(CW$info\fR\->{all_lines} => [23, 25, ..., 39, 41]" 4 .IX Item "$info->{all_lines} => [23, 25, ..., 39, 41]" This is an array with the lines of every statement in the sub. Unlike the other line fields, these have not been adjusted for you. .RE .RS 4 .RE .SH "SOURCE" .IX Header "SOURCE" The source code repository for Sub-Info can be found at \&\fIhttp://github.com/exodist/Sub\-Info/\fR. .SH "MAINTAINERS" .IX Header "MAINTAINERS" .IP "Chad Granum " 4 .IX Item "Chad Granum " .SH "AUTHORS" .IX Header "AUTHORS" .PD 0 .IP "Chad Granum " 4 .IX Item "Chad Granum " .IP "Kent Fredric " 4 .IX Item "Kent Fredric " .PD .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright 2016 Chad Granum . .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .PP See \fIhttp://dev.perl.org/licenses/\fR