http://www.perlmonks.org?node_id=270794

Foggy Bottoms has asked for the wisdom of the Perl Monks concerning the following question:

Has anyone already written a little script that'd take pl/pm files and insert them in a Word document, format the resulting text by changing font, adding color for comments and so on in order to quickly write up a report.
If not, I've started doing so and will put up the source shortly when it's fully functional (it may not be of any use to you wisest monks but to those of us who still study we still have reports to turn in and reediting code in Word is a time consuming pain in the neck)
Let me know what you think.

Replies are listed 'Best First'.
Re: Code formatting
by Corion (Patriarch) on Jul 02, 2003 at 13:55 UTC

    My approach to this would be to take one of the better Perl code highlighters that output HTML, and import that HTML into the Word document, best by automating Word via Win32::OLE instead of a manual process, to keep the document and the code in sync. You could also try whether master documents (or central documents) work with file types different from .doc...

    perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web
Re: Code formatting
by crouchingpenguin (Priest) on Jul 02, 2003 at 15:01 UTC

    Not straight to Word, but you can use vim to output html. A quick Super Search revealed this node.

    Update: or here, here, or here.


    cp
    ----
    "Never be afraid to try something new. Remember, amateurs built the ark. Professionals built the Titanic."
Re: Code formatting
by hsmyers (Canon) on Jul 02, 2003 at 17:26 UTC

    PerlTidy has an output option of colored html that you might want to look into.

    --hsm

    "Never try to teach a pig to sing...it wastes your time and it annoys the pig."
Re: Code formatting
by TVSET (Chaplain) on Jul 02, 2003 at 21:53 UTC