PPI/Token/Quote.pm

filter: Statementstmt 100% 12 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 100% 16 / 16 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« PPI/Token/Label.pm ↑ Summary PPI/Token/Quote/Interpolate.pm »
1 package PPI::Token::Quote;
2  
3 =pod
4  
5 =head1 NAME
6  
7 PPI::Token::Quote - String quote abstract base class
8  
9 =head1 INHERITANCE
10  
11 PPI::Token::Quote
12 isa PPI::Token
13 isa PPI::Element
14  
15 =head1 DESCRIPTION
16  
17 The C<PPI::Token::Quote> class is never instantiated, and simply
18 provides a common abstract base class for the four quote classes.
19 In PPI, a "quote" is limited to only the quote-like things that
20 themselves directly represent a string. (although this includes
21 double quotes with interpolated elements inside them).
22  
23 The subclasses of C<PPI::Token::Quote> are:
24  
25 =over 2
26  
27 =item C<''> - L<PPI::Token::Quote::Single>
28  
29 =item C<q{}> - L<PPI::Token::Quote::Literal>
30  
31 =item C<""> - L<PPI::Token::Quote::Double>
32  
33 =item C<qq{}> - L<PPI::Token::Quote::Interpolate>
34  
35 =back
36  
37 The names are hopefully obvious enough not to have to explain what
38 each class is here. See their respective pages for more details.
39  
40 Please note that although the here-doc B<does> represent a literal
41 string, it is such a nasty piece of work that in L<PPI> it is given the
42 honor of its own token class (L<PPI::Token::HereDoc>).
43  
44 =head1 METHODS
45  
46 =cut
47  
48 62 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
49 62 ▶use PPI::Token ();
Subroutine BEGIN: called CC=1 SCAR=0.0
50  
51 62 ▶use vars qw{$VERSION @ISA};
Subroutine BEGIN: called CC=1 SCAR=0.0
52 BEGIN {
53 62 ▶ $VERSION = '1.236';
Subroutine BEGIN: called CC=1 SCAR=0.0
54 62 @ISA = 'PPI::Token';
55 }
56  
57  
58  
59  
60  
61 #####################################################################
62 # PPI::Token::Quote Methods
63  
64 =pod
65  
66 =head2 string
67  
68 The C<string> method is provided by all four ::Quote classes. It won't
69 get you the actual literal Perl value, but it will strip off the wrapping
70 of the quotes.
71  
72 # The following all return foo from the ->string method
73 'foo'
74 "foo"
75 q{foo}
76 qq <foo>
77  
78 =cut
79  
80 #sub string {
81 # my $class = ref $_[0] || $_[0];
82 # die "$class does not implement method ->string";
83 #}
84  
85 =pod
86  
87 =head2 literal
88  
89 The C<literal> method is provided by ::Quote::Literal and
90 ::Quote::Single. This returns the value of the string as Perl sees
91 it: without the quote marks and with C<\\> and C<\'> resolved to C<\>
92 and C<'>.
93  
94 The C<literal> method is not implemented by ::Quote::Double or
95 ::Quote::Interpolate yet.
96  
97 =cut
98  
99 62 1;
100  
101 =pod
102  
103 =head1 SUPPORT
104  
105 See the L<support section|PPI/SUPPORT> in the main module.
106  
107 =head1 AUTHOR
108  
109 Adam Kennedy E<lt>adamk@cpan.orgE<gt>
110  
111 =head1 COPYRIGHT
112  
113 Copyright 2001 - 2011 Adam Kennedy.
114  
115 This program is free software; you can redistribute
116 it and/or modify it under the same terms as Perl itself.
117  
118 The full text of the license can be found in the
119 LICENSE file included with this module.
120  
121 =cut
« PPI/Token/Label.pm ↑ Summary PPI/Token/Quote/Interpolate.pm »