use warnings;
use base qw(PublicInbox::Inbox);
use PublicInbox::Import;
-use PublicInbox::Filter::Base;
-*REJECT = *PublicInbox::Filter::Base::REJECT;
+use PublicInbox::Filter::Base qw(REJECT);
use constant {
PERM_UMASK => 0,
# TODO: maybe stop supporting this
if ($creat_opt) { # for { nproc => $N }
$self->{-creat_opt} = $creat_opt;
- init_inbox($self) if ($self->{version} || 1) == 1;
+ init_inbox($self) if $self->version == 1;
}
$self;
}
sub init_inbox {
my ($self, $shards, $skip_epoch, $skip_artnum) = @_;
# TODO: honor skip_artnum
- my $v = $self->{version} || 1;
- if ($v == 1) {
+ if ($self->version == 1) {
my $dir = assert_usable_dir($self);
PublicInbox::Import::init_bare($dir);
} else {
sub importer {
my ($self, $parallel) = @_;
- $self->{-importer} ||= do {
- my $v = $self->{version} || 1;
- if ($v == 2) {
- eval { require PublicInbox::V2Writable };
- die "v2 not supported: $@\n" if $@;
- my $opt = $self->{-creat_opt};
- my $v2w = PublicInbox::V2Writable->new($self, $opt);
- $v2w->{parallel} = $parallel;
- $v2w;
- } elsif ($v == 1) {
- my @arg = (undef, undef, undef, $self);
- PublicInbox::Import->new(@arg);
- } else {
- $! = 78; # EX_CONFIG 5.3.5 local configuration error
- die "unsupported inbox version: $v\n";
- }
+ my $v = $self->version;
+ if ($v == 2) {
+ eval { require PublicInbox::V2Writable };
+ die "v2 not supported: $@\n" if $@;
+ my $opt = $self->{-creat_opt};
+ my $v2w = PublicInbox::V2Writable->new($self, $opt);
+ $v2w->{parallel} = $parallel;
+ $v2w;
+ } elsif ($v == 1) {
+ my @arg = (undef, undef, undef, $self);
+ PublicInbox::Import->new(@arg);
+ } else {
+ $! = 78; # EX_CONFIG 5.3.5 local configuration error
+ die "unsupported inbox version: $v\n";
}
}
# v2 keeps msgmap open, which causes conflicts for filters
# such as PublicInbox::Filter::RubyLang which overload msgmap
# for a predictable serial number.
- if ($im && ($self->{version} || 1) >= 2 && $self->{altid}) {
+ if ($im && $self->version >= 2 && $self->{altid}) {
$im->done;
}
$self->{umask} = $umask;
}
+sub cleanup ($) {
+ delete @{$_[0]}{qw(over mm git search)};
+}
+
1;