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:
- Find the files related to the given parameters.
- Archive them (through system call)
- 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.......
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.