Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to print program usage in Perl?

Tags:

perl

What's the easiest to maintain way of printing a Perl program's usage to stdout? I am looking for heredoc tricks or anything similarly useful. Forget individual successive prints.

EDIT 1: the issue I have faced many times is to have to maintain usage, general script documentation and option processing separately. I was looking for a way to combine some or all of this with minimal overhead. Thanks for the many suggestions. I will accept an answer when I have an opportunity to experiment proposed solutions.

like image 993
Philippe A. Avatar asked Aug 18 '10 19:08

Philippe A.


1 Answers

Pod::Usage maybe? This was suggested by GetOpt::Long.

Getopt::Std::WithCheck allows you to combine the definition of options along a description, and Getopt::Simple does the same.

like image 112
nicomen Avatar answered Sep 24 '22 23:09

nicomen