]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Admin.pm
replace most uses of PublicInbox::MIME with Eml
[public-inbox.git] / lib / PublicInbox / Admin.pm
index 336b7d4cbf2ee536445072a1bef1fe4534bf894f..2c8d191a7618fa905279a6e07fadfed5419ed7ce 100644 (file)
@@ -71,7 +71,7 @@ sub resolve_inboxes ($;$$) {
        my ($argv, $opt, $cfg) = @_;
        $opt ||= {};
 
-       $cfg //= eval { PublicInbox::Config->new };
+       $cfg //= PublicInbox::Config->new;
        if ($opt->{all}) {
                my $cfgfile = PublicInbox::Config::default_file();
                $cfg or die "--all specified, but $cfgfile not readable\n";
@@ -122,7 +122,7 @@ EOF
 }
 
 # TODO: make Devel::Peek optional, only used for daemon
-my @base_mod = qw(Email::MIME Devel::Peek);
+my @base_mod = qw(Devel::Peek);
 my @over_mod = qw(DBD::SQLite DBI);
 my %mod_groups = (
        -index => [ @base_mod, @over_mod ],
@@ -234,4 +234,15 @@ sub progress_prepare ($) {
        }
 }
 
+# same unit factors as git:
+sub parse_unsigned ($) {
+       my ($max_size) = @_;
+
+       $$max_size =~ /\A([0-9]+)([kmg])?\z/i or return;
+       my ($n, $unit_factor) = ($1, $2 // '');
+       my %u = ( k => 1024, m => 1024**2, g => 1024**3 );
+       $$max_size = $n * ($u{lc($unit_factor)} // 1);
+       1;
+}
+
 1;