« lib/Perl/ToPerl6/Transformer/BasicTypes/Integers/RewriteOctalNumbers.pm
↑ Summary
lib/Perl/ToPerl6/Transformer/BasicTypes/Strings/RenameShell.pm »
| 1 | package Perl::ToPerl6::Transformer::BasicTypes::Strings::RenameRegex; | ||
| 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{qr{...} is now rx{...} - Does not alter the contents of qr{...}}; | |
| 15 | 17 | Readonly::Scalar my $EXPL => | |
| 16 | q{qr{...} is now written as rx{...} - The contents are not rewritten}; | ||
| 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::Regexp' } |
|
Subroutine
applies_to: called CC=1 SCAR=0.0
Pod
documented
| |||
| 25 | |||
| 26 | #----------------------------------------------------------------------------- | ||
| 27 | |||
| 28 | # | ||
| 29 | # Note to the reader: | ||
| 30 | # | ||
| 31 | # A PPI::Token::QuoteLike::Regexp object contains a single string which has the | ||
| 32 | # entire 'qr{...}' token. Therefore we can't add a Token::Whitespace between | ||
| 33 | # the 'qr' and '{..}' like we can with loops and conditionals. | ||
| 34 | # | ||
| 35 | |||
| 36 | 0 | ▶ | sub transform { |
|
Subroutine
transform: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 37 | 0 | my ($self, $elem, $doc) = @_; | |
| 38 | |||
| 39 | 0 | my $content = $elem->content; | |
| 40 | |||
| 41 | 0 | $content =~ s{^qr}{rx}; | |
| 42 | |||
| 43 | 0 | $elem->set_content( $content ); | |
| 44 | |||
| 45 | 0 | return $self->transformation( $DESC, $EXPL, $elem ); | |
| 46 | } | ||
| 47 | |||
| 48 | 17 | 1; | |
| 49 | |||
| 50 | #----------------------------------------------------------------------------- | ||
| 51 | |||
| 52 | __END__ | ||