thendal
Programmer
- Aug 23, 2000
- 284
Hi All, I have a M$ word document (letter.doc) stored in /usr/local/apache/cgi-bin/letter.doc
I wrote a perl code in which each time user inputs some value like name, address the output word document customize according to the input.
the letter.doc looks like this
----------------------------
in(today)
in(address)
Dear in(name),
Blabal ablan blah blah blah
Thank you
------------------------------
i replace in(today),in(address) ,in(name) with values using the following code.
when i try run the script in web brower /usr/local/apache/cgi-bin/test_letter.pl
it fires up word application .But its not outputting any content what am i doing wrong here ...
Thank you for any insight
I wrote a perl code in which each time user inputs some value like name, address the output word document customize according to the input.
the letter.doc looks like this
----------------------------
in(today)
in(address)
Dear in(name),
Blabal ablan blah blah blah
Thank you
------------------------------
i replace in(today),in(address) ,in(name) with values using the following code.
when i try run the script in web brower /usr/local/apache/cgi-bin/test_letter.pl
it fires up word application .But its not outputting any content what am i doing wrong here ...
Code:
#!/usr/bin/perl
use CGI;
$op=new CGI;
$in{name}="My Name is"
$in{address}=" address";
$in{today}="23/03/05";
&out("letter.doc");
sub out
{
print "Content-type: application/msword", "\n\n";
local($file)=@_;
open(OUT,"$file") || print "$!: $file <br>";
while(<OUT>)
{
$_ =~ s/in\((\w+)\)/$in{$1}/g;
print;
}
close OUT;
}
Thank you for any insight