[31156] in Perl-Users-Digest
Perl-Users Digest, Issue: 2401 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 8 00:14:25 2009
Date: Thu, 7 May 2009 21:14:15 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 7 May 2009 Volume: 11 Number: 2401
Today's topics:
Re: opening a client application from a server? <smallpond@juno.com>
Re: opening a client application from a server? <cartercc@gmail.com>
Re: opening a client application from a server? <jurgenex@hotmail.com>
Re: opening a client application from a server? <cartercc@gmail.com>
Re: opening a client application from a server? <1usa@llenroc.ude.invalid>
Re: opening a client application from a server? <1usa@llenroc.ude.invalid>
Re: opening a client application from a server? <jurgenex@hotmail.com>
Re: opening a client application from a server? <cartercc@gmail.com>
Re: opening a client application from a server? <jurgenex@hotmail.com>
Re: opening a client application from a server? <cartercc@gmail.com>
Re: opening a client application from a server? <jurgenex@hotmail.com>
Re: opening a client application from a server? <1usa@llenroc.ude.invalid>
Re: opening a client application from a server? <cartercc@gmail.com>
Re: opening a client application from a server? <tadmc@seesig.invalid>
Re: opening a client application from a server? <cartercc@gmail.com>
Re: opening a client application from a server? <1usa@llenroc.ude.invalid>
Re: opening a client application from a server? <veatchla@yahoo.com>
Re: printing html with perl <cartercc@gmail.com>
Re: printing html with perl <1usa@llenroc.ude.invalid>
Re: writing get_script() <cwilbur@chromatico.net>
Re: writing get_script() <cartercc@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 7 May 2009 14:40:13 -0700 (PDT)
From: smallpond <smallpond@juno.com>
Subject: Re: opening a client application from a server?
Message-Id: <06823282-53b0-4adb-96ab-2a5a7fe920f0@z7g2000vbh.googlegroups.com>
On May 7, 4:00=A0pm, Tad J McClellan <ta...@seesig.invalid> wrote:
> ccc31807 <carte...@gmail.com> wrote:
> > Here's the question: The client has a requirement that the users
> > create a Word document on a web enabled app and open it in the client
> > browser. I can create the word document and open it on the server
> > (using this command -- exec("c:/Program Files/Microsoft Office/
> > OFFICE12/winword.exe", "c:/TEST1.DOC")) but I can't get Word to open
> > the file on the client.
>
> If I'm understanding you correctly, then you do not have a Perl problem.
>
> If you send the appropriate (application/word?) Content-Type, then a
> client on Windows, with Word installed, should be able to open it
> no problem.
>
Here's an example showing the headers which IE opens fine:
wget -S http://www.ahrq.gov/QUAL/diabqguide.doc
--17:36:37-- http://www.ahrq.gov/QUAL/diabqguide.doc
Resolving www.ahrq.gov... 77.67.91.107
Connecting to www.ahrq.gov|77.67.91.107|:80... connected.
HTTP request sent, awaiting response...
HTTP/1.0 200 OK
Content-Length: 1694208
Content-Type: application/msword
Last-Modified: Fri, 30 May 2008 17:20:13 GMT
Accept-Ranges: bytes
ETag: "10bb8b6b79c2c81:6b7"
Server: Microsoft-IIS/6.0
p3p: CP=3D"NOI ADM DEV PSAi COM NAV OUR OTR STP IND DEM"
X-Powered-By: ASP.NET
Date: Thu, 07 May 2009 21:36:37 GMT
Connection: keep-alive
Length: 1694208 (1.6M) [application/msword]
Saving to: `diabqguide.doc.1'
------------------------------
Date: Thu, 7 May 2009 17:31:32 -0700 (PDT)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: opening a client application from a server?
Message-Id: <8ddc1ceb-ee72-47f6-82fc-42857772cd20@h23g2000vbc.googlegroups.com>
On May 7, 4:00=A0pm, Tad J McClellan <ta...@seesig.invalid> wrote:
>
> If I'm understanding you correctly, then you do not have a Perl problem.
It's very possible that it's an Apache problem, but maybe not. I can
invoke Word and open the .doc file in an ordinary Perl script, like
this: eval("c:/.../winword.exe" "c:/.../wordprocessingml.doc")
However, it doesn't work in a CGI script, and frankly I don't know
enough about Windows to troubleshoot it. I'm meeting with my client
tomorrow morning, and either I'll get it to work before then or I'll
suggest some alternatives.
> If you send the appropriate (application/word?) Content-Type, then a
> client on Windows, with Word installed, should be able to open it
> no problem.
My job entails producing a lot of reports in various formats (csv,
pdf, txt, etc) and I have a lot of experience giving users access to
these formats. Producing the Word document with WPML was easy, but now
I'm stuck with producing files that I can't seen to open. Ignorance
isn't bliss!
CC
------------------------------
Date: Thu, 07 May 2009 17:46:29 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: opening a client application from a server?
Message-Id: <fvv605lft84e54bipn0bu58dhate1a24i6@4ax.com>
ccc31807 <cartercc@gmail.com> wrote:
>On May 7, 4:00 pm, Tad J McClellan <ta...@seesig.invalid> wrote:
>>
>> If I'm understanding you correctly, then you do not have a Perl problem.
>
>It's very possible that it's an Apache problem, but maybe not.
No, it's not an Apache problem, either. It's an HTTP problem.
>I can
>invoke Word and open the .doc file in an ordinary Perl script, like
>this: eval("c:/.../winword.exe" "c:/.../wordprocessingml.doc")
>
>However, it doesn't work in a CGI script, and frankly I don't know
Oh yes, it does work in a CGI script. Given proper permissions the
script will/should happily invoke Word ---- on the server! Most likely
not what you had in mind.
>enough about Windows to troubleshoot it.
Has nothing to do with Windows but everything with how HTTP works.
>I'm meeting with my client
>tomorrow morning, and either I'll get it to work before then or I'll
>suggest some alternatives.
>
>> If you send the appropriate (application/word?) Content-Type, then a
>> client on Windows, with Word installed, should be able to open it
>> no problem.
>
>My job entails producing a lot of reports in various formats (csv,
>pdf, txt, etc) and I have a lot of experience giving users access to
>these formats. Producing the Word document with WPML was easy, but now
>I'm stuck with producing files that I can't seen to open. Ignorance
>isn't bliss!
So, what Content-Type did you try?
jue
------------------------------
Date: Thu, 7 May 2009 18:16:47 -0700 (PDT)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: opening a client application from a server?
Message-Id: <4c64ae79-ab17-46bd-8c6e-e36a60732dc8@g20g2000vba.googlegroups.com>
jue, thanks for your comments.
On May 7, 8:46=A0pm, J=FCrgen Exner <jurge...@hotmail.com> wrote:
> No, it's not an Apache problem, either. It's an HTTP problem.
This is what I can't understand. I import a big glob of data from a
database into my script, generate many csv files, or txt files, or pdf
files, or xml file, etc., and generate links. The browsers, IE but FF
as well will happily open a csv file in Excel (assuming that the
client is a Windows machine with Office installed), open a pdf file in
Acrobat, open a txt file in the browser window, and so on.
I ASSUMED(!) that a doc file would work the same way, that is, open
natively in Word on a machine running Office. It doesn't, and I don't
know enough to understand why it doesn't.
> Oh yes, it does work in a CGI script. Given proper permissions the
> script will/should happily invoke Word ---- on the server! Most likely
> not what you had in mind.
Right. What I had in mind was writing an OUTFILE to a directory and
creating a link to the file. I frequently create HTML files
dynamically from a script (similar to what I suppose eBay, Amazon,
Google, and all the rest do) and the links work flawlessly. Invoking
Word on the server is useless, you are right about that.
> Has nothing to do with Windows but everything with how HTTP works.
> So, what Content-Type did you try?
I didn't. When I produce csv, pdf, etc., I don't specify any Content-
Type. I just create the files and they open the way they should. XML
is very picky, and Word demands a PERFECT(!) XML file to open,
otherwise it throws an error, and I suspect that an attempt to
incorporate a Content-Type element in the XML would create a problem.
Besides, I don't understand why a Content-Type is necessary.
I don't mind admitting ignorance, but I'm not stupid, and I do learn
-- slowly but surely.
CC
------------------------------
Date: Fri, 08 May 2009 01:36:43 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: opening a client application from a server?
Message-Id: <Xns9C04DBD74FE17asu1cornelledu@127.0.0.1>
ccc31807 <cartercc@gmail.com> wrote in
news:8ddc1ceb-ee72-47f6-82fc-42857772cd20@h23g2000vbc.googlegroups.com:
> On May 7, 4:00 pm, Tad J McClellan <ta...@seesig.invalid> wrote:
>>
>> If I'm understanding you correctly, then you do not have a Perl
>> problem.
>
> It's very possible that it's an Apache problem, but maybe not. I can
> invoke Word and open the .doc file in an ordinary Perl script, like
> this: eval("c:/.../winword.exe" "c:/.../wordprocessingml.doc")
What is this new wave of people thinking that a web server can invoke a
specific application on a client computer?
I am simply blown by this failure to grasp the most basic elements of
how things fit together.
> However, it doesn't work in a CGI script, and frankly I don't know
> enough about Windows to troubleshoot it.
You do not need to know anything about Windows.
>> If you send the appropriate (application/word?) Content-Type, then a
>> client on Windows, with Word installed, should be able to open it
>> no problem.
>
> My job entails producing a lot of reports in various formats (csv,
> pdf, txt, etc) and I have a lot of experience giving users access to
> these formats.
How is a Word document different from any of those formats? Tad has just
told you how to solve your problem.
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/
------------------------------
Date: Fri, 08 May 2009 01:48:33 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: opening a client application from a server?
Message-Id: <Xns9C04DDD8DBDE7asu1cornelledu@127.0.0.1>
"A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in
news:Xns9C04DBD74FE17asu1cornelledu@127.0.0.1:
> I am simply blown by this failure ...
^
away
*Sigh*
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/
------------------------------
Date: Thu, 07 May 2009 18:52:18 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: opening a client application from a server?
Message-Id: <vp370513v0nm7hqhimp1h2iprdodst4532@4ax.com>
ccc31807 <cartercc@gmail.com> wrote:
>jue, thanks for your comments.
>
>On May 7, 8:46 pm, Jürgen Exner <jurge...@hotmail.com> wrote:
>> No, it's not an Apache problem, either. It's an HTTP problem.
>
>This is what I can't understand. I import a big glob of data from a
>database into my script, generate many csv files, or txt files, or pdf
>files, or xml file, etc., and generate links. The browsers, IE but FF
>as well will happily open a csv file in Excel (assuming that the
>client is a Windows machine with Office installed), open a pdf file in
>Acrobat, open a txt file in the browser window, and so on.
Which IMNSHO is a major mistake of the browser. The browser should never
assume a file type based on the last 3 characters of a file name.
>I ASSUMED(!) that a doc file would work the same way, that is, open
>natively in Word on a machine running Office. It doesn't, and I don't
>know enough to understand why it doesn't.
>
>> Has nothing to do with Windows but everything with how HTTP works.
>> So, what Content-Type did you try?
>
>I didn't. When I produce csv, pdf, etc., I don't specify any Content-
>Type. I just create the files and they open the way they should. XML
>is very picky, and Word demands a PERFECT(!) XML file to open,
>otherwise it throws an error, and I suspect that an attempt to
>incorporate a Content-Type element in the XML would create a problem.
You don't incorporate it into the XML, you set the Content-Type in the
HTTP response header just as Tad explained already.
And no, it really has nothing to do with Perl.
>Besides, I don't understand why a Content-Type is necessary.
Because it tells the browser what to do with that particular HTTP
response.
jue
------------------------------
Date: Thu, 7 May 2009 19:01:09 -0700 (PDT)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: opening a client application from a server?
Message-Id: <66939dbc-6494-401f-809a-5a8d927a41bc@z19g2000vbz.googlegroups.com>
> > I am simply blown by this failure ...
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0^
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 away
>
> *Sigh*
Reminds me of a very crude example of how capitalization or the lack
thereof can change the meaning, as in, "I helped my Uncle Jack off a
horse."
CC
------------------------------
Date: Thu, 07 May 2009 19:09:50 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: opening a client application from a server?
Message-Id: <eq4705dectb07svkiodfqgp84sbb4nfa5n@4ax.com>
Jürgen Exner <jurgenex@hotmail.com> wrote:
>ccc31807 <cartercc@gmail.com> wrote:
>>jue, thanks for your comments.
>>
>>On May 7, 8:46 pm, Jürgen Exner <jurge...@hotmail.com> wrote:
>>> No, it's not an Apache problem, either. It's an HTTP problem.
>>
>>This is what I can't understand. I import a big glob of data from a
>>database into my script, generate many csv files, or txt files, or pdf
>>files, or xml file, etc., and generate links. The browsers, IE but FF
>>as well will happily open a csv file in Excel (assuming that the
>>client is a Windows machine with Office installed), open a pdf file in
>>Acrobat, open a txt file in the browser window, and so on.
>
>Which IMNSHO is a major mistake of the browser. The browser should never
>assume a file type based on the last 3 characters of a file name.
[...]
>>Besides, I don't understand why a Content-Type is necessary.
>
>Because it tells the browser what to do with that particular HTTP
>response.
Following up on my own post:
You may want to check the configuration of your brower(s).
In Firefox see "Options" -> "Applications".
For me "Microsoft Word Document" is set to "Always ask" and that's
exactly what my Firefox does, I just tested it. Uploading a FooBar.doc
file to a web site, accessing the corresponding URL in Firefox and a
dialog pops up asking what Firefox should do with that file, open it, in
which application, or saving it.
jue
------------------------------
Date: Thu, 7 May 2009 19:22:32 -0700 (PDT)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: opening a client application from a server?
Message-Id: <5d587e15-cc5d-4920-be51-3df450ffc41d@v4g2000vba.googlegroups.com>
On May 7, 9:36=A0pm, "A. Sinan Unur" <1...@llenroc.ude.invalid> wrote:
> What is this new wave of people thinking that a web server can invoke a
> specific application on a client computer?
It's not the web server that invokes the application on the client.
The client requests a file, the server sends the file if it's there,
and the client is responsible for finding the correct application to
open the file. You can request all sorts of documents from a web
server: gif, jpg, wav, avi, mpeg, mp3, txt, html, xml, pdf, rtf, and
so on. All the web server does is deliver the file. It's up to the
client to do something with it.
> How is a Word document different from any of those formats? Tad has just
> told you how to solve your problem.
Okay, maybe I am dense. Let's say I produce the following file like
this, which will place a file named 'outfile.xml' in the current
directory:
open OUTFILE, '>', 'outfile.xml';
print OUTFILE qq(<?xml version=3D"1.0" encoding=3D"utf-8" ?>
<document>
<name>
<first>Barack</first>
<middle>H.</middle>
<last>Obama</last>
</name>
<occupation>President</occupation>
</document>);
close OUTFILE;
If I create a hyperlink on an HTML page, like
<a href=3D"outfile.xml">XML DOC</a>
a user can click the link, and the web server will return outfile.xml
to the browser.
If I give the file an xls extension, on a Windows machine running IE
the file will open in Excel.
I just don't understand where I should specify the content type. BTW,
I have done something like this every day for years, sometimes
producing as many as several hundred files, and I've never, not once,
specified a content type. Either I've been real, real lucky, or I
don't need to specify a content type.
I'm not trying to be abusive or ugly or insulting or obstinate. I just
don't understand, and I'm asking for help.
Thanks, CC.
------------------------------
Date: Thu, 07 May 2009 19:33:41 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: opening a client application from a server?
Message-Id: <p86705lfkhpd0881k2r5vk972j2ch1cdjo@4ax.com>
ccc31807 <cartercc@gmail.com> wrote:
>On May 7, 9:36 pm, "A. Sinan Unur" <1...@llenroc.ude.invalid> wrote:
>> What is this new wave of people thinking that a web server can invoke a
>> specific application on a client computer?
>
>It's not the web server that invokes the application on the client.
>The client requests a file, the server sends the file if it's there,
>and the client is responsible for finding the correct application to
>open the file. You can request all sorts of documents from a web
>server: gif, jpg, wav, avi, mpeg, mp3, txt, html, xml, pdf, rtf, and
>so on. All the web server does is deliver the file. It's up to the
>client to do something with it.
And exactly there was the big misunderstanding. Everyone else was
assuming you were talking about an embedded document.
>> How is a Word document different from any of those formats? Tad has just
>> told you how to solve your problem.
Actually Tad's solution won't work with those plain files, just like
mine and Sinan's won't.
As you said yourself, it is a client configuration thing, the browser
must be configured to open MS Word.
In FireFox it's "Options" -> "Applications", in other browsers it's
probably some other location.
jue
------------------------------
Date: Fri, 08 May 2009 02:44:41 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: opening a client application from a server?
Message-Id: <Xns9C04E75CE693Dasu1cornelledu@127.0.0.1>
ccc31807 <cartercc@gmail.com> wrote in
news:5d587e15-cc5d-4920-be51-3df450ffc41d@v4g2000vba.googlegroups.com:
> On May 7, 9:36 pm, "A. Sinan Unur" <1...@llenroc.ude.invalid> wrote:
>> What is this new wave of people thinking that a web server can invoke
>> a specific application on a client computer?
>
> It's not the web server that invokes the application on the client.
Exactly. However, you snipped what you said in your post. My response
above was directed to the following nonsensical remark by you:
>>> It's very possible that it's an Apache problem, but maybe not. I can
>>> invoke Word and open the .doc file in an ordinary Perl script, like
>>> this: eval("c:/.../winword.exe" "c:/.../wordprocessingml.doc")
1. What is eval doing there?
2. You are mentioning this in the context of a CGI script running
on a web server.
>> How is a Word document different from any of those formats? Tad has
>> just told you how to solve your problem.
>
> Okay, maybe I am dense. Let's say I produce the following file like
> this, which will place a file named 'outfile.xml' in the current
> directory:
Are you going to create a file for every request?
> open OUTFILE, '>', 'outfile.xml';
> print OUTFILE qq(<?xml version="1.0" encoding="utf-8" ?>
> <document>
> <name>
> <first>Barack</first>
> <middle>H.</middle>
> <last>Obama</last>
> </name>
> <occupation>President</occupation>
> </document>);
> close OUTFILE;
>
> If I create a hyperlink on an HTML page, like
> <a href="outfile.xml">XML DOC</a>
> a user can click the link, and the web server will return outfile.xml
> to the browser.
This is just silly. Just provide the appropriate response headers
and content in your response.
But then, you are the one keeps insisting that writing code without a
plan or design to 'get things done' is the right strategy.
Now, you want others to help you make money because you haven't
done your homework and you are up against a deadline.
Well ...
What you are asking would be implemented in exactly the same way
in all languages. Your question is not about Perl.
Here is your fish. Enjoy.
#!/usr/bin/perl
use strict;
use warnings;
use CGI::Simple;
my $cgi = CGI::Simple->new;
print $cgi->header(
-type => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
-attachment => 'report.docx',
),
<<EO_DOCX;
<?xml version="1.0"?>
<?mso-application progid="Word.Document"?>
<w:wordDocument
xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml">
<w:body>
<w:p>
<w:r>
<w:t>Hello, World.</w:t>
</w:r>
</w:p>
</w:body>
</w:wordDocument>
EO_DOCX
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/
------------------------------
Date: Thu, 7 May 2009 19:54:21 -0700 (PDT)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: opening a client application from a server?
Message-Id: <d9127174-c280-4bb1-9715-88b2adc27246@u10g2000vbd.googlegroups.com>
On May 7, 10:33=A0pm, J=FCrgen Exner <jurge...@hotmail.com> wrote:
> And exactly there was the big misunderstanding. Everyone else was
> assuming you were talking about an embedded document.
This is my fault. I should have been clearer. The requirement is to
produce a Word document merging data obtained as a result of querying
a database with a template, so that the user can open the file in Word
and edit it if necessary. I'm using the browser as the interface to
the database, and the client wants to use a hyperlink to allow the
user to open the document.
> As you said yourself, it is a client configuration thing, the browser
> must be configured to open MS Word.
> In FireFox it's "Options" -> "Applications", in other browsers it's
> probably some other location.
Thanks for the suggestion. I'll try it in the morning.
CC.
------------------------------
Date: Thu, 7 May 2009 21:54:04 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: opening a client application from a server?
Message-Id: <slrnh077mc.tcp.tadmc@tadmc30.sbcglobal.net>
ccc31807 <cartercc@gmail.com> wrote:
> Let's say I produce the following file like
> this,
How the file is produced in not relevant, so I snipped it.
> If I create a hyperlink on an HTML page, like
><a href="outfile.xml">XML DOC</a>
> a user can click the link, and the web server will return outfile.xml
> to the browser.
>
> If I give the file an xls extension, on a Windows machine running IE
> the file will open in Excel.
Sounds like your server is not configured to know what content
type goes with an extension of .doc.
> I just don't understand where I should specify the content type.
In the HTTP headers, specifically in a header named "Content-Type".
If you have a CGI program where you've slurped in the contents of
the Word file into $doc, then this should do it:
print "Content-Type: application/msword\n\n";
print $doc;
If it is a static link like in your example above, then you must
have your server configured to send the correct Content-Type header.
My apache, for instance, uses the /etc/mime.types file
to associate a file extension with a content-type.
grep msword /etc/mime.types
finds:
application/msword doc
If the CGI approach above works, yet the link approach does not work,
then you can be pretty sure that the root cause of your problem has to
do with web server configuration.
It most certainly has nothing to do with Perl...
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Thu, 7 May 2009 20:15:51 -0700 (PDT)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: opening a client application from a server?
Message-Id: <625c32aa-1068-40e8-bb0c-fc025a4208ce@o20g2000vbh.googlegroups.com>
On May 7, 10:44=A0pm, "A. Sinan Unur" <1...@llenroc.ude.invalid> wrote:
> 1. What is eval doing there?
Sorry for the confusion. This is actually from an old script that
opened Word for another purpose, and I (perhaps confusedly)
resurrected it as a desperate measure.
> 2. You are mentioning this in the context of a CGI script running
> =A0 =A0on a web server.
Yes, see my reply to jue.
> But then, you are the one keeps insisting that writing code without a
> plan or design to 'get things done' is the right strategy.
I don't recall ever saying this. I have stated that I use ad hoc
methods for short scripts less than about 50 lines or so. but this is
different from just throwing code on the wall to see if any sticks.
Once you write the same code several hundred times, you don't need to
plan it -- you can do it in your sleep.
> Now, you want others to help you make money because you haven't
> done your homework and you are up against a deadline.
Hey, any port in a storm. ;-)
> Here is your fish. Enjoy.
Which defeats the purpose. I'm /NOT/ writing a script to produce an
output file for a web server. I /AM/ producing the output file to
write to the file system. The 'eval' point you made above came from a
script that (1) queried a database, (2) parsed the data and stuffed it
into a hash, (3) created the outfile from the data, (4) invoked Word,
and (5) exited. It wasn't a CGI script and didn't use a browser for an
interface, but was run from the command line and didn't involve a web
server.
Anyway, Sinan, thanks for your help. I haven't run your code, but am
curious if it will actually work in Word 2007. So far, I haven't
gotten Word to open a document produced with WPML with a docx
extension, but Word 2007 works fine with a plain doc extension.
CC.
------------------------------
Date: Fri, 08 May 2009 03:37:18 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: opening a client application from a server?
Message-Id: <Xns9C04F048CAADCasu1cornelledu@127.0.0.1>
ccc31807 <cartercc@gmail.com> wrote in news:625c32aa-1068-40e8-bb0c-
fc025a4208ce@o20g2000vbh.googlegroups.com:
> On May 7, 10:44 pm, "A. Sinan Unur" <1...@llenroc.ude.invalid> wrote:
>> Here is your fish. Enjoy.
>
> Which defeats the purpose. I'm /NOT/ writing a script to produce an
> output file for a web server.
Huh? Are you playing games here?
The subject line says:
Re: opening a client application from a server?
In addition, your original post states clearly:
>>> ccc31807 <cartercc@gmail.com> wrote in news:c64106fd-a0b6-4361-a72a-
88f2f97a2ec2@m24g2000vbp.googlegroups.com:
>>> as easy as writing a CGI script and dynamically updating the
>>> HTML from a database. WordProcessingML is no different from
>>> XHTML and does pretty good at creating Word documents.
>>>
>>> Here's the question: The client has a requirement that the users
>>> create a Word document on a web enabled app and open it in the
>>> client browser. I can create the word document and open it on the
>>> server (using this command -- exec("c:/Program Files/Microsoft
>>> Office/ OFFICE12/winword.exe", "c:/TEST1.DOC")) but I can't get Word
>>> to open the file on the client. I can write the .doc file to a
>>> directory and give the client to the directory over the internet,
>>> but that doesn't meet the requirement.
> I /AM/ producing the output file to write to the file system.
Which file system? Where do you think your client is going to save the
file after s/he has edited it?
> I haven't run your code, but am curious if it will actually work in
> Word 2007.
I don't know. I have Word 2003.
And, of course, I tested the script before posting it.
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/
------------------------------
Date: Thu, 07 May 2009 22:57:57 -0500
From: l v <veatchla@yahoo.com>
Subject: Re: opening a client application from a server?
Message-Id: <puGdnTuWjL5VMJ7XnZ2dnUVZ_hydnZ2d@supernews.com>
ccc31807 wrote:
> On May 7, 10:44 pm, "A. Sinan Unur" <1...@llenroc.ude.invalid> wrote:
>> 1. What is eval doing there?
>
> Sorry for the confusion. This is actually from an old script that
> opened Word for another purpose, and I (perhaps confusedly)
> resurrected it as a desperate measure.
>
>> 2. You are mentioning this in the context of a CGI script running
>> on a web server.
>
> Yes, see my reply to jue.
>
>> But then, you are the one keeps insisting that writing code without a
>> plan or design to 'get things done' is the right strategy.
>
> I don't recall ever saying this. I have stated that I use ad hoc
> methods for short scripts less than about 50 lines or so. but this is
> different from just throwing code on the wall to see if any sticks.
> Once you write the same code several hundred times, you don't need to
> plan it -- you can do it in your sleep.
>
>> Now, you want others to help you make money because you haven't
>> done your homework and you are up against a deadline.
>
> Hey, any port in a storm. ;-)
>
>> Here is your fish. Enjoy.
>
> Which defeats the purpose. I'm /NOT/ writing a script to produce an
> output file for a web server. I /AM/ producing the output file to
> write to the file system. The 'eval' point you made above came from a
> script that (1) queried a database, (2) parsed the data and stuffed it
> into a hash, (3) created the outfile from the data, (4) invoked Word,
> and (5) exited. It wasn't a CGI script and didn't use a browser for an
> interface, but was run from the command line and didn't involve a web
> server.
>
> Anyway, Sinan, thanks for your help. I haven't run your code, but am
> curious if it will actually work in Word 2007. So far, I haven't
> gotten Word to open a document produced with WPML with a docx
> extension, but Word 2007 works fine with a plain doc extension.
>
> CC.
Not to put words in what Sinan and Jurgen are saying.
If you are dynamically creating the document, you don't need to write it
to the file system and generate a link in a web page for the user to
click on. You can simply send the document directly to the client
browser *if* you send the proper html content type.
--
Len
------------------------------
Date: Thu, 7 May 2009 18:00:12 -0700 (PDT)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: printing html with perl
Message-Id: <4da2b0ce-1cd0-4378-a817-9adce4a2f7b2@n8g2000vbb.googlegroups.com>
On May 6, 8:43=A0pm, "Guy" <some...@somewhere.nb.ca> wrote:
> For those who use Perl to generate HTML pages...
I frequently do this, which enables variable interpolation:
print qq(<p>She said, "Let me help polish the Polish silver."</p>);
I also frequently put my HTML in an HTML module and call it by passing
my variables as arguments, so that my HTML.pm might have a function
like this:
sub print_submit_button
{
my ($class, $value, $name) =3D @_;
print qq(<input type=3D"submit" name=3D"$name" value=3D"$value" class=3D"=
$
{class}_out"
onmouseover=3D'this.className=3D"${class}_over";'
onmouseout=3D'this.className=3D"${class)_out";' />);
}
I call it like this:
print_submit_button('big_red_button','Hit Me Again','do_what');
CC
------------------------------
Date: Fri, 08 May 2009 01:50:26 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: printing html with perl
Message-Id: <Xns9C04DE2A7324Casu1cornelledu@127.0.0.1>
ccc31807 <cartercc@gmail.com> wrote in news:4da2b0ce-1cd0-4378-a817-
9adce4a2f7b2@n8g2000vbb.googlegroups.com:
> On May 6, 8:43 pm, "Guy" <some...@somewhere.nb.ca> wrote:
>> For those who use Perl to generate HTML pages...
>
> I frequently do this, which enables variable interpolation:
> print qq(<p>She said, "Let me help polish the Polish silver."</p>);
>
> I also frequently put my HTML in an HTML module and call it by passing
> my variables as arguments, so that my HTML.pm might have a function
> like this:
> sub print_submit_button
> {
> my ($class, $value, $name) = @_;
> print qq(<input type="submit" name="$name" value="$value" class="$
> {class}_out"
> onmouseover='this.className="${class}_over";'
> onmouseout='this.className="${class)_out";' />);
> }
use HTML::Template or Template.pm
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/
------------------------------
Date: Thu, 07 May 2009 17:17:10 -0400
From: Charlton Wilbur <cwilbur@chromatico.net>
Subject: Re: writing get_script()
Message-Id: <86ab5oipex.fsf@mithril.chromatico.net>
>>>>> "FS" == Franken Sense <frank@example.invalid> writes:
FS> 1) Have the numbers populate $book, $chp, $verse.
FS> 2) Remove the newline when not at the end of a verse.
FS> 3) Have get_script() be an external function that is called by
FS> main in C.
Because of requirement 3, I'd probably do the whole thing in C. The
pain of the parsing is likely to be considerably less than the pain of
integrating C and Perl.
Charlton
--
Charlton Wilbur
cwilbur@chromatico.net
------------------------------
Date: Thu, 7 May 2009 17:47:39 -0700 (PDT)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: writing get_script()
Message-Id: <b37b377a-c36e-45a0-9773-a7be3cbf9b78@s16g2000vbp.googlegroups.com>
On May 7, 5:17=A0pm, Charlton Wilbur <cwil...@chromatico.net> wrote:
> Because of requirement 3, I'd probably do the whole thing in C. =A0The
> pain of the parsing is likely to be considerably less than the pain of
> integrating C and Perl.
We don't know what will happen to the data. It's obviously going to be
used for some purpose, and the particular purpose will drive the
method of extracting the data. Maybe the OP would be better off using
Perl for the entire app rather than integrating C and Perl.
As to the newline issue, it strikes me that a 'real' newline is one
that appears by itself, "^\n$", and a 'fake' newline is one that
doesn't, "^.+\n$". I'd append each line to the previous line unless
the first character in the line is \n and then process the next set of
lines.
I'd be interested in the motivation of inserting scripture into a
binary tree. After all, scripture says 'Cursed is anyone that hangs on
a tree.' (quoted in Galatians, I think.)
CC
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V11 Issue 2401
***************************************