From 93561ca90a60a3564ae98bf879ce930579ec7608 Mon Sep 17 00:00:00 2001 From: Dan Church Date: Sun, 28 Aug 2022 14:22:18 -0500 Subject: [PATCH] Use POD to generate help messages Also, exit instead of continuing when an unrecognized option flag is seen. --- simplify_static_dir.pl | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/simplify_static_dir.pl b/simplify_static_dir.pl index 8d6aade..db4a243 100755 --- a/simplify_static_dir.pl +++ b/simplify_static_dir.pl @@ -102,29 +102,22 @@ Written by Dan Church Samphetamachine@gmail.comE> use File::Find qw/ find /; use Getopt::Std qw/ getopts /; +use Pod::Usage qw/ pod2usage /; sub HELP_MESSAGE { my $fh = shift; - print $fh < 1, + -exitval => 0, + ); } MAIN: { - &getopts('vfm:M:z', \ my %opts); + &getopts('vfm:M:z', \ my %opts) + || &pod2usage( + -exitval => 2, + -msg => "Try '$0 --help' for more information", + ); my $verbose = defined $opts{v}; my $print_freed = defined $opts{f};