« lib/Perl/ToPerl6/TransformerParameter/Behavior/Enumeration.pm
↑ Summary
lib/Perl/ToPerl6/Transformer/Subroutines/RemovePrototypes.pm »
| 1 | package Perl::ToPerl6::Transformer::RewriteSpecialLiterals; | ||||||||||||||||||||||||||||||||||||||||||
| 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 '__END__' etc.}; | |||||||||||||||||||||||||||||||||||||||||
| 15 | 17 | Readonly::Scalar my $EXPL => q{__END__ and __DATA__ are now POD markers}; | |||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | 17 | my %map = ( | |||||||||||||||||||||||||||||||||||||||||
| 20 | '__END__' => '=finish', | ||||||||||||||||||||||||||||||||||||||||||
| 21 | '__FILE__' => '$?FILE', | ||||||||||||||||||||||||||||||||||||||||||
| 22 | '__LINE__' => '$?LINE', | ||||||||||||||||||||||||||||||||||||||||||
| 23 | '__PACKAGE__' => '$?PACKAGE', | ||||||||||||||||||||||||||||||||||||||||||
| 24 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | 38 | ▶ | sub supported_parameters { return () } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
supported_parameters: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | 27 | ▶ | sub default_necessity { return $NECESSITY_HIGHEST } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_necessity: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | 24 | ▶ | sub default_themes { return qw( core ) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_themes: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 5 | ▶ | sub applies_to { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
applies_to: called CC=1 SCAR=0.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 78 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=15.2
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | ( $_[1]->isa('PPI::Token::Separator') or | ||||||||||||||||||||||||||||||||||||||||||
| 34 | $_[1]->isa('PPI::Token::End') or | ||||||||||||||||||||||||||||||||||||||||||
| 35 | $_[1]->isa('PPI::Token::Word') ) and | ||||||||||||||||||||||||||||||||||||||||||
| 36 | 78 | ▶ | exists $map{$_[1]->content} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$_[1]->isa("PPI::Token::Separator") or $_[1]->isa("PPI::Token::End") or $_[1]->isa("PPI::Token::Word")
$_[1]->isa("PPI::Token::Separator") or $_[1]->isa("PPI::Token::End")
MC/DC33%1/3
$_[1]->isa("PPI::Token::Separator") or $_[1]->isa("PPI::Token::End") or $_[1]->isa("PPI::Token::Word")
$_[1]->isa("PPI::Token::Separator")
$_[1]->isa("PPI::Token::End")
$_[1]->isa("PPI::Token::Word")
Truth table50%2/4
A or B or C
A= $_[1]->isa("PPI::Token::Separator")B= $_[1]->isa("PPI::Token::End")C= $_[1]->isa("PPI::Token::Word")
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||
| 38 | 5 | } | |||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | sub transform { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
transform: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | my ($self, $elem, $doc) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | ▶ | if ( $elem->isa('PPI::Token::Word') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | my $new_content = $elem->content; | |||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | $elem->set_content($map{$new_content}); | |||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||
| 49 | elsif ( $elem->isa('PPI::Token::Separator') ) { | ||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | my $new_content = $elem->content; | |||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | $elem->set_content($map{$new_content}); | |||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | return $self->transformation( $DESC, $EXPL, $elem ); | |||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 17 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | __END__ | ||||||||||||||||||||||||||||||||||||||||||