PPI/Document/Fragment.pm

filter: Statementstmt 85.7% 12 / 14 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 100% 1 / 1 totaltotal 85.0% 17 / 20 CC 1 SCAR 1.8
CC
1
Cov
86%
index_locations
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« PPI/Token/Quote/Single.pm ↑ Summary PPI.pm »
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<PPI::Document::Fragment> is a class intended for this purpose.
13 It is functionally almost identical to a normal L<PPI::Document>, 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 62 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 62 ▶use PPI::Document ();
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 62 ▶use vars qw{$VERSION @ISA};
Subroutine BEGIN: called CC=1 SCAR=0.0
25 BEGIN {
26 62 ▶ $VERSION = '1.236';
Subroutine BEGIN: called CC=1 SCAR=0.0
27 62 @ISA = 'PPI::Document';
28 }
29  
30  
31  
32  
33  
34 #####################################################################
35 # PPI::Document Methods
36  
37 =pod
38  
39 =head2 index_locations
40  
41 Unlike when called on a PPI::Document object, you should not be attempting
42 to find locations of things within a PPI::Document::Fragment, and thus any
43 call to the C<index_locations> will print a warning and return C<undef>
44 instead of attempting to index the locations of the Elements.
45  
46 =cut
47  
48 # There's no point indexing a fragment
49 sub index_locations {
50 0 ▶ warn "Useless attempt to index the locations of a document fragment";
Subroutine index_locations: not called CC=1 SCAR=6.9
Pod documented
51 0 undef;
52 }
53  
54  
55  
56  
57  
58 #####################################################################
59 # PPI::Element Methods
60  
61 # We are not a scope boundary
62 ### XS -> PPI/XS.xs:_PPI_Document_Fragment__scope 0.903+
63 sub scope() { '' }
64  
65 62 1;
66  
67 =pod
68  
69 =head1 TO DO
70  
71 Integrate this into the rest of PPI so it has actual practical uses. The most
72 obvious would be to implement arbitrary cut/copy/paste more easily.
73  
74 =head1 SUPPORT
75  
76 See the L<support section|PPI/SUPPORT> in the main module.
77  
78 =head1 AUTHOR
79  
80 Adam Kennedy E<lt>adamk@cpan.orgE<gt>
81  
82 =head1 COPYRIGHT
83  
84 Copyright 2001 - 2011 Adam Kennedy.
85  
86 This program is free software; you can redistribute
87 it and/or modify it under the same terms as Perl itself.
88  
89 The full text of the license can be found in the
90 LICENSE file included with this module.
91  
92 =cut
« PPI/Token/Quote/Single.pm ↑ Summary PPI.pm »