Permalink
Browse files

Subject:

From: Chet Burgess <cfb@liquidreality.org>

Trac: Refs #100

-Using /o in regexp isn't always safe and isn't really useful
 anymore (see the trac tickets for more details).

Signed-off-by: Chet Burgess <cfb@liquidreality.org>
  • Loading branch information...
1 parent 1e2ab29 commit c2b0fc7640a08a9e26e241e013cc1f908587ed50 cfb committed Nov 12, 2009
Showing with 19 additions and 19 deletions.
  1. +13 −13 lib/Spine/Data.pm
  2. +3 −3 lib/Spine/Plugin/Auth.pm
  3. +2 −2 lib/Spine/Plugin/Hardware.pm
  4. +1 −1 lib/Spine/Plugin/Templates.pm
View
@@ -451,20 +451,20 @@ sub _read_keyfile
# specifically, it is then discarded (if it isn't, the JSON
# parser throws a syntax error and blows up spine, the YAML
# parser just gums up the name of the first item)
- if ($PARSER_LINE == 1 and m/^#?%(YAML\s+\d+\.\d+|JSON)/o)
+ if ($PARSER_LINE == 1 and m/^#?%(YAML\s+\d+\.\d+|JSON)/)
{
$complex = $1;
$buf = join('', <$fh>);
- $template = 1 if (not defined($template) and $buf =~ m/\[%.+/o);
+ $template = 1 if (not defined($template) and $buf =~ m/\[%.+/);
last LINE;
}
# Ignore comments and blank lines.
- if (m/^\s*$/o or m/^\s*#/o) {
+ if (m/^\s*$/ or m/^\s*#/) {
next LINE;
}
- $template = 1 if (not defined($template) and m/\[%.+/o);
+ $template = 1 if (not defined($template) and m/\[%.+/);
$buf .= $_;
}
@@ -486,7 +486,7 @@ sub _read_keyfile
$obj = $self->_parse_complex_key($buf, $file, $complex);
}
else {
- $obj = [split(m/\n/o, $buf)];
+ $obj = [split(m/\n/, $buf)];
}
# _parse_complex_key() handles error reporting
@@ -509,7 +509,7 @@ sub _convert_lame_to_TT
my $file = shift;
# If it's not one of our lame syntax lines, just return it
- unless ($line =~ m/^\[%(\s*)(IF|MATCH|ELSIF)\s+(.+\s*)+%\]\s*$/o) {
+ unless ($line =~ m/^\[%(\s*)(IF|MATCH|ELSIF)\s+(.+\s*)+%\]\s*$/) {
return $line;
}
@@ -555,7 +555,7 @@ sub _TT_list_search
return undef unless defined($list) and defined($pattern);
foreach my $str (@{$list}) {
- $rc++ if $str =~ qr/$pattern/o;
+ $rc++ if $str =~ qr/$pattern/;
}
return $rc;
@@ -656,11 +656,11 @@ sub _parse_complex_key
#
# Now actually try to parse the key
#
- if ($method =~ m/^JSON$/o)
+ if ($method =~ m/^JSON$/)
{
$obj = JSON::Syck::Load($buf);
}
- elsif ($method =~ m/^YAML\s+(\d+\.\d+)$/o)
+ elsif ($method =~ m/^YAML\s+(\d+\.\d+)$/)
{
# Only the YAML v1.0 specification is supported by any YAML parsers
# as yet.
@@ -745,14 +745,14 @@ sub _evaluate_key
# where necessary. Otherwise, just append it to the list
foreach (@{$obj}) {
# Ignore comments and blank lines.
- if (m/^\s*$/o or m/^\s*#/o) {
+ if (m/^\s*$/ or m/^\s*#/) {
next;
}
# We allow several metacharacters to manipulate
# pre-existing values in a key. -regex removes
# matching values for the key in question.
- if ($keyname && m/^-(.*)$/o) {
+ if ($keyname && m/^-(.*)$/) {
next unless defined @{$self->{$keyname}};
my $rm_regex = $1;
@@ -764,7 +764,7 @@ sub _evaluate_key
# If equals (=) is the first and only character of
# a line, clear the array. This is used to set
# absolute values.
- elsif ($keyname && m/^=\s*$/o) {
+ elsif ($keyname && m/^=\s*$/) {
delete $self->{$keyname} if defined($keyname);
next;
}
@@ -916,7 +916,7 @@ sub getvals_by_keyname
$self->print(4, "getvals_by_keyname -> $key_re");
foreach my $key (keys(%{$self})) {
- if ($key =~ m/$key_re/o) {
+ if ($key =~ m/$key_re/) {
push @matching_vals, $self->{key};
}
}
View
@@ -362,7 +362,7 @@ sub _parse_maps
}
foreach my $value (@{$values}) {
- my @list = split(m/:/o, $value);
+ my @list = split(m/:/, $value);
if (scalar(@list) != 2) {
$c->error("Invalid line in $map: \"$value\"", 'crit');
@@ -427,7 +427,7 @@ sub _expand_auth_group
#
# Grep all further groups, pass in at once, limit recursion
#
- my @nested_groups = grep(m/^@/o, @{$auth_groups->{$group}});
+ my @nested_groups = grep(m/^@/, @{$auth_groups->{$group}});
if (scalar(@nested_groups)) {
push @list, _expand_auth_group($auth_groups, $group);
@@ -1489,7 +1489,7 @@ sub _copy_skel_dir
}
while (defined(my $d_entry = readdir(DIR))) {
- if ($d_entry =~ m/^.{1,2}$/o) {
+ if ($d_entry =~ m/^.{1,2}$/) {
next;
}
push @entries, $d_entry;
@@ -224,7 +224,7 @@ sub scrub_value
$changed++;
$v = 1;
}
- elsif ($v =~ m/^\d\+$/o) {
+ elsif ($v =~ m/^\d\+$/) {
$changed++;
$v = int($v);
}
@@ -455,7 +455,7 @@ sub num_cores
my @dies = $self->find_items(class => 'processor', name => qr/^cpu:/);
foreach my $die (@dies) {
- if ($die->{product} =~ m/(?i:dual\s+core|duo)/o) {
+ if ($die->{product} =~ m/(?i:dual\s+core|duo)/) {
$cores++;
}
}
@@ -77,7 +77,7 @@ sub process_templates
# Pre-compile our regular expressions for templates to ignore
if (defined($ignore) and scalar(@IGNORE) == 0)
{
- @IGNORE = map qr/$_/o, @{$ignore};
+ @IGNORE = map qr/$_/, @{$ignore};
}
undef $ignore;

0 comments on commit c2b0fc7

Please sign in to comment.