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

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

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

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

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" ); }

See the support section in the main module.

Adam Kennedy <adamk@cpan.org>

Copyright 2001 - 2009 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.