]> diplodocus.org Git - minc/commitdiff
quick hack to make inc require-able
authorepg <epg@pretzelnet.org>
Thu, 17 Apr 2014 04:46:30 +0000 (21:46 -0700)
committerepg <epg@pretzelnet.org>
Thu, 17 Apr 2014 04:46:30 +0000 (21:46 -0700)
TODO: Take this further; lots of global code scattered around, including some
that runs mh commands.

minc

diff --git a/minc b/minc
index 1642c46..1d7a4c2 100755 (executable)
--- a/minc
+++ b/minc
@@ -95,6 +95,7 @@ my $maxmsgs;
 my $norun;
 my $rebuild_dot_folders;
 
 my $norun;
 my $rebuild_dot_folders;
 
+if (!caller()) {
 GetOptions(
            'd' => \$dumpfilters,
            'h|help' => \$help,
 GetOptions(
            'd' => \$dumpfilters,
            'h|help' => \$help,
@@ -104,6 +105,7 @@ GetOptions(
           ) or pod2usage();
 $help and pod2usage(-exitstatus=>0, -verbose=>1);
 @ARGV == 0 or pod2usage();
           ) or pod2usage();
 $help and pod2usage(-exitstatus=>0, -verbose=>1);
 @ARGV == 0 or pod2usage();
+}
 
 our $run = !$norun;
 
 
 our $run = !$norun;
 
@@ -782,7 +784,7 @@ sub scan_spam {
 }
 
 \f
 }
 
 \f
-MAIN: {
+if (!caller()) {
     my $st;
 
     if ($dumpfilters) {
     my $st;
 
     if ($dumpfilters) {
@@ -811,6 +813,8 @@ MAIN: {
     scan_spam();
 }
 
     scan_spam();
 }
 
+1;
+
 \f
 __END__
 
 \f
 __END__