in reply to How to write code perl code to generate html/pdf document of customized API?

Do you want to convert an API documentation to HTML and PDF?

In that case you might want to use pod2html and pod2latex which are both shipped with perl.

If you want to generate HTML and PDF documents with a unified API, you could write a base class that specifies the API, and write two take a look at docbook, which is a kind of unified document format that can be converted to a number of different output formats.

There seems to be some sparse docbook support on CPAN.