my $subj = $smsg->subject;
- if (length $subj) {
+ if ($subj ne '') {
$doc->add_term(xpfx('subject') . $subj);
my $path = $self->subject_path($subj);
my $git = PublicInbox::GitCatFile->new($self->{git_dir});
my $latest = $db->get_metadata('last_commit');
- my $range = length $latest ? "$latest..$head" : $head;
+ my $range = $latest eq '' ? $head : "$latest..$head";
$latest = undef;
# get indexed messages
sub _git_config_perm {
my $self = shift;
my $perm = scalar @_ ? $_[0] : _read_git_config_perm($self);
- return PERM_GROUP if (!defined($perm) || !length($perm));
+ return PERM_GROUP if (!defined($perm) || $perm eq '');
return PERM_UMASK if ($perm eq 'umask');
return PERM_GROUP if ($perm eq 'group');
if ($perm =~ /\A(?:all|world|everybody)\z/) {
$s =~ s/^\s*$//sgm;
$s =~ s/\s+\z//s;
- if (length $s) {
+ if ($s ne '') {
# kill per-line trailing whitespace
$s =~ s/[ \t]+$//sgm;
$s .= "\n" unless $s =~ /\n\z/s;
my $mid_href = $mid->as_href;
foreach my $h (qw(From To Cc Subject Date)) {
my $v = $mime->header($h);
- defined($v) && length($v) or next;
+ defined($v) && ($v ne '') or next;
$v = PublicInbox::Hval->new_oneline($v);
if ($h eq 'From') {
foreach my $h (qw(From To Cc)) {
my $v = $mime->header($h);
- defined($v) && length($v) or next;
+ defined($v) && ($v ne '') or next;
my @addrs = Email::Address->parse($v);
foreach my $recip (@addrs) {
my $address = $recip->address;
my $srch = $ctx->{srch} if $ctx;
my $idx = $standalone ? " <a\nhref=\"../../\">index</a>" : '';
if ($idx && $srch) {
- $irt = $mime->header('In-Reply-To') || '';
$mid = mid_compress(mid_clean($mid));
- my $t_anchor = length $irt ? T_ANCHOR : '';
+ my $t_anchor = defined $irt ? T_ANCHOR : '';
+ $irt = $mime->header('In-Reply-To');
$idx = " <a\nhref=\"../../t/$mid/$t_anchor\">".
"threadlink</a>$idx";
my $res = $srch->get_followups($mid);
} else {
$idx .= "\n(no followups, yet)\n";
}
- if ($irt) {
+ if (defined $irt) {
$irt = PublicInbox::Hval->new_msgid($irt);
$irt = $irt->as_href;
$irt = "<a\nhref=\"../$irt/\">parent</a> ";
my $mid = $x->header('Message-ID');
my $pfx = ' ' x $level;
$$dst .= $pfx;
+
+ # Subject is never undef, this mail was loaded from
+ # our Xapian which would've resulted in '' if it were
+ # really missing (and Filter rejects empty subjects)
my $s = $x->header('Subject');
my $h = $root->[2]->subject_path($s);
if ($root->[1]->{$h}) {
- $s = '';
+ $s = undef;
} else {
$root->[1]->{$h} = 1;
$s = PublicInbox::Hval->new($s);
$m = '../' . $m->as_href . '/';
$f = $f->as_html;
$d = $d->as_html . ' UTC';
- if (length($s) == 0) {
- $$dst .= "` <a\nhref=\"$m\">$f @ $d</a>\n";
- } else {
+ if (defined $s) {
$$dst .= "` <a\nhref=\"$m\">$s</a>\n" .
"$pfx by $f @ $d\n";
+ } else {
+ $$dst .= "` <a\nhref=\"$m\">$f @ $d</a>\n";
}
}
}
} else {
# Ensure emergency spam gets spamassassin headers.
# This makes it easier to prioritize obvious spam from less obvious
- if (defined($filtered) && length($filtered)) {
+ if (defined($filtered) && $filtered ne '') {
my $drop = Email::MIME->new(\$filtered);
$filtered = undef;
$filter->simple($drop);
run([qw/spamc -E --headers/], \$orig, $out);
};
- return ($@ || $? || !defined($$out) || length($$out) == 0) ? 0 : 1;
+ return ($@ || $? || !defined($$out) || $$out eq '') ? 0 : 1;
}
sub search_index_sync {