From nobody Sat Jul 20 19:36:36 2002 Newsgroups: perl.beginners.cgi Subject: Re: Make files? References: <245D3383FB8F0C469218514273488A27892709@hh-nts01.databuilt.com> Date: 20 Jul 2002 19:36:14 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Lines: 48 barry.jones@databuilt.com (Barry Jones) writes: > I don't have access to the shell on my web server, but I can FTP > stuff over to my web space. I need to install the DBI locally and I > was wondering if it was possible to run a make file THROUGH a CGI? Sure. You can put any command you want in a CGI. I had to do this once to view the httpd log on a machine where the ISP didn't provide any decent way to read it. First I uploaded this script and viewed it through my browser: #!/bin/sh echo Content-type: text/plain echo locate httpd.conf Once I located it, I replaced the locate line with: cat httpd.conf Then I was able to look through that and find where the httpd log was, and replace the 'cat' line with: tail -50 /path/to/httpd.log So you could do the same kind of thing with your make process. Make sure you send the output to files, so you can download them and see how it went. You could send the output to your browser, but it might be quite long, so sending it to a file is better. I like to do: make >make.log 2>make.err to keep errors separate from normal output. One issue you might have is timeouts. If your process takes too long, the server might timeout and kill it. If your 'make' takes long enough for this to be a problem, you'll need to get around that somehow. Either detach the make process from your script process so it doesn't get killed, or try creating an 'at' or cron job to do it. Whatever works. :-) My first recommendation, though, would be to get your admin to install DBI, or move to a server that offers it. -- Aaron From nobody Sat Jul 20 19:52:16 2002 Newsgroups: perl.beginners.cgi Subject: Re: Gettin a 1 after an HTML field References: <3D388505.FF03D743@san.rr.com> Date: 20 Jul 2002 19:52:14 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Lines: 30 mfischer@san.rr.com (Maureen E Fischer) writes: > #my ($enh_prior) = $q->param("enhpriority") =~ /^[1-3]+$/; This says, "Do the following regex check on the return value of the param() call, and assign the number of matches to $enh_prior. Since your regex can only match once, it equals '1'. The Camel book says: "If the match succeeds, but there were no parantheses, a list value of (1) is returned." That's probably not what you want here. You could do this: my( $enh_prior ) = $q->param("enhpriority") =~ /^([1-3]+)$/; But that wouldn't be very good either, since if the regex fails, it returns a null list, and $enh_prior will never be initialized. I'd do something like this: my( $enh_prior ) = $q->param("enhpriority") || ''; And then do whatever checking I wanted to do on the value after getting it into the variable. -- Aaron From nobody Sat Jul 20 23:05:28 2002 Newsgroups: perl.beginners.cgi Subject: Re: Zipping a file for download References: <002801c23059$533303b0$6c67e9d5@microsoft.com> Date: 20 Jul 2002 23:05:26 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Lines: 35 orasnita@home.ro (Octavian Rasnita) writes: > I have made a script that let the web page visitor to choose the > files she wants to download using checkboxes, then the script > creates a zip archive with those files, and put it in a directory > accessible for web page visitors. > Are there any Perl modules that can help me for creating zip (or > tar, or gzip) files? Yes, Archive::Zip and Archive::Tar, available at CPAN. Probably others too. > Is it possible to send the result of zip command directly for > printing in the browser, so the download take place without a > temporary file? Sure. This would be the easiest solution, as it eliminates the whole issue of temporary files and cleaning up. Say you gather the list of files to zip into @files: my $fl = join ' ', @files; open ZIP, "zip - $fl |"; print "Content-type: application/octet-stream\n\n"; print ; close ZIP; You can do something similar with a tar|gzip| pipe, or use the modules above. You might want to throw a Content-length header in there too, and of course you should add error correction. -- Aaron From nobody Wed Jul 31 13:02:52 2002 Newsgroups: perl.beginners.cgi Subject: Re: Multiple Selects to Perl Script References: <006301c23895$e87ec5a0$400d19c4@saix.net> Date: 31 Jul 2002 13:02:52 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Lines: 18 margaret@saix.net (Margaret) writes: > I am having a most frustrating problem. I created a from with > multiple selects using a perl script and passed the multiple > selections to an array ie. > @array1 = $q->param('type'). > The array only contains the first selection and none of the > others. How do I fix this? I have read a lot of documentation and it > is supposed to work. What am I doing wrong? What does your form HTML look like, especially the