in reply to OLE from CGI - Is it possible?
As you've established, OLE from CGI is most certainly possible. One thing that hasn't been explored in this thread is whether it's a good idea or not.
My main experience with OLE happens to be driving Word and Excel from both CGI and ASP scripts. I have deployed production solutions that used these configurations and they most definitely worked. Having said that, I would not recommend it. This biggest problem is reliability. When you instantiate the word.application object a winword.exe process is started on the server. When you save your file and call the quit method on the application object then the process goes away. Unfortunately, in real life that doesn't always happen. For various reasons, the winword.exe process will sometimes refuse to exit and you'll end up with a stray process on the server taking up megabytes of memory and potentially holding an exclusive lock on some shared resource - forever. If a shared resource is locked, the next request will fail and another process will be left behind. Eventually, the server will crash or you will reboot it before it crashes.
Some of the issues are under your control. For example, there's a flag you can pass to the quit method that tells it to quit even if there are unsaved files open - always use that option. Also, consider what would happen if two requests hit the server at the same time. If you're using shared resources, use locking at the Perl level around the critical bits of code.
Winword.exe is first and foremost a GUI app. If it strikes some unexpected situation, its standard reaction is to pop up a dialog on the server console (eg: "File XXXXX.DOC is in use do you want to open it in read-only mode?") and wait forever. In most cases, the dialog won't be visible, so even if you happened to be at the server console you still couldn't sort it out.
Another hairy area is security. I've seen a number of scripts developed and tested under an Administrative user ID that could not be made to work under an unpriviliged user. Some level of mucking around with DCOMCNFG.EXE is often called for and that stuff is black magic.
If I'm sounding bitter it is because of the battle scars I've earned in the trenches. If you can possibly avoid it, don't go there.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: OLE from CGI - Is it possible?
by relax99 (Monk) on Feb 10, 2003 at 21:35 UTC | |
by grantm (Parson) on Feb 10, 2003 at 22:03 UTC | |
|
Re: Re: OLE from CGI - Is it possible?
by relax99 (Monk) on Jan 30, 2003 at 18:16 UTC |