EH> What's the best or correct way to get a Perl program to handle the -h
EH> option (through getopts) by outputting its own perldoc documentation
EH> to the terminal?
EH> If
EH> exec("perldoc", $0) if ($option{h});
EH> works fine, why make things more complicated than necessary?
EH> What are the advantages of using the CPAN POD modules when all I want
EH> is to show something that looks like a man page?
a short list:
$0 isn't alway correct as it can be modified on some OS's
it forks off a process (actually execs) which is slower. but
speed isn't usually an issue here.
perldoc may not be in your path or even installed in
bin. modules are more likely to be where you put them.
the pod modules that do this type of thing can do more than just
run perldoc.
some pod munging modules can even generate the arg parsing stuff
for you from the pod. damian conway wrote such a module.
i am sure i could find other reasons. anyhow you do what you want. just
check out cpan for them. you might be surprised and end up using one of
them.
uri