Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Downloading Data & Syst. Call Upon Click Via CGI.pm

by neversaint (Deacon)
on Nov 22, 2011 at 13:48 UTC ( #939455=perlquestion: print w/ replies, xml ) Need Help??
neversaint has asked for the wisdom of the Perl Monks concerning the following question:

Dear Masters,
I want to have a URL that **only when clicked** the CGI will be executed.
<a href=/myweb/cgi-bin/mycgi_long_running.cgi?name=param>Some Param</a +>
With a single click the CGI will perform the following tasks:
  1. Find the files related to the given parameters.
  2. Archive them (through system call)
  3. Start downloading for user
How to create the proper state for CGI script for that? I have the following cgi script but failed:
use strict; use warnings; use CGI::Carp qw(fatalsToBrowser); use CGI qw/:standard/; my $query = CGI->new(); my $file = "listoffiles_withdir.txt"; my $searchkey = param('name'); #untainting step skipped for briefness # Begin searching terms and ignoring case my @entries = `grep -i \"$searchkey\" $file`; chomp @entries; my $outf = 'tempfile.txt'; # output file name open ( OUTFILE, '>>', $outf) foreach my $file (@entries} print OUTFILE "$file"; } close(OUTFILE) # This phase takes may take a long time to do # many files involved system("tar -cf out.tar -T $outf"); # Next step, I'm stuck as how # to let the web automatically download # when the archiving is complete


---
neversaint and everlastingly indebted.......

Comment on Downloading Data & Syst. Call Upon Click Via CGI.pm
Select or Download Code
Re: Downloading Data & Syst. Call Upon Click Via CGI.pm
by Anonymous Monk on Nov 22, 2011 at 14:10 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://939455]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (13)
As of 2014-07-31 18:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (250 votes), past polls