Saving Perl output

R

Richard

What I want is when some one clicks a link a box appears asking where
to save to, same as when you download a zip etc. Then for the comtent
of the file that is saved to be generated by a Perl script.
I am new at this and don't even know if this is possible.
Thanks
RH
 
P

Peter Cooper

Richard said:
What I want is when some one clicks a link a box appears asking where
to save to, same as when you download a zip etc. Then for the comtent
of the file that is saved to be generated by a Perl script.
I am new at this and don't even know if this is possible.

It is. There are better ways of doing it than this, but put this script
someplace where you can run CGI scripts:

#!/usr/bin/perl (or #!perl if you're on Windows)
print "Content-type: application/octet-stream\n\n";
foreach (1..1000) { print; }

And then try to access it. Your browser will bring up the 'save or open'
dialog box, and if you save it, and then open file afterwards, it'll be all
the numbers from one through to a thousand. Is this vaguely what you wanted?
If so, you can start to make it a bit more elegant ;-)

Pete
 
T

Tad McClellan

Richard said:
What I want is when some one clicks a link a box appears asking where
to save to, same as when you download a zip etc. Then for the comtent
of the file that is saved to be generated by a Perl script.


The answer to the above would be different in only trivial ways
from if you had asked this instead:

... file that is saved to be generated by a Python script.
or
... file that is saved to be generated by a Visual Basic script.

The question is independant of which programming language you
choose to write your CGI programs in, so it should be asked in
a newsgroup that is independant of programming language, such
as in the comp.infosystems.www.* groups.



The answer to the Perl part of your question is:

You use the print() function to make output.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,129
Messages
2,570,770
Members
47,329
Latest member
FidelRauch

Latest Threads

Top