File Coverage

blib/lib/PPI/Document/Fragment.pm
Criterion Covered Total %
statement 6 8 75.0
branch n/a
condition n/a
subroutine 2 3 66.6
pod 1 1 100.0
total 9 12 75.0


line stmt bran cond sub pod time code
1             package PPI::Document::Fragment;
2              
3             =pod
4              
5             =head1 NAME
6              
7             PPI::Document::Fragment - A fragment of a Perl Document
8              
9             =head1 DESCRIPTION
10              
11             In some situations you might want to work with a fragment of a larger
12             document. C is a class intended for this purpose.
13             It is functionally almost identical to a normal L, except
14             that it is not possible to get line/column positions for the elements
15             within it, and it does not represent a scope.
16              
17             =head1 METHODS
18              
19             =cut
20              
21 64     64   495 use strict;
  64         137  
  64         1910  
22 64     64   336 use PPI::Document ();
  64         149  
  64         6602  
23              
24             our $VERSION = '1.277';
25              
26             our @ISA = 'PPI::Document';
27              
28              
29              
30              
31              
32             #####################################################################
33             # PPI::Document Methods
34              
35             =pod
36              
37             =head2 index_locations
38              
39             Unlike when called on a PPI::Document object, you should not be attempting
40             to find locations of things within a PPI::Document::Fragment, and thus any
41             call to the C will print a warning and return C
42             instead of attempting to index the locations of the Elements.
43              
44             =cut
45              
46             # There's no point indexing a fragment
47             sub index_locations {
48 0     0 1   warn "Useless attempt to index the locations of a document fragment";
49 0           undef;
50             }
51              
52              
53              
54              
55              
56             #####################################################################
57             # PPI::Element Methods
58              
59             # We are not a scope boundary
60             ### XS -> PPI/XS.xs:_PPI_Document_Fragment__scope 0.903+
61             sub scope() { '' }
62              
63             1;
64              
65             =pod
66              
67             =head1 TO DO
68              
69             Integrate this into the rest of PPI so it has actual practical uses. The most
70             obvious would be to implement arbitrary cut/copy/paste more easily.
71              
72             =head1 SUPPORT
73              
74             See the L in the main module.
75              
76             =head1 AUTHOR
77              
78             Adam Kennedy Eadamk@cpan.orgE
79              
80             =head1 COPYRIGHT
81              
82             Copyright 2001 - 2011 Adam Kennedy.
83              
84             This program is free software; you can redistribute
85             it and/or modify it under the same terms as Perl itself.
86              
87             The full text of the license can be found in the
88             LICENSE file included with this module.
89              
90             =cut