| 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, note that | ||
| 22 | L<String::InterpolatedVariables> allows to extract them). | ||
| 23 | |||
| 24 | The subclasses of C<PPI::Token::Quote> are: | ||
| 25 | |||
| 26 | =over 2 | ||
| 27 | |||
| 28 | =item C<''> - L<PPI::Token::Quote::Single> | ||
| 29 | |||
| 30 | =item C<q{}> - L<PPI::Token::Quote::Literal> | ||
| 31 | |||
| 32 | =item C<""> - L<PPI::Token::Quote::Double> | ||
| 33 | |||
| 34 | =item C<qq{}> - L<PPI::Token::Quote::Interpolate> | ||
| 35 | |||
| 36 | =back | ||
| 37 | |||
| 38 | The names are hopefully obvious enough not to have to explain what | ||
| 39 | each class is here. See their respective pages for more details. | ||
| 40 | |||
| 41 | Please note that although the here-doc B<does> represent a literal | ||
| 42 | string, it is such a nasty piece of work that in L<PPI> it is given the | ||
| 43 | honor of its own token class (L<PPI::Token::HereDoc>). | ||
| 44 | |||
| 45 | =head1 METHODS | ||
| 46 | |||
| 47 | =cut | ||
| 48 | |||
| 49 | 63 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 50 | 63 | ▶ | use PPI::Token (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 51 | |||
| 52 | 63 | our $VERSION = '1.260'; # VERSION | |
| 53 | |||
| 54 | 63 | our @ISA = "PPI::Token"; | |
| 55 | |||
| 56 | |||
| 57 | |||
| 58 | |||
| 59 | |||
| 60 | ##################################################################### | ||
| 61 | # PPI::Token::Quote Methods | ||
| 62 | |||
| 63 | =pod | ||
| 64 | |||
| 65 | =head2 string | ||
| 66 | |||
| 67 | The C<string> method is provided by all four ::Quote classes. It won't | ||
| 68 | get you the actual literal Perl value, but it will strip off the wrapping | ||
| 69 | of the quotes. | ||
| 70 | |||
| 71 | # The following all return foo from the ->string method | ||
| 72 | 'foo' | ||
| 73 | "foo" | ||
| 74 | q{foo} | ||
| 75 | qq <foo> | ||
| 76 | |||
| 77 | =cut | ||
| 78 | |||
| 79 | #sub string { | ||
| 80 | # my $class = ref $_[0] || $_[0]; | ||
| 81 | # die "$class does not implement method ->string"; | ||
| 82 | #} | ||
| 83 | |||
| 84 | =pod | ||
| 85 | |||
| 86 | =head2 literal | ||
| 87 | |||
| 88 | The C<literal> method is provided by ::Quote::Literal and | ||
| 89 | ::Quote::Single. This returns the value of the string as Perl sees | ||
| 90 | it: without the quote marks and with C<\\> and C<\'> resolved to C<\> | ||
| 91 | and C<'>. | ||
| 92 | |||
| 93 | The C<literal> method is not implemented by ::Quote::Double or | ||
| 94 | ::Quote::Interpolate yet. | ||
| 95 | |||
| 96 | =cut | ||
| 97 | |||
| 98 | 63 | 1; | |
| 99 | |||
| 100 | =pod | ||
| 101 | |||
| 102 | =head1 SUPPORT | ||
| 103 | |||
| 104 | See the L<support section|PPI/SUPPORT> in the main module. | ||
| 105 | |||
| 106 | =head1 AUTHOR | ||
| 107 | |||
| 108 | Adam Kennedy E<lt>adamk@cpan.orgE<gt> | ||
| 109 | |||
| 110 | =head1 COPYRIGHT | ||
| 111 | |||
| 112 | Copyright 2001 - 2011 Adam Kennedy. | ||
| 113 | |||
| 114 | This program is free software; you can redistribute | ||
| 115 | it and/or modify it under the same terms as Perl itself. | ||
| 116 | |||
| 117 | The full text of the license can be found in the | ||
| 118 | LICENSE file included with this module. | ||
| 119 | |||
| 120 | =cut | ||