Adam Kennedy > PPI > PPI::Token::Quote::Single

Download:
PPI-1.206.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  40
Open  28
View Bugs
Report a bug
Module Version: 1.206   Source  

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 ^

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.