PPI::Document::Fragment(3) User Contributed Perl Documentation PPI::Document::Fragment(3)

# [NAME](#NAME)

PPI::Document::Fragment - A fragment of a Perl Document

# [DESCRIPTION](#DESCRIPTION)

In some situations you might want to work with a fragment of a larger document. "PPI::Document::Fragment" is a class intended for this purpose. It is functionally almost identical to a normal PPI::Document, except that it is not possible to get line/column positions for the elements within it, and it does not represent a scope.

# [METHODS](#METHODS)

## [index\_locations](#index_locations)

Unlike when called on a PPI::Document object, you should not be attempting to find locations of things within a PPI::Document::Fragment, and thus any call to the "index\_locations" will print a warning and return "undef" instead of attempting to index the locations of the Elements.

# [TO DO](#TO_DO)

Integrate this into the rest of PPI so it has actual practical uses. The most obvious would be to implement arbitrary cut/copy/paste more easily.

# [SUPPORT](#SUPPORT)

See the support section in the main module.

# [AUTHOR](#AUTHOR)

Adam Kennedy &lt;adamk@cpan.org&gt;

# [COPYRIGHT](#COPYRIGHT)

Copyright 2001 - 2011 Adam Kennedy.

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

The full text of the license can be found in the LICENSE file included with this module.

2026-10-26 perl v5.44.0

---

Document: PPI::Document::Fragment(3pm) from perl-ppi 1.291-r3 (Chainguard OS)
Source: https://github.com/Perl-Critic/PPI
