Check out the CGI module at search.cpan.org. There's an example about how to use the header() function to bring up a dialogue box to download the generated content as a file. In the example it's using a gif But the principles will apply to your file as well. Give that a read and a try.
Dan M > ok, lemme go from the top. > > i have a script (below) which runs through directories > retrieving necessary content, and, when the script is > executed, it outputs it to browser. what i want it to do, but > can't get it to do, is, to be able to click on a link which > links to the script, but the user be able to download a > predefined filename. > > so, i click on a link which goes to download.pl, and instead > of the data the script outputs going to the browser, i want > it to be saved as a file, servers.ini, as if you've > right-clicked the link and put "save target as...". at the > moment, doing "save target as..." says the file name is > "download.pl", but i want that to read "servers.ini". > > my question is: is it possible to tell explorer that the data > the script is outputting belongs to a file named servers.ini, > not a file named download.pl, or the text just appearing > straight in the browser? if not, is there another way where i > can create data on the fly, give the user the file, and > remove the file straight after? > > hope this is clearer than before. > > thanks in advance. > > dan > > "Dan Muey" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > ex.infiniplex. > com... > So you're trying to figure out /can't get it to what??? > Read this :: http://www.catb.org/~esr/faqs/smart-questions.html > > > basically, what it does, is it reads info, and supposed to > output so > > the user can download the data it's just output, webserver does > > support scripts, it outputs the correct data, but my goal is to be > > able to get the "download file" window up, and be able to store a > > "servers.ini" file from the data the perl script outputs. > > > > Dan > > > > "Dan Muey" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > ex.infiniplex. > > com... > > Not really sure what you're problem/goal is but if the > script's code > > shows up in the browser or it wants to download the script, > Then your > > webserver doesn't do .pl extensions. Try .cgi as the > extension. Also > > make sure it's executable. > > > > If it a problem writing files try : > > > > File::Slurp > > > > If you're trying to write a file on a remote server try Net::FTP Or > > SOAP::Lite > > > > See http://search.cpan.org for those modules. > > > > Dan > > > > > -----Original Message----- > > > From: dan [mailto:[EMAIL PROTECTED] > > > Sent: Friday, February 21, 2003 5:16 PM > > > To: [EMAIL PROTECTED] > > > Subject: Dynamic downloads > > > > > > > > > I'm making a script that enables you to download content > > off a server > > > as it is, so the data is as up to date as it could ever > > possibly be. I > > > have this: > > > > > > $number = 0; > > > $path = "/home/sites/site2/users/dan/web/servers/networks/"; > > > print "Content-type:text/plain\n\n"; > > > print qq~; Please send detailed suggestions, new servers, network > > > errors, and broken ; links to [EMAIL PROTECTED] Details on > > > http://www.serverlistings.net > > > > > > [servers] > > > ~; > > > opendir(DIR,$path); > > > while ($file = readdir DIR) { > > > next if $file eq '.' or $file eq '..'; > > open(NETWORK,"$path$file"); > > > foreach $line (<NETWORK>) { > > > chomp($line); > > > if (substr($line,0,4) eq "PASS") { > > > > > > } else { > > > ($net,$desc,$ports) = split(/\|/,$line); > > > if (lc(substr($desc,0,6)) eq "random") { > > > if (substr($desc,7) eq "") { > > > $desc = "Random $file Server"; > > > } else { > > > $desc = "Random " . substr($desc,7) . " $file Server"; > > > } > > > } > > > print "n$number=$desc" . "SERVER:$net:$ports" . > "GROUP:$file\n"; > > > $number++; > > > } > > > } > > > close(NETWORK); > > > } > > > closedir DIR; > > > > > > however, if I click on the link on the web page which > executes the > > > download.pl script, it appears either a) in the web > > browser, or b) as > > > a download.pl file. How can i make this so when clicking > > the link it > > > creates a servers.ini file on the fly? > > > > > > Thanks in advance. > > > > > > Dan > > > > > > > > > > > > -- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]