Skip to content

Commit

Permalink
Item14362: escape curly braces, as required by modern perl
Browse files Browse the repository at this point in the history
  • Loading branch information
cdot committed Mar 30, 2017
1 parent beaa235 commit 2cdf69c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions lib/Foswiki/Plugins/DBIQueryPlugin.pm
Expand Up @@ -218,15 +218,15 @@ sub storeDoQuery {
"%<nop>DBI_DO% script name must be a valid identifier")
unless $params{script} =~ /^\w\w*$/;
if ( $content =~
/%DBI_CODE{"$params{script}"}%(.*?)%DBI_CODE%/s )
/%DBI_CODE\{"$params{script}"\}%(.*?)%DBI_CODE%/s )
{
$content = $1;
}
else {
undef $content;
}
if ( defined $content ) {
$content =~ s/^\s*%CODE{.*?}%(.*)%ENDCODE%\s*$/$1/s;
$content =~ s/^\s*%CODE\{.*?\}%(.*)%ENDCODE%\s*$/$1/s;
$content =~ s/^\s*<pre>(.*)<\/pre>\s*$/$1/s;
}
}
Expand Down Expand Up @@ -581,17 +581,18 @@ sub processPage {

my $doHandle = 0;
$_[0] =~ s/%DBI_VERSION%/$VERSION/gs;
if (
$_[0] =~ s/%DBI_DO{(.*?)}%(?:(.*?)%DBI_DO%)?/&storeDoQuery($1, $2)/ges )
if ( $_[0] =~
s/%DBI_DO\{(.*?)\}%(?:(.*?)%DBI_DO%)?/&storeDoQuery($1, $2)/ges )
{
$doHandle = 1;
}
$_[0] =~ s/\%DBI_CODE{(.*?)}%(.*?)\%DBI_CODE%/&dbiCode($1, $2)/ges;
if ( $_[0] =~ s/%DBI_QUERY{(.*?)}%(.*?)%DBI_QUERY%/&storeQuery($1, $2)/ges )
$_[0] =~ s/\%DBI_CODE\{(.*?)\}%(.*?)\%DBI_CODE%/&dbiCode($1, $2)/ges;
if ( $_[0] =~
s/%DBI_QUERY\{(.*?)\}%(.*?)%DBI_QUERY%/&storeQuery($1, $2)/ges )
{
$doHandle = 1;
}
if ( $_[0] =~ s/%DBI_CALL{(.*?)}%/&storeCallQuery($1)/ges ) {
if ( $_[0] =~ s/%DBI_CALL\{(.*?)\}%/&storeCallQuery($1)/ges ) {
$doHandle = 1;
}
if ($doHandle) {
Expand Down

0 comments on commit 2cdf69c

Please sign in to comment.