PPI::Token::Quote::Single.3pm

Langue: en

Version: 2008-05-14 (debian - 07/07/09)

Section: 3 (Bibliothèques de fonctions)

NAME

PPI::Token::Quote::Single - A 'single quote' token

INHERITANCE

   PPI::Token::Quote::Single
   isa PPI::Token::Quote
       isa PPI::Token
           isa PPI::Element
 
 

SYNOPSIS

   'This is a single quote'
   
   q{This is a literal, but NOT a single quote}
 
 

DESCRIPTION

A "PPI::Token::Quote::Single" object represents a single quoted string literal.

METHODS

There are no methods available for "PPI::Token::Quote::Single" beyond those provided by the parent PPI::Token::Quote, PPI::Token and PPI::Element classes.

Got any ideas for methods? Submit a report to rt.cpan.org!

my $Document = PPI::Document->new( \``print 'foo';'' ); isa_ok( $Document, 'PPI::Document' ); my $Single = $Document->find_first('Token::Quote::Single'); isa_ok( $Single, 'PPI::Token::Quote::Single' ); is( $Single->string, 'foo', '->string returns as expected' );

my @pairs = (         ``'''', '',
        ``'f''', 'f',
        ``'f\\'b''', ``f\'b'',
        ``'f\\nb''', ``f\\nb'',
        ``'f\\\\b''', ``f\\b'',
        ``'f\\\\\\b''', ``f\\\\b'',
        ``'f\\\\\\\'''', ``f\\''',
); while ( @pairs ) {         my $from = shift @pairs;
        my $to = shift @pairs;
        my $doc = PPI::Document->new( \``print $from;'' );
        isa_ok( $doc, 'PPI::Document' );
        my $quote = $doc->find_first('Token::Quote::Single');
        isa_ok( $quote, 'PPI::Token::Quote::Single' );
        is( $quote->literal, $to, ``The source $from becomes $to ok'' );
}

SUPPORT

See the support section in the main module.

AUTHOR

Adam Kennedy <adamk@cpan.org> Copyright 2001 - 2008 Adam Kennedy.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.

POD ERRORS

Hey! The above document had some coding errors, which are explained below:
Around line 55:
'=begin' only takes one parameter, not several as in '=begin testing string 3'
Around line 63:
=end testing without matching =begin. (Stack: [empty])
Around line 74:
'=begin' only takes one parameter, not several as in '=begin testing literal 21'
Around line 95:
=end testing without matching =begin. (Stack: [empty])