.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" 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 .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "PPIx::DocumentName::Result 3pm" .TH PPIx::DocumentName::Result 3pm "2021-09-30" "perl v5.32.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" PPIx::DocumentName::Result \- Full result set for PPIx::DocumentName .SH "VERSION" .IX Header "VERSION" version 1.01 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use PPIx::DocumentName 1.00 \-api => 1; \& my $result = PPIx::DocumentName\->extract( $ppi_document ); \& \& # say the "name" of the document \& say $result\->name; \& \& # the result object can also be stringified into the name found: \& say "$result"; \& \& # get the full PPI::Document object for the entire document \& my $ppi = $result\->document; \& \& # get the node where we found the name \& # (usually a PPI::Statement::Package or PPI::Token::Comment) \& my $node = $result\->node; \& \& # get the location where we found the name \& my $location = $result\->node\->location; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This class represents the results from PPIx::DocumentName when running under its new \f(CW\*(C`\-api => 1\*(C'\fR \s-1API.\s0 .SH "METHODS" .IX Header "METHODS" .SS "name" .IX Subsection "name" .Vb 1 \& my $name = $result\->name; .Ve .PP Returns the name that was found in the document. .SS "to_string" .IX Subsection "to_string" .Vb 2 \& my $str = $result\->to_string; \& my $str = "$result"; .Ve .PP Convert this object to a string. This is the same as the \f(CW\*(C`name\*(C'\fR method. This method will also be invoked if stringified inside a double quoted string. .SS "document" .IX Subsection "document" .Vb 1 \& my $ppi = $result\->document; .Ve .PP Returns the PPI::Document of the document. .SS "node" .IX Subsection "node" .Vb 1 \& my $node = $result\->node; .Ve .PP Returns the PPI::Node where the name was found. This will usually be either PPI::Statement::Package or PPI::Token::Comment, although other types could be used in the future. .SH "SEE ALSO" .IX Header "SEE ALSO" .IP "PPIx::DocumentName" 4 .IX Item "PPIx::DocumentName" Main module that generates objects of this class. .SH "CAVEATS" .IX Header "CAVEATS" For \f(CW\*(C`node\*(C'\fR to be useful, the \f(CW\*(C`document\*(C'\fR object needs to remain in scope, this is the main reason the result object keeps it around, so if you want to use the \f(CW\*(C`node\*(C'\fR to get the location information, make sure that you do not throw away the result object. .PP Bad: .PP .Vb 2 \& my $node = PPIx::DocumentName\->extract( $ppi_document )\->node; \& my $location = $node\->location; # undef .Ve .PP Fine: .PP .Vb 3 \& my $result = PPIx::DocumentName\->extract( $ppi_document ); \& my $node = $result\->node; \& my $location = $node\->location; # ok .Ve .SH "AUTHORS" .IX Header "AUTHORS" .IP "\(bu" 4 Kent Fredric .IP "\(bu" 4 Graham Ollis .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2015\-2021 by Kent Fredric . .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.