« lib/Perl/ToPerl6/Transformer/BasicTypes/Strings/RenameRegex.pm
↑ Summary
lib/Perl/ToPerl6/Transformer/Arrays/AddWhitespace.pm »
| 1 | package Perl::ToPerl6::Transformer::BasicTypes::Strings::RenameShell; | ||
| 2 | |||
| 3 | 17 | ▶ | use 5.006001; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 17 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 17 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 17 | ▶ | use Readonly; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 17 | ▶ | use Perl::ToPerl6::Utils qw{ :severities }; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 17 | ▶ | use base 'Perl::ToPerl6::Transformer'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | #----------------------------------------------------------------------------- | ||
| 13 | |||
| 14 | 17 | Readonly::Scalar my $DESC => q{Transform qx{...} to qqx{...}}; | |
| 15 | 17 | Readonly::Scalar my $EXPL => | |
| 16 | q{Perl6 supports qx{}, but the perl5ish version is qqx{}}; | ||
| 17 | |||
| 18 | #----------------------------------------------------------------------------- | ||
| 19 | |||
| 20 | 31 | ▶ | sub run_after { return 'BasicTypes::Strings::AddWhitespace' } |
|
Subroutine
run_after: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 21 | 38 | ▶ | sub supported_parameters { return () } |
|
Subroutine
supported_parameters: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 22 | 27 | ▶ | sub default_necessity { return $NECESSITY_HIGHEST } |
|
Subroutine
default_necessity: called CC=1 SCAR=0.0
Pod
documented
| |||
| 23 | 24 | ▶ | sub default_themes { return qw( core ) } |
|
Subroutine
default_themes: called CC=1 SCAR=0.0
Pod
documented
| |||
| 24 | 5 | ▶ | sub applies_to { return 'PPI::Token::QuoteLike::Command' } |
|
Subroutine
applies_to: called CC=1 SCAR=0.0
Pod
documented
| |||
| 25 | |||
| 26 | #----------------------------------------------------------------------------- | ||
| 27 | |||
| 28 | # | ||
| 29 | # A PPI::Token::QuoteLike::Command object contains a single string which has | ||
| 30 | # the entire 'qx{...}' token. Therefore we can't add a Token::Whitespace | ||
| 31 | # between the 'qr' and '{..}' like we can with loops and conditionals. | ||
| 32 | # | ||
| 33 | |||
| 34 | 0 | ▶ | sub transform { |
|
Subroutine
transform: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 35 | 0 | my ($self, $elem, $doc) = @_; | |
| 36 | |||
| 37 | 0 | my $content = $elem->content; | |
| 38 | |||
| 39 | 0 | $content =~ s{^qx}{qqx}; | |
| 40 | |||
| 41 | 0 | $elem->set_content( $content ); | |
| 42 | |||
| 43 | 0 | return $self->transformation( $DESC, $EXPL, $elem ); | |
| 44 | } | ||
| 45 | |||
| 46 | 17 | 1; | |
| 47 | |||
| 48 | #----------------------------------------------------------------------------- | ||
| 49 | |||
| 50 | __END__ | ||