Your question is a little unclear to me. When something isn't
clear to me, I start debugging and debug until it is clear.
What I tried here was to pass the params to the filehandle. It'll save the data without putting on the disk. You need to binmode the filehandle in order for it to work; also, you need to call the new method twice.
Carp
and
CGI::Carp::DebugScreen are required.
!/usr/bin/perl
use warnings;
use Carp;
use CGI qw(param);
use CGI::Carp::DebugScreen;
open( OUT, '>>/root/Desktop/zip.out' );
CGI::Carp::DebugScreen->debug(1);
my $q = CGI->new;
binmode OUT, ':raw';
my $name = $q->param('content_of_zip') || "Content";
my $out = $q->param('output') || "Binary";
$q->save(OUT);
close OUT;
# now double-check to see if it was saved.
open( IN, '/root/Desktop/zip.out' );
while ( not eof IN ) {
$q = CGI->new;
print $name, "\n", $out, "\n";
exit 0;
}
close IN;
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.