empty program arguments do not need to be parsed
[barcat.git] / barcat
diff --git a/barcat b/barcat
index ab5c023398e94300363dfd1a23d991782b8d91e0..8e104c952713538e8dc7ad3d871a40012e4c00de 100755 (executable)
--- a/barcat
+++ b/barcat
@@ -8,8 +8,10 @@ use re '/msx';
 
 our $VERSION = '1.07';
 
-use Getopt::Long '2.33', qw( :config gnu_getopt );
 my %opt;
+if (@ARGV) {
+require Getopt::Long;
+Getopt::Long->import('2.33', qw( :config gnu_getopt ));
 GetOptions(\%opt,
        'ascii|a!',
        'color|c!',
@@ -92,6 +94,7 @@ GetOptions(\%opt,
                );
        },
 ) or exit 64;  # EX_USAGE
+}
 
 $opt{width} ||= $ENV{COLUMNS} || qx(tput cols) || 80 unless $opt{spark};
 $opt{color} //= -t *STDOUT;  # enable on tty