Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
&& has a higher precedence than ||
  • Loading branch information
kraih committed Mar 12, 2014
1 parent 206138f commit a64a603
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/Mojo/Collection.pm
Expand Up @@ -99,7 +99,7 @@ sub _flatten {
map { _ref($_) ? _flatten(@$_) : $_ } @_;
}

sub _ref { ref $_[0] eq 'ARRAY' || (blessed $_[0] && $_[0]->isa(__PACKAGE__)) }
sub _ref { ref $_[0] eq 'ARRAY' || blessed $_[0] && $_[0]->isa(__PACKAGE__) }

1;

Expand Down
9 changes: 4 additions & 5 deletions lib/Mojo/DOM/HTML.pm
Expand Up @@ -120,12 +120,12 @@ sub parse {
my ($start, $attr) = ($xml ? $1 : lc($1), $2);

# Attributes
my %attrs;
my (%attrs, $closing);
while ($attr =~ /$ATTR_RE/g) {
my ($key, $value) = ($xml ? $1 : lc($1), $2 // $3 // $4);

# Empty tag
next if $key eq '/';
++$closing and next if $key eq '/';

$attrs{$key} = defined $value ? html_unescape($value) : $value;
}
Expand All @@ -136,11 +136,10 @@ sub parse {

# Element without end tag (self-closing)
_end($start, $xml, \$current)
if !$xml && $EMPTY{$start}
or ($xml || !$BLOCK{$start}) && $attr =~ m!/\s*$!;
if !$xml && $EMPTY{$start} || ($xml || !$BLOCK{$start}) && $closing;

# Relaxed "script" or "style" HTML elements
next if $xml || ($start ne 'script' && $start ne 'style');
next if $xml || $start ne 'script' && $start ne 'style';
next unless $html =~ m!\G(.*?)<\s*/\s*$start\s*>!gcsi;
_node($current, 'raw', $1);
_end($start, 0, \$current);
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Message.pm
Expand Up @@ -277,7 +277,7 @@ sub _parse_formdata {

next unless my $disposition = $part->headers->content_disposition;
my ($filename) = $disposition =~ /[; ]filename\s*=\s*"?((?:\\"|[^"])*)"?/i;
next if ($upload && !defined $filename) || (!$upload && defined $filename);
next if $upload && !defined $filename || !$upload && defined $filename;
my ($name) = $disposition =~ /[; ]name\s*=\s*"?((?:\\"|[^";])+)"?/i;
if ($charset) {
$name = decode($charset, $name) // $name if $name;
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Template.pm
Expand Up @@ -59,7 +59,7 @@ sub build {
unless ($multi) {

# Escaped
if (($op eq 'escp' && !$escape) || ($op eq 'expr' && $escape)) {
if ($op eq 'escp' && !$escape || $op eq 'expr' && $escape) {
$lines[-1] .= "\$_M .= _escape";
$lines[-1] .= " scalar $value" if length $value;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Transaction/HTTP.pm
Expand Up @@ -84,7 +84,7 @@ sub _body {

# Finished
$self->{state} = $finish ? 'finished' : 'read'
if $self->{write} <= 0 || (defined $buffer && !length $buffer);
if $self->{write} <= 0 || defined $buffer && !length $buffer;

return defined $buffer ? $buffer : '';
}
Expand Down

0 comments on commit a64a603

Please sign in to comment.