QA

 <  Day Day Up  >  

Q&A

Q1:

Reading and writing Excel documents is great. Is there a way to read and write Microsoft Word documents?

A1:

Not directly. First, you can use Object Linking and Embedding ( OLE ) to remotely control a running copy of Microsoft Word to load a document and retrieve the information you need. Of course, this only works on Windows systems with Word installed, and you'll need the OLE::Win32 module. The module documentation has examples of how to do this.

The other approach is to use a common document format between Word and your programs. The most common is Rich Text Format. Microsoft Word can load and save RTF documents and there are Perl modules for reading and writing RTF documents.

Q2:

How can I put images in my PDF documents?

A2:

The document object has methods for creating images ( image_jpeg , image_gif , and so on) and the graphics handle has a method for placing that image on a page ( gfx ->image ). You can also rotate, skew, and create many kinds of effects for images and text. See the PDF::API2 , PDF::API2:Text , and PDF::API2::Gfx manual pages for details.

Q3:

The web site I'm trying to retrieve information from requires login information to be sent. Can I use LWP::Simple for that?

A3:

Probably not. As your web requests get more and more complex and include cookies, encryption, and HTTP header manipulation, you're going to need the more complete ”but complex ”set of LWP modules ( LWP::UserAgent , HTTP::Cookies , HTTP::Request , WWW::Mechanize , and so on). If you're going to do this regularly, I recommend the book Perl & LWP by Sean Burke.

 <  Day Day Up  >  


SAMS Teach Yourself Perl in 24 Hours
Sams Teach Yourself Perl in 24 Hours (3rd Edition)
ISBN: 0672327937
EAN: 2147483647
Year: 2005
Pages: 241

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net