---
name: "PPIx::DocumentName::Result"
section: "3pm"
platform: "linux"
package: "libppix-documentname-perl"
version: "1.01-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/PPIx::DocumentName::Result"
---

# PPIx::DocumentName::Result(3pm)

Full result set for PPIx::DocumentName

## NAME

PPIx::DocumentName::Result - Full result set for PPIx::DocumentName

## VERSION

version 1.01

## SYNOPSIS

```
 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;
```

## DESCRIPTION

This class represents the results from PPIx::DocumentName when running under its new `"-api => 1"` API.

## METHODS

### name

```
 my $name = $result->name;
```

Returns the name that was found in the document.

### to\_string

```
 my $str = $result->to_string;
 my $str = "$result";
```

Convert this object to a string.  This is the same as the `"name"` method.  This method will also be invoked if stringified inside a double quoted string.

### document

```
 my $ppi = $result->document;
```

Returns the PPI::Document of the document.

### node

```
 my $node = $result->node;
```

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.

## SEE ALSO

- PPIx::DocumentName

  Main module that generates objects of this class.

## CAVEATS

For `"node"` to be useful, the `"document"` object needs to remain in scope, this is the main reason the result object keeps it around, so if you want to use the `"node"` to get the location information, make sure that you do not throw away the result object.

Bad:

```
 my $node = PPIx::DocumentName->extract( $ppi_document )->node;
 my $location = $node->location;  # undef
```

Fine:

```
 my $result = PPIx::DocumentName->extract( $ppi_document );
 my $node = $result->node;
 my $location = $node->location;  # ok
```

## AUTHORS

- •

  Kent Fredric \<kentnl@cpan.org\>

- •

  Graham Ollis \<plicease@cpan.org\>

## COPYRIGHT AND LICENSE

This software is copyright (c) 2015-2021 by Kent Fredric \<kentfredric@gmail.com\>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
