Add built local::lib
[catagits/Gitalist.git] / local-lib5 / lib / perl5 / PPI / Token / Quote / Literal.pm
1 package PPI::Token::Quote::Literal;
2
3 =pod
4
5 =head1 NAME
6
7 PPI::Token::Quote::Literal - The literal quote-like operator
8
9 =head1 INHERITANCE
10
11   PPI::Token::Quote::Literal
12   isa PPI::Token::Quote
13       isa PPI::Token
14           isa PPI::Element
15
16 =head1 DESCRIPTION
17
18 A C<PPI::Token::Quote::Literal> object represents a single literal
19 quote-like operator, such as C<q{foo bar}>.
20
21 =head1 METHODS
22
23 There are no methods available for C<PPI::Token::Quote::Literal> beyond
24 those provided by the parent L<PPI::Token::Quote>, L<PPI::Token> and
25 L<PPI::Element> classes.
26
27 Got any ideas for methods? Submit a report to rt.cpan.org!
28
29 =cut
30
31 use strict;
32 use PPI::Token::Quote ();
33 use PPI::Token::_QuoteEngine::Full ();
34
35 use vars qw{$VERSION @ISA};
36 BEGIN {
37         $VERSION = '1.206';
38         @ISA     = qw{
39                 PPI::Token::_QuoteEngine::Full
40                 PPI::Token::Quote
41         };
42 }
43
44
45
46
47
48 #####################################################################
49 # PPI::Token::Quote Methods
50
51 =pod
52
53 =begin testing string 8
54
55 my $Document = PPI::Document->new( \"print q{foo}, q!bar!, q <foo>;" );
56 isa_ok( $Document, 'PPI::Document' );
57 my $literal = $Document->find('Token::Quote::Literal');
58 is( scalar(@$literal), 3, '->find returns three objects' );
59 isa_ok( $literal->[0], 'PPI::Token::Quote::Literal' );
60 isa_ok( $literal->[1], 'PPI::Token::Quote::Literal' );
61 isa_ok( $literal->[2], 'PPI::Token::Quote::Literal' );
62 is( $literal->[0]->string, 'foo', '->string returns as expected' );
63 is( $literal->[1]->string, 'bar', '->string returns as expected' );
64 is( $literal->[2]->string, 'foo', '->string returns as expected' );
65
66 =end testing
67
68 =cut
69
70 sub string {
71         my $self     = shift;
72         my @sections = $self->_sections;
73         my $str      = $sections[0];
74         substr( $self->{content}, $str->{position}, $str->{size} );     
75 }
76
77 *literal = *PPI::Token::Quote::Single::Literal;
78
79 1;
80
81 =pod
82
83 =head1 SUPPORT
84
85 See the L<support section|PPI/SUPPORT> in the main module.
86
87 =head1 AUTHOR
88
89 Adam Kennedy E<lt>adamk@cpan.orgE<gt>
90
91 =head1 COPYRIGHT
92
93 Copyright 2001 - 2009 Adam Kennedy.
94
95 This program is free software; you can redistribute
96 it and/or modify it under the same terms as Perl itself.
97
98 The full text of the license can be found in the
99 LICENSE file included with this module.
100
101 =cut