| | 90 | return; |
| | 91 | } |
| | 92 | |
| | 93 | if ( $text =~ /\=[\s\t\r\n]*chomp\b/ ) { |
| | 94 | $self->{error} = "chomp doesn't return the chomped value, it modifies the variable given as argument."; |
| | 95 | return; |
| | 96 | } |
| | 97 | |
| | 98 | if ( $text =~ /map[\s\t\r\n]*\{[\s\t\r\n]*(\$_[\s\t\r\n]*\=\~[\s\t\r\n]*)?s\// ) { |
| | 99 | $self->{error} = "Substitute (s///) doesn't return the changed value even if map."; |
| | 100 | return; |
| | 101 | } |
| | 102 | |
| | 103 | if ( $text =~ /\(\<\@\w+\>\)/ ) { |
| | 104 | $self->{error} = "(<\@Foo>) is Perl6 syntax and usually not valid in Perl5: %s"; |
| | 105 | return; |
| | 106 | } |
| | 107 | |
| | 108 | if ( $text =~ /if[\s\t\r\n]*\(?[\$\s\t\r\n\w]+\=[\s\t\r\n\$\w]/ ) { |
| | 109 | $self->{error} = "A single = in a if-condition is usually a typo, use == or eq to compare."; |
| | 110 | return; |
| | 111 | } |
| | 112 | |
| | 113 | if ( $text =~ /open[\s\t\r\n]*\(?\$?\w+[\s\t\r\n]*(\,.+?)?\,?([\"\'])[^\2]+?\|[^\2]+?\2/ ) { |
| | 114 | $self->{error} = "Using a | char in open without a | at the beginning or end is usually a typo."; |
| | 115 | return; |
| | 116 | } |
| | 117 | |
| | 118 | if ( $text =~ /open[\s\t\r\n]*\(?\$?\w+[\s\t\r\n]*\,(.+?\,)?([\"\'])\|[^\2]+?\|\2/ ) { |
| | 119 | $self->{error} = "You can't use open to pipe to and from a command at the same time."; |