Mail-SpamAssassin
view release on metacpan or search on metacpan
lib/Mail/SpamAssassin/ArchiveIterator.pm view on Meta::CPAN
$info->{$offset} = Mail::SpamAssassin::Util::receive_date($header);
}
# go onto the next message
seek($fh, $offset + $size, 0)
or die "cannot reposition file to $offset + $size: $!";
}
else {
die "archive-iterator: error: failure to read message body!\n";
}
}
defined $_ || $!==0 or
$!==EBADF ? dbg("archive-iterator: error reading: $!")
: die "error reading: $!";
close $fh or die "error closing input file: $!";
}
while(my($k,$v) = each %{$info}) {
if (defined $AICache && !$count) {
$AICache->update($k, $v);
}
if ($self->{determine_receive_date}) {
next if !$self->_message_is_useful_by_date($v);
}
next if !$self->_scanprob_says_scan();
&{$bkfunc}($self, $v, $class, 'b', "$file.$k");
}
if (defined $AICache) {
$AICache = $AICache->finish();
}
}
}
############################################################################
sub _bump_scan_progress {
my ($self) = @_;
if (exists $self->{scan_progress_sub}) {
return unless ($self->{scan_progress_counter}++ % 50 == 0);
$self->{scan_progress_sub}->();
}
}
############################################################################
{
my $home;
sub _fix_globs {
my ($self, $path) = @_;
unless (defined $home) {
$home = $ENV{'HOME'};
# No $HOME set? Try to find it, portably.
unless ($home) {
if (!Mail::SpamAssassin::Util::am_running_on_windows()) {
$home = (Mail::SpamAssassin::Util::portable_getpwuid($<))[7];
} else {
my $vol = $ENV{'HOMEDRIVE'} || 'C:';
my $dir = $ENV{'HOMEPATH'} || '\\';
$home = File::Spec->catpath($vol, $dir, '');
}
# Fall back to no replacement at all.
$home ||= '~';
}
}
$path =~ s,^~/,${home}/,;
# protect/escape spaces: ./Mail/My Letters => ./Mail/My\ Letters
$path =~ s/(?<!\\)(\s)/\\$1/g;
# return csh-style globs: ./corpus/*.mbox => er, you know what it does ;)
return glob($path);
}
}
sub _create_cache {
my ($self, $type, $path) = @_;
if ($self->{opt_cache}) {
$AICache = Mail::SpamAssassin::AICache->new({
'type' => $type,
'prefix' => $self->{opt_cachedir},
'path' => $path,
});
}
}
############################################################################
1;
__END__
=back
=head1 SEE ALSO
Mail::SpamAssassin(3)
spamassassin(1)
mass-check(1)
=cut
# vim: ts=8 sw=2 et
( run in 2.502 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )