Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to explain GetOptions usage?

I have a script which takes 3 input variables from CLI and insert it to 3 variables respectively:

GetOptions("old_path=s" => \$old_path,
       "var=s"      => \$var,
       "new_path=s" => \$new_path,
       "log_path=s" => \$log_path)
or die ("Error in input variables\n");

Is there a way in which I can add a subroutine or any other GetOptions parameter which explains how to give the input variables?

like image 948
deep Avatar asked Feb 01 '26 21:02

deep


1 Answers

The standard way in Perl is to use Pod::Usage as recommended in Getopt::Long. A complete example is shown in Documentation and help texts

like image 77
toolic Avatar answered Feb 03 '26 10:02

toolic