Question

I've written a convenience library for some scripts I'm working on. It wraps Getopt::Long into something a little simpler, in addition to providing mandatory arguments. As such, the library adds a number of arguments to the script's list of required/possible command line arguments.

Since the script also calls pod2usage on the --help flag, I'd like some way for the library to provide the definitions of each of these flags that it provides to the individual script, so it can be rendered when pod2usage is called.

For instance, with a --dosomething flag added by my library, is there anyway, when I run a.pl --help, it will include both the help definitions provided by a.pl, but also the definitions provided by the library, like that of --dosomething which a.pl may not know about?

Is there any way to accomplish this—to have a library modify a script's POD at runtime?

Was it helpful?

Solution

Unfortunately pod2usage is too static for this purpose. You might look at App::Cmd or Getopt::Long::Descriptive (used by App::Cmd) to get some functionality closer to this.

That said you don't need to use pod2usage to print usage statements, its just a helpful way to dump the scripts own pod.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top