Skip to content

Commit

Permalink
more consistent regex formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 17, 2015
1 parent 8aa3f8a commit acf0baa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/Mojo/DOM/CSS.pm
Expand Up @@ -270,7 +270,7 @@ sub _unescape {
$value =~ s/\\\n//g;

# Unescape Unicode characters
$value =~ s/\\([0-9a-fA-F]{1,6})\s?/pack('U', hex $1)/ge;
$value =~ s/\\([0-9a-fA-F]{1,6})\s?/pack 'U', hex $1/ge;

# Remove backslash
$value =~ s/\\//g;
Expand Down
10 changes: 5 additions & 5 deletions lib/Mojo/Util.pm
Expand Up @@ -76,7 +76,7 @@ sub camelize {
sub class_to_file {
my $class = shift;
$class =~ s/::|'//g;
$class =~ s/([A-Z])([A-Z]*)/$1.lc($2)/ge;
$class =~ s/([A-Z])([A-Z]*)/$1 . lc $2/ge;
return decamelize($class);
}

Expand Down Expand Up @@ -301,7 +301,7 @@ sub tablify {

sub term_escape {
my $str = shift;
$str =~ s/([[:cntrl:]])/$1 eq "\n" ? $1 : sprintf('\\x%02x', ord($1))/ge;
$str =~ s/([[:cntrl:]])/$1 eq "\n" ? $1 : sprintf '\\x%02x', ord $1/ge;
return $str;
}

Expand Down Expand Up @@ -329,14 +329,14 @@ sub unquote {

sub url_escape {
my ($str, $pattern) = @_;
if ($pattern) { $str =~ s/([$pattern])/sprintf('%%%02X',ord($1))/ge }
else { $str =~ s/([^A-Za-z0-9\-._~])/sprintf('%%%02X',ord($1))/ge }
if ($pattern) { $str =~ s/([$pattern])/sprintf '%%%02X', ord $1/ge }
else { $str =~ s/([^A-Za-z0-9\-._~])/sprintf '%%%02X', ord $1/ge }
return $str;
}

sub url_unescape {
my $str = shift;
$str =~ s/%([0-9a-fA-F]{2})/chr(hex($1))/ge;
$str =~ s/%([0-9a-fA-F]{2})/chr hex $1/ge;
return $str;
}

Expand Down

0 comments on commit acf0baa

Please sign in to comment.