In Perl 5.14, released in May 2011, the r modifier was added to the s///
operator to allow it to return the modified string instead of modifying
the string in place. This allows to write nicer, more succinct code in
several cases, so let's do that here.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
if ($search_use_regexp) {
$search_regexp = $searchtext;
if (!eval { qr/$search_regexp/; 1; }) {
- (my $error = $@) =~ s/ at \S+ line \d+.*\n?//;
+ my $error = $@ =~ s/ at \S+ line \d+.*\n?//r;
die_error(400, "Invalid search regexp '$search_regexp'",
esc_html($error));
}
# Try to avoid using this function wherever possible.
sub quote_command {
return join(' ',
- map { my $a = $_; $a =~ s/(['!])/'\\$1'/g; "'$a'" } @_ );
+ map { my $a = $_ =~ s/(['!])/'\\$1'/gr; "'$a'" } @_ );
}
# get HEAD ref of given project as hash