perl.beginners.cgi http://www.nntp.perl.org/group/perl.beginners.cgi/ ... Copyright 1998-2013 perl.org Sat, 25 May 2013 07:27:18 +0000 ask@perl.org Re: cgi development environment by Shaun Fryer Also check out http://search.cpan.org/~lds/CGI.pm-3.08/CGI/Carp.pm<br/>--<br/>Shaun Fryer<br/>----------------------------------------------------------<br/>perl -e &#39;print chr for map{$_+=22}($ARGV[0])=~/(\d\d)/g&#39; \<br/> 52959394107588899482799210587992861082757785799222<br/>----------------------------------------------------------<br/><br/><br/>On Wed, Sep 19, 2012 at 11:54 PM, Chris Stinemetz<br/>&lt;chrisstinemetz@gmail.com&gt; wrote:<br/>&gt;&gt;&gt;<br/>&gt;&gt; You have a couple other issues. Since you have one print statement, spread<br/>&gt;&gt; over multiple lines, the semi-colons on lines 10 and 11 are bugs. They<br/>&gt;&gt; should be commas. The semi-colons terminate the statement resulting in<br/>&gt;&gt; syntax errors.<br/>&gt;&gt;<br/>&gt;&gt; Mike<br/>&gt;<br/>&gt; Thank you. That fixed it.<br/>&gt;<br/>&gt; -Chris<br/>&gt;<br/>&gt; --<br/>&gt; To unsubscribe, e-mail: beginners-cgi-unsubscribe@perl.org<br/>&gt; For additional commands, e-mail: beginners-cgi-help@perl.org<br/>&gt; http://learn.perl.org/<br/>&gt;<br/>&gt;<br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2012/09/msg13597.html Wed, 19 Sep 2012 21:49:47 +0000 Re: cgi development environment by Chris Stinemetz &gt;&gt;<br/>&gt; You have a couple other issues. Since you have one print statement, spread<br/>&gt; over multiple lines, the semi-colons on lines 10 and 11 are bugs. They<br/>&gt; should be commas. The semi-colons terminate the statement resulting in<br/>&gt; syntax errors.<br/>&gt;<br/>&gt; Mike<br/><br/>Thank you. That fixed it.<br/><br/>-Chris<br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2012/09/msg13596.html Wed, 19 Sep 2012 20:54:29 +0000 Re: cgi development environment by Mike Williams On Wed, Sep 19, 2012 at 10:48 PM, Chris Stinemetz<br/>&lt;chrisstinemetz@gmail.com&gt;wrote:<br/><br/><br/>&gt; am having issues with my first script and have hopes someone may be<br/>&gt; able to explain to me whey it isn&#39;t working correctly.<br/>&gt;<br/>&gt; The error is coming form line 11 and the error is:<br/>&gt;<br/>&gt; Premature end of script headers: test2.cgi<br/>&gt; Bareword &quot;left&quot; not allowed while &quot;strict subs&quot; in use at<br/>&gt;<br/><br/>The error message is a major clue. Try quotes around &quot;left&quot;<br/><br/><br/>&gt; /usr/lib/cgi-bin/test2.cgi line 7.<br/>&gt; Execution of /usr/lib/cgi-bin/test2.cgi aborted due to compilation errors.<br/>&gt; Premature end of script headers: test2.cgi<br/>&gt;<br/>&gt;<br/>&gt; 1 #!/usr/bin/perl<br/>&gt; 2 use warnings;<br/>&gt; 3 use strict;<br/>&gt; 4 use CGI;<br/>&gt; 5<br/>&gt; 6 my $q = CGI-&gt;new;<br/>&gt; 7 print $q-&gt;header(-type=&gt;&#39;text/html&#39;),<br/>&gt; 8 $q-&gt;start_html(&#39;hello world&#39;), # start the HTML<br/>&gt; 9 $q-&gt;h1({-align=&gt;right},&#39;hello world&#39;), # level 1 header<br/>&gt; 10 $q-&gt;h1({-align=&gt;left});<br/>&gt; 11 $q-&gt;h1(&#39;some&#39;,&#39;contents&#39;);<br/>&gt; 12 $q-&gt;end_html; # end the HTML<br/>&gt;<br/>&gt;<br/>You have a couple other issues. Since you have one print statement, spread<br/>over multiple lines, the semi-colons on lines 10 and 11 are bugs. They<br/>should be commas. The semi-colons terminate the statement resulting in<br/>syntax errors.<br/><br/>Mike<br/><br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2012/09/msg13595.html Wed, 19 Sep 2012 20:45:21 +0000 Re: cgi development environment by Chris Stinemetz I have my Perl cgi development environment all set-up. I actually<br/>wound up setting up an instance through Amazon AWS.<br/>Very cool service by Amazon.<br/><br/>I am having issues with my first script and have hopes someone may be<br/>able to explain to me whey it isn&#39;t working correctly.<br/><br/>The error is coming form line 11 and the error is:<br/><br/>Premature end of script headers: test2.cgi<br/>Bareword &quot;left&quot; not allowed while &quot;strict subs&quot; in use at<br/>/usr/lib/cgi-bin/test2.cgi line 7.<br/>Execution of /usr/lib/cgi-bin/test2.cgi aborted due to compilation errors.<br/>Premature end of script headers: test2.cgi<br/><br/><br/> 1 #!/usr/bin/perl<br/> 2 use warnings;<br/> 3 use strict;<br/> 4 use CGI;<br/> 5<br/> 6 my $q = CGI-&gt;new;<br/> 7 print $q-&gt;header(-type=&gt;&#39;text/html&#39;),<br/> 8 $q-&gt;start_html(&#39;hello world&#39;), # start the HTML<br/> 9 $q-&gt;h1({-align=&gt;right},&#39;hello world&#39;), # level 1 header<br/> 10 $q-&gt;h1({-align=&gt;left});<br/> 11 $q-&gt;h1(&#39;some&#39;,&#39;contents&#39;);<br/> 12 $q-&gt;end_html; # end the HTML<br/><br/>Thank you in advance,<br/><br/>-Chris<br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2012/09/msg13594.html Wed, 19 Sep 2012 19:48:25 +0000 Re: cgi development environment by David Dorward On 18 Sep 2012, at 13:34, Chris Stinemetz &lt;chrisstinemetz@gmail.com&gt; wrote:<br/>&gt; I am very interested in cgi scripting. I have only used php for web<br/>&gt; development in the past.<br/><br/>CGI or Perl? For a long time CGI with Perl was a popular combination so there are a lot of documents which conflate the two.<br/><br/>It is possible to do CGI programming in PHP (which you already know), but PSGI[1] is the flavour du jour for server side web programming with Perl.<br/><br/>CGI is still a plausible option though. It has the benefit of simplicity (but isn&#39;t the most efficient option).<br/><br/>[1] http://plackperl.org/<br/><br/><br/>-- <br/>David Dorward<br/>http://dorward.me.uk<br/><br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2012/09/msg13593.html Wed, 19 Sep 2012 08:09:03 +0000 Re: cgi development environment by Mike Flannigan <br/>These are some materials I use:<br/>http://cpan.uwinnipeg.ca/htdocs/CGI.pm/CGI.html<br/>http://www.cookwood.com/perl/examples/overview.html<br/><br/>I&#39;m not sure those are the best sources for getting<br/>up and running. If not, I can help you with that<br/>too. First thing I would do is install Perl. Either<br/>ActiveState, or Strawberry Perl. I use ActiveState.<br/>I think CGI comes automatically, but if not install<br/>that too with &#39;ppm&#39;. Get back to me if you need<br/>help with that.<br/><br/><br/>Mike<br/><br/><br/>On 9/18/2012 8:34 AM, beginners-cgi-digest-help@perl.org wrote:<br/>&gt; Subject:<br/>&gt; cgi development environment<br/>&gt; From:<br/>&gt; Chris Stinemetz &lt;chrisstinemetz@gmail.com&gt;<br/>&gt; Date:<br/>&gt; 9/18/2012 8:34 AM<br/>&gt;<br/>&gt; To:<br/>&gt;<br/>&gt;<br/>&gt; Hello list,<br/>&gt;<br/>&gt; I am very interested in cgi scripting. I have only used php for web<br/>&gt; development in the past.<br/>&gt; Would someone please let me know of any good tutorials to get windows<br/>&gt; based web development environment set up and get my feet wet?<br/>&gt;<br/>&gt; Thank you in advance,<br/>&gt;<br/>&gt; Chris<br/><br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2012/09/msg13592.html Wed, 19 Sep 2012 06:29:41 +0000 Re: cgi development environment by Shaun Fryer If you&#39;re running Windows and have a decent amount of RAM, try<br/>installing vbox and then you should be able to find/follow<br/>instructions online to load/install any of the freely available linux<br/>iso&#39;s downloadable from the distro&#39;s website. I&#39;d recommend either<br/>Ubuntu or Mint, though your preference may vary. It&#39;s generally pretty<br/>straight forward.<br/>--<br/>Shaun Fryer<br/>----------------------------------------------------------<br/>perl -e &#39;print chr for map{$_+=22}($ARGV[0])=~/(\d\d)/g&#39; \<br/> 52959394107588899482799210587992861082757785799222<br/>----------------------------------------------------------<br/><br/><br/>On Tue, Sep 18, 2012 at 7:53 PM, Chris Stinemetz<br/>&lt;chrisstinemetz@gmail.com&gt; wrote:<br/>&gt; On Tue, Sep 18, 2012 at 5:46 AM, Mark Haney &lt;markh@abemblem.com&gt; wrote:<br/>&gt;&gt; On 09/18/2012 08:34 AM, Chris Stinemetz wrote:<br/>&gt;&gt;&gt;<br/>&gt;&gt;&gt; Hello list,<br/>&gt;&gt;&gt;<br/>&gt;&gt;&gt; I am very interested in cgi scripting. I have only used php for web<br/>&gt;&gt;&gt; development in the past.<br/>&gt;&gt;&gt; Would someone please let me know of any good tutorials to get windows<br/>&gt;&gt;&gt; based web development environment set up and get my feet wet?<br/>&gt;&gt;&gt;<br/>&gt;&gt;&gt; Thank you in advance,<br/>&gt;&gt;&gt;<br/>&gt;&gt;&gt; Chris<br/>&gt;&gt;&gt;<br/>&gt;&gt;<br/>&gt;&gt; Is there any particular reason it has to be Windows based? Not that I think<br/>&gt;&gt; it matters, but perl works okay on windows, but it&#39;s not a platform combo I<br/>&gt;&gt; would recommend.<br/>&gt;&gt;<br/>&gt;&gt; Would you consider learning it in a VM in Linux?<br/>&gt;&gt;<br/>&gt;&gt; Otherwise I can get you setup in windows with Perl if you like. I had to<br/>&gt;&gt; write up a setup sheet when I was working on a project.<br/>&gt;&gt;<br/>&gt;<br/>&gt; I&#39;m not against using VM to set-up a linux box. If you have a write up<br/>&gt; I would like to see it.<br/>&gt;<br/>&gt; Thank you,<br/>&gt;<br/>&gt; Chris<br/>&gt;<br/>&gt; --<br/>&gt; To unsubscribe, e-mail: beginners-cgi-unsubscribe@perl.org<br/>&gt; For additional commands, e-mail: beginners-cgi-help@perl.org<br/>&gt; http://learn.perl.org/<br/>&gt;<br/>&gt;<br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2012/09/msg13591.html Tue, 18 Sep 2012 22:03:13 +0000 Re: cgi development environment by Chris Stinemetz On Tue, Sep 18, 2012 at 5:46 AM, Mark Haney &lt;markh@abemblem.com&gt; wrote:<br/>&gt; On 09/18/2012 08:34 AM, Chris Stinemetz wrote:<br/>&gt;&gt;<br/>&gt;&gt; Hello list,<br/>&gt;&gt;<br/>&gt;&gt; I am very interested in cgi scripting. I have only used php for web<br/>&gt;&gt; development in the past.<br/>&gt;&gt; Would someone please let me know of any good tutorials to get windows<br/>&gt;&gt; based web development environment set up and get my feet wet?<br/>&gt;&gt;<br/>&gt;&gt; Thank you in advance,<br/>&gt;&gt;<br/>&gt;&gt; Chris<br/>&gt;&gt;<br/>&gt;<br/>&gt; Is there any particular reason it has to be Windows based? Not that I think<br/>&gt; it matters, but perl works okay on windows, but it&#39;s not a platform combo I<br/>&gt; would recommend.<br/>&gt;<br/>&gt; Would you consider learning it in a VM in Linux?<br/>&gt;<br/>&gt; Otherwise I can get you setup in windows with Perl if you like. I had to<br/>&gt; write up a setup sheet when I was working on a project.<br/>&gt;<br/><br/>I&#39;m not against using VM to set-up a linux box. If you have a write up<br/>I would like to see it.<br/><br/>Thank you,<br/><br/>Chris<br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2012/09/msg13590.html Tue, 18 Sep 2012 16:53:31 +0000 Re: cgi development environment by Shaun Fryer Native Win32 Perl: http://strawberryperl.com/<br/>Win32 Linux compat layer: http://www.cygwin.com/<br/>Free virtualization env: https://www.virtualbox.org/<br/>Perl Win32 API bindings: https://www.google.ca/search?q=perl+win32+ole<br/>--<br/>Shaun Fryer<br/>----------------------------------------------------------<br/>perl -e &#39;print chr for map{$_+=22}($ARGV[0])=~/(\d\d)/g&#39; \<br/> 52959394107588899482799210587992861082757785799222<br/>----------------------------------------------------------<br/><br/>On Tue, Sep 18, 2012 at 9:19 AM, David Christensen<br/>&lt;dpchrist@holgerdanske.com&gt; wrote:<br/>&gt; On 09/18/12 05:34, Chris Stinemetz wrote:<br/>&gt;&gt;<br/>&gt;&gt; I am very interested in cgi scripting. I have only used php for web<br/>&gt;&gt; development in the past.<br/>&gt;&gt; Would someone please let me know of any good tutorials to get windows<br/>&gt;&gt; based web development environment set up and get my feet wet?<br/>&gt;<br/>&gt;<br/>&gt; http://www.google.com/search?q=windows+cgi+howto<br/>&gt;<br/>&gt; http://www.cgi101.com/book/<br/>&gt;<br/>&gt; http://www.cgi101.com/book/connect/winxp.html<br/>&gt;<br/>&gt;<br/>&gt; HTH,<br/>&gt;<br/>&gt; David<br/>&gt;<br/>&gt;<br/>&gt; --<br/>&gt; To unsubscribe, e-mail: beginners-cgi-unsubscribe@perl.org<br/>&gt; For additional commands, e-mail: beginners-cgi-help@perl.org<br/>&gt; http://learn.perl.org/<br/>&gt;<br/>&gt;<br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2012/09/msg13589.html Tue, 18 Sep 2012 07:13:58 +0000 Re: cgi development environment by David Christensen On 09/18/12 05:34, Chris Stinemetz wrote:<br/>&gt; I am very interested in cgi scripting. I have only used php for web<br/>&gt; development in the past.<br/>&gt; Would someone please let me know of any good tutorials to get windows<br/>&gt; based web development environment set up and get my feet wet?<br/><br/>http://www.google.com/search?q=windows+cgi+howto<br/><br/>http://www.cgi101.com/book/<br/><br/>http://www.cgi101.com/book/connect/winxp.html<br/><br/><br/>HTH,<br/><br/>David<br/><br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2012/09/msg13588.html Tue, 18 Sep 2012 06:20:30 +0000 Re: cgi development environment by Mark Haney On 09/18/2012 08:34 AM, Chris Stinemetz wrote:<br/>&gt; Hello list,<br/>&gt;<br/>&gt; I am very interested in cgi scripting. I have only used php for web<br/>&gt; development in the past.<br/>&gt; Would someone please let me know of any good tutorials to get windows<br/>&gt; based web development environment set up and get my feet wet?<br/>&gt;<br/>&gt; Thank you in advance,<br/>&gt;<br/>&gt; Chris<br/>&gt;<br/><br/>Is there any particular reason it has to be Windows based? Not that I <br/>think it matters, but perl works okay on windows, but it&#39;s not a <br/>platform combo I would recommend.<br/><br/>Would you consider learning it in a VM in Linux?<br/><br/>Otherwise I can get you setup in windows with Perl if you like. I had <br/>to write up a setup sheet when I was working on a project.<br/><br/><br/><br/>-- <br/><br/>Mark Haney<br/>Software Developer/Consultant<br/>AB Emblem<br/>markh@abemblem.com<br/>Linux marius.homelinux.org 3.5.1-1.fc17.x86_64 GNU/Linux<br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2012/09/msg13587.html Tue, 18 Sep 2012 05:46:46 +0000 cgi development environment by Chris Stinemetz Hello list,<br/><br/>I am very interested in cgi scripting. I have only used php for web<br/>development in the past.<br/>Would someone please let me know of any good tutorials to get windows<br/>based web development environment set up and get my feet wet?<br/><br/>Thank you in advance,<br/><br/>Chris<br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2012/09/msg13586.html Tue, 18 Sep 2012 05:34:17 +0000 Re: Chess Script by gultekinmg http://aliens.alotspace.com/chess/board.pl<br/><br/>i have just place it with file attributes.<br/>I guess problem is your server.<br/><br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2012/07/msg13585.html Thu, 05 Jul 2012 02:32:26 +0000 Re: Attach iCal event to an cgi mail by Peter Scott After your program has opened SENDMAIL, open it again in the debugger to <br/>wherever you want (e.g., open SENDMAIL, &#39;&gt;&amp;STDOUT&#39;). Since it&#39;s a <br/>bareword filehandle, you&#39;ll be reopening the same one.<br/><br/>On Thu, 07 Jun 2012 12:59:20 -0700, mstep wrote:<br/>&gt; Yes the Filehandle is opened for writing. Is there any means to look<br/>&gt; inside? How to redirect the content of SENDMAIL in the debugger?<br/>&gt;<br/>&gt; Am Donnerstag, 7. Juni 2012 06:19:43 UTC+2 schrieb Peter Scott:<br/>&gt;&gt; On Mon, 04 Jun 2012 10:37:35 -0700, Marek wrote:<br/>&gt;&gt; <br/>&gt;&gt; &gt; Could somebody please tell me, how can I see into a FILEHANDLE in<br/>&gt;&gt; &gt; Perl debugger? I tried with &gt; x &lt;SENDMAIL&gt; but I get only &quot;empty<br/>&gt;&gt; &gt; array&quot;.<br/>&gt;&gt; <br/>&gt;&gt; That filehandle is open for *output* in your program! What is it you<br/>&gt;&gt; want to examine?<br/>&gt;&gt; <br/>&gt;&gt; --<br/>&gt;&gt; Peter Scott<br/>&gt;&gt; http://www.perlmedic.com/ http://www.perldebugged.com/<br/>&gt;&gt; http://www.informit.com/store/product.aspx?isbn=0137001274<br/>&gt;&gt; http://www.oreillyschool.com/certificates/perl-programming.php<br/><br/><br/><br/><br/><br/>-- <br/>Peter Scott<br/>http://www.perlmedic.com/ http://www.perldebugged.com/<br/>http://www.informit.com/store/product.aspx?isbn=0137001274<br/>http://www.oreillyschool.com/certificates/perl-programming.php<br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2012/06/msg13584.html Mon, 11 Jun 2012 01:32:21 +0000 Re: Attach iCal event to an cgi mail by mstep Hello Peter!<br/><br/>Thank you for your reply! <br/>Meanwhile my sendmail is working! Was quite difficult to program it. <br/><br/>Yes the Filehandle is opened for writing. Is there any means to look inside? How to redirect the content of SENDMAIL in the debugger?<br/><br/>Greetings from Munich - heavy thunderstorm here <br/><br/><br/>marek<br/><br/><br/>Am Donnerstag, 7. Juni 2012 06:19:43 UTC+2 schrieb Peter Scott:<br/>&gt; On Mon, 04 Jun 2012 10:37:35 -0700, Marek wrote:<br/>&gt; <br/>&gt; &gt; Could somebody please tell me, how can I see into a FILEHANDLE in Perl<br/>&gt; &gt; debugger? I tried with &gt; x &lt;SENDMAIL&gt; but I get only &quot;empty array&quot;.<br/>&gt; <br/>&gt; That filehandle is open for *output* in your program! What is it you <br/>&gt; want to examine?<br/>&gt; <br/>&gt; -- <br/>&gt; Peter Scott<br/>&gt; http://www.perlmedic.com/ http://www.perldebugged.com/<br/>&gt; http://www.informit.com/store/product.aspx?isbn=0137001274<br/>&gt; http://www.oreillyschool.com/certificates/perl-programming.php<br/><br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2012/06/msg13583.html Fri, 08 Jun 2012 01:04:44 +0000 Re: Attach iCal event to an cgi mail by Peter Scott On Mon, 04 Jun 2012 10:37:35 -0700, Marek wrote:<br/><br/>&gt; Could somebody please tell me, how can I see into a FILEHANDLE in Perl<br/>&gt; debugger? I tried with &gt; x &lt;SENDMAIL&gt; but I get only &quot;empty array&quot;.<br/><br/>That filehandle is open for *output* in your program! What is it you <br/>want to examine?<br/><br/>-- <br/>Peter Scott<br/>http://www.perlmedic.com/ http://www.perldebugged.com/<br/>http://www.informit.com/store/product.aspx?isbn=0137001274<br/>http://www.oreillyschool.com/certificates/perl-programming.php<br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2012/06/msg13582.html Thu, 07 Jun 2012 00:27:06 +0000 Attach iCal event to an cgi mail by Marek <br/>Hello all!<br/><br/><br/>I made up a script for a taxi company to order a taxi. Everything is<br/>working. I have only problems to attach an iCal event, so that you<br/>only have to click on it and it is in your iCalendar.<br/><br/>The shortened script for mailing an attached file for the iCal event<br/>is doing nothing, without any error (script 2). The other script 1 is<br/>working. I don&#39;t understand why.<br/><br/>Could somebody please tell me, how can I see into a FILEHANDLE in Perl<br/>debugger? I tried with &gt; x &lt;SENDMAIL&gt; but I get only &quot;empty array&quot;.<br/><br/>Thank you for your help<br/><br/>marek<br/><br/><br/><br/>***Script 1***<br/><br/>#!/usr/bin/perl<br/><br/># Inspired from: http://wiki.perl-community.de/Wissensbasis/SendmailAttachments<br/><br/><br/>use strict;<br/>use warnings;<br/>use MIME::Base64;<br/><br/>my $file_path = &quot;/Users/you/Documents/webpages/cgi-bin/tmp&quot;;<br/>my $file_name = &quot;ical_summary.ics&quot;;<br/><br/>open(M, &quot;|/usr/sbin/sendmail -t -oi&quot;) or die &quot;Can&#39;t open mailprogram:<br/>&#39;/usr/sbin/sendmail&#39;!\n$!&quot;;<br/>print M &quot;MIME-Version: 1.0\n&quot;;<br/>print M qq(To: Your Name &lt;you\@yourdomain.com&gt;\n);<br/>print M qq(From: Your Name &lt;you\@yourdomain.com&gt;\n);<br/>print M qq(Reply-to: Your Name &lt;you\@yourdomain.com&gt;\n);<br/>print M &quot;Subject: E-Mail - the corrected version!\n&quot;;<br/>my $boundary = &quot;==========&quot;.substr(pack(&#39;u&#39;, (&#39;E-Mail&#39;.&#39;Your Name&#39;)),<br/>0, 24);<br/>print M qq(Content-type: multipart/mixed; boundary=&quot;$boundary&quot;\n);<br/>print M qq(--$boundary\nContent-Type: text/plain;<br/>charset=&quot;UTF-8&quot;\nContent-Transfer-Encoding: 7bit\n\n);<br/>print M qq(\nAnd there is a test again!\n);<br/>print M &quot;\n--$boundary\n&quot;;<br/>print M qq(Content-type: application/octet-stream;<br/>name=&quot;$file_name&quot;\n);<br/>print M &quot;Content-Transfer-Encoding: base64\n&quot;;<br/>print M qq(Content-Disposition: attachment;\nContent-Type: text/<br/>calendar filename=&quot;$file_name&quot;\nContent-Transfer-Encoding: base64\n);<br/>open(F, &quot;$file_path/$file_name&quot;) or die &quot;Can&#39;t open data: &#39;$file_path/<br/>$file_name&#39;!\n$!&quot;;<br/>my $data;<br/><br/>{<br/>binmode F;<br/>local $/;<br/>$data = &lt;F&gt;;<br/>}<br/>close(F) or die &quot;Can&#39;t close: &#39;$file_path/$file_name&#39;! $!\n&quot;;<br/>my $codiert = MIME::Base64::encode($data);<br/>print M &quot;\n$codiert\n&quot;;<br/>print M qq(\n--$boundary--\n);<br/>close(M) or die &quot;Can&#39;t close the filehandle &lt;M&gt;: $!&quot;;<br/><br/>__END__<br/><br/><br/>***Script 2*****<br/><br/>#! /usr/bin/perl<br/><br/>use strict;<br/>use warnings;<br/><br/>use MIME::Base64;<br/><br/>my $mailprog = &#39;/usr/sbin/sendmail -t -oi&#39;;<br/>my $postmaster = &#39;you@yourdomain.com&#39;;<br/>my @recipients = ( &#39;info@anothedomain.de&#39;, &#39;marek@yourdomain.com&#39; );<br/><br/>my $ical_data_start = &quot;20120601T210000&quot;;<br/>my $ical_data_end = &quot;20120601T220000&quot;;<br/>my $ical_summary = &quot;Dinner&quot;;<br/>my $ical_location = &quot;H&ouml;rwartstr&quot;;<br/>my $ical_file_name = $ical_summary . &quot;.ics&quot;;<br/><br/>my $ical_data = &lt;&lt;&quot;EOICAL&quot;;<br/>BEGIN:VCALENDAR<br/>BEGIN:VEVENT<br/>DTEND;TZID=Europe/Berlin:$ical_data_end<br/>SUMMARY:$ical_summary<br/>DTSTART;TZID=Europe/Berlin:$ical_data_start<br/>DTSTAMP:20120521T190638Z<br/>LOCATION:$ical_location<br/>SEQUENCE:0<br/>BEGIN:VALARM<br/>TRIGGER:-PT1H<br/>DESCRIPTION:Event reminder<br/>ACTION:DISPLAY<br/>END:VALARM<br/>END:VEVENT<br/>END:VCALENDAR<br/>EOICAL<br/><br/>$ical_data = encode_base64($ical_data);<br/><br/>my $reply = &#39;&quot;Your Name&quot; &lt;you@yourdomain.com&gt;&#39;;<br/>my $from = $reply;<br/>my $subject = &quot;Abholung vom 1.6.2012, 21:00&quot;;<br/>my $body = &quot;This is a test :-) Corrected Version! You really have to<br/>pay attention to the line endings between the different headers!\n\tda<br/>maaki&quot;;<br/>my $boundary = &quot;=====&quot; . time() . &quot;=====&quot;;<br/><br/>foreach my $to (@recipients) {<br/>my $result;<br/>eval {<br/>local $SIG{__DIE__};<br/>$result = open SENDMAIL, &quot;| $mailprog&quot;;<br/>};<br/>if ($@) {<br/>die $@ unless $@ =~ /Insecure directory/;<br/>delete $ENV{PATH};<br/>$result = open SENDMAIL, &quot;| $mailprog&quot;;<br/>}<br/><br/>die &quot;Can&#39;t open mailprog [$mailprog]\n&quot; unless $result;<br/><br/>my $data = &lt;&lt;&quot;EOMAIL&quot;;<br/>MIME-Version: 1.0<br/>From: $from<br/>To: $to<br/>Reply-to: $reply<br/>Subject: $subject<br/>Content-Type = multipart/mixed; boundary=&quot;$boundary&quot;<br/><br/>--$boundary<br/>Content-Type: text/plain; charset=&quot;UTF-8&quot;<br/>Content-Transfer-Encoding: 7bit<br/><br/>$body<br/>--$boundary<br/>Content-Disposition: attachment;<br/>Content-Type: text/calendar filename=&quot;$ical_file_name&quot;<br/>Content-Transfer-Encoding: base64<br/><br/>$ical_data<br/><br/>--$boundary--<br/>EOMAIL<br/><br/>print SENDMAIL $data or die &quot;write to sendmail pipe: $!&quot;;<br/>close SENDMAIL or die &quot;Closing of SENDMAIL failed: $!&quot;;<br/>}<br/><br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2012/06/msg13581.html Mon, 04 Jun 2012 11:53:30 +0000 Hi by Umesh Tiptur Hi <br/><br/>PLZ add me not the list<br/><br/><br/>Sent from Yahoo! Mail on Android<br/><br/><br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2012/04/msg13580.html Tue, 17 Apr 2012 00:35:07 +0000 Hi by Umesh Tiptur Please add me into the mailing list&nbsp;&nbsp;&nbsp; <br/><br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2012/04/msg13579.html Mon, 02 Apr 2012 06:42:14 +0000 Confirm to add to the forum by Umesh Tiptur <br/><br/><br/>Sent from Yahoo! Mail on Android<br/><br/><br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2012/03/msg13578.html Wed, 28 Mar 2012 03:43:53 +0000 Active Perl and ImageMagick by Skirv I cant seem to get this module to work at all.<br/>I have Windows 7 Pro 64bit, Apache 2.2.14, Active Perl 5.14.2.1402 64 bit<br/><br/>Then I installed...<br/>ImageMagick-6.7.5-6-Q16-windows-x64-dll.exe<br/><br/>I can run perl scripts on my web server fine and dandy, all day long,<br/>but If i call &quot;use Image::Magick;&quot; It gives me an error I cant<br/>understand because as far as I can tell everything is where is should<br/>be.<br/><br/>I checked the box that said &quot;Install PerlMagick for ActiveState Perl<br/>c51412.2 build 1402&quot;<br/><br/>&quot;Can&#39;t locate loadable object for module Image::Magick in @INC (@INC<br/>contains: C:/Perl64/site/lib C:/Perl64/lib .)&quot;<br/><br/>Looking at those folders it put it all in the /site/lib/ and not in<br/>the /lib/ folder. Which seems to me, from what I found on the net, to<br/>be the right spot. But should it not work from either/or/both?<br/><br/>As far as I can tell this should be all that I have to do for this,<br/>and yet it doesn&#39;t work? Any help would be appreciated. Thank you.<br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2012/02/msg13577.html Sat, 18 Feb 2012 07:10:09 +0000 Re: problem with passing variables by nat Mark,<br/> I&#39;m kind of new with perl, but from what I see, you&#39;re using a single <br/>quote when defining $sql, and it should be qq for the interpolated string. <br/>With the single quote (q) it is a literal. Hope this helps.<br/><br/><br/>On Friday, December 30, 2011 11:17:30 AM Mark Haney wrote:<br/>&gt; I&#39;m not sure if this is the right list for this, so bear with me. If it<br/>&gt; isn&#39;t I&#39;ll be glad to post it on the correct one.<br/>&gt; <br/>&gt; I&#39;ve got a problem with passing variables to a SQL server inside a CGI<br/>&gt; script. My code is like this:<br/>&gt; <br/>&gt; my $begin_time = &quot;2011-11-16 11:00:00&quot;;<br/>&gt; my $end_time = &quot;2011-11-16 12:00:00&quot;;<br/>&gt; <br/>&gt; my $dbh = DBI-&gt;connect(&#39;dbi:mysql:database=embdev&#39;, &#39;user&#39;, &#39;password&#39;);<br/>&gt; <br/>&gt; my $sql = q/SELECT * FROM events WHERE date BETWEEN $begin_time and<br/>&gt; $end_time/;<br/>&gt; <br/>&gt; my $sth = $dbh-&gt;prepare($sql);<br/>&gt; $sth-&gt;execute();<br/>&gt; <br/>&gt; I&#39;m not sure why it&#39;s not using the the variables, can someone point out<br/>&gt; what I&#39;m doing wrong?<br/>&gt; <br/>&gt; -----<br/>&gt; Mark Haney<br/><br/>-- <br/>nat<br/>enrgeeman.com<br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2011/12/msg13576.html Fri, 30 Dec 2011 10:56:51 +0000 problem with passing variables by Mark Haney I&#39;m not sure if this is the right list for this, so bear with me. If it <br/>isn&#39;t I&#39;ll be glad to post it on the correct one.<br/><br/>I&#39;ve got a problem with passing variables to a SQL server inside a CGI <br/>script. My code is like this:<br/><br/>my $begin_time = &quot;2011-11-16 11:00:00&quot;;<br/>my $end_time = &quot;2011-11-16 12:00:00&quot;;<br/><br/>my $dbh = DBI-&gt;connect(&#39;dbi:mysql:database=embdev&#39;, &#39;user&#39;, &#39;password&#39;);<br/><br/>my $sql = q/SELECT * FROM events WHERE date BETWEEN $begin_time and <br/>$end_time/;<br/><br/>my $sth = $dbh-&gt;prepare($sql);<br/>$sth-&gt;execute();<br/><br/>I&#39;m not sure why it&#39;s not using the the variables, can someone point out <br/>what I&#39;m doing wrong?<br/><br/>-----<br/>Mark Haney<br/><br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2011/12/msg13575.html Fri, 30 Dec 2011 08:17:38 +0000 Re: need help with a form by Peter Scott On Sun, 20 Nov 2011 23:04:28 -0800, Kevin Locke wrote:<br/><br/>&gt; I need help with getting a form for my church&#39;s website to work. Can<br/>&gt; someone help me with the code to send the information to my email. I<br/>&gt; would appreciate any input.<br/>&gt; <br/>&gt; &lt;form id=&quot;contact_us&amp;quot;&quot; class=&quot;appnitro&quot; method=&quot;post&quot; action=&quot;cgi-<br/>&gt; bin/contact_us.html&quot;&gt;<br/><br/>Well, your first problem is that the action target of the form is an HTML <br/>page instead of a CGI program. What code have you got so far?<br/><br/><br/>-- <br/>Peter Scott<br/>http://www.perlmedic.com/ http://www.perldebugged.com/<br/>http://www.informit.com/store/product.aspx?isbn=0137001274<br/>http://www.oreillyschool.com/certificates/perl-programming.php<br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2011/11/msg13574.html Mon, 28 Nov 2011 20:56:52 +0000 need help with a form by Kevin Locke I need help with getting a form for my church&#39;s website to work. Can<br/>someone help me with the code to send the information to my email. I<br/>would appreciate any input.<br/><br/>&lt;form id=&quot;contact_us&amp;quot;&quot; class=&quot;appnitro&quot; method=&quot;post&quot; action=&quot;cgi-<br/>bin/contact_us.html&quot;&gt;<br/><br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2011/11/msg13573.html Mon, 21 Nov 2011 01:03:57 +0000 Win32 cgi under Apache on Linux [How] by Al Hello,<br/><br/>I have a win32 executeable which contains a win32 Apache cgi.<br/><br/>I want to, if possible get this file to run under Apache on Linux. I<br/>think the exe is just a container for the source/compiled files.<br/><br/>I ran the exe on a win32 machine and it didnt appear to do anything,<br/>no output or errors. So I extracted it with universal extractor and<br/>got:<br/><br/>+rsrc (folder)<br/> +MANIFEST (folder)<br/> - 1 (file)<br/> +VERSION (folder)<br/> - 1 (file)<br/><br/>- .data<br/>- .rdata<br/>- .text<br/><br/>.text is quite large and appears to be binary.<br/><br/>The source exe I downloaded is at<br/>http://www.mobotix.com/other/Support/Software-Downloads/MxControlCenter/MxRemotePreview-1.0.4<br/><br/>I look forward to any help people here maybe able to provide.<br/><br/>Cheers<br/><br/>-Al<br/><br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2011/09/msg13572.html Mon, 26 Sep 2011 03:20:19 +0000 Re: sending scalar and hash to function by Shaun Fryer In the first code snippit, your function will receive a hash reference,<br/>which is a scalar. If you get rid of the curly braces, it will work. Better<br/>still would be....<br/><br/>my ($myopt, $myparams) =@_;<br/><br/>...and...<br/><br/>each %$myparams<br/><br/>--<br/>Shaun Fryer<br/>1-647-723-2729<br/>On Jun 27, 2011 2:33 PM, &lt;buzon@alejandro.ceballos.info&gt; wrote:<br/>&gt; I am trying to send an scalar and hash to a function, but is not<br/>&gt; receiving the value of the hash<br/>&gt;<br/>&gt; My code is:<br/>&gt;<br/>&gt; dosomething(&#39;option&#39;,{&#39;extraparam1&#39;=&gt;&#39;hello&#39;});<br/>&gt;<br/>&gt; function dosomething<br/>&gt; {<br/>&gt; ($myopt,%myparams) = @_;<br/>&gt; print &quot;opt = $myopt\n&quot;;<br/>&gt; while( my ($k, $v) = each %myparams )<br/>&gt; { print &quot;$k = $v \n&quot;; }<br/>&gt; }<br/>&gt;<br/>&gt; And result is:<br/>&gt;<br/>&gt; opt = option<br/>&gt; HASH(0xcb4f490) =<br/>&gt; HASH(0xcb4f490) =<br/>&gt;<br/>&gt;<br/>&gt; I have tryied different solutions (look below) but no one<br/>&gt; loads/display the values of %myparams:<br/>&gt;<br/>&gt; 1) function dosomething<br/>&gt; {<br/>&gt; ($myopt,%myparams) = @_;<br/>&gt; print &quot;opt = $myopt\n&quot;;<br/>&gt; while( my ($k, $v) = each %{$myparams} )<br/>&gt; { print &quot;$k = $v \n&quot;; }<br/>&gt; }<br/>&gt;<br/>&gt; 2) function dosomething<br/>&gt; {<br/>&gt; $myopt = shift;<br/>&gt; %myparams = shift;<br/>&gt; print &quot;opt = $myopt\n&quot;;<br/>&gt; while( my ($k, $v) = each %$myparams )<br/>&gt; { print &quot;$k = $v \n&quot;; }<br/>&gt; }<br/>&gt;<br/>&gt; 3) function dosomething<br/>&gt; {<br/>&gt; use Tie::RefHash;<br/>&gt; ($myopt,%myparams) = @_;<br/>&gt; tie %hash_postparams, &quot;Tie::RefHash&quot;;<br/>&gt; print &quot;opt = $myopt\n&quot;;<br/>&gt; while( my ($k, $v) = each %myparams )<br/>&gt; { print &quot;$k = $v \n&quot;; }<br/>&gt; }<br/>&gt;<br/>&gt; Any idea what I am doing wrong?<br/>&gt;<br/>&gt;<br/>&gt;<br/>&gt; Really thank you in advance,<br/>&gt;<br/>&gt; Alejandro<br/>&gt;<br/>&gt;<br/>&gt; --<br/>&gt; To unsubscribe, e-mail: beginners-cgi-unsubscribe@perl.org<br/>&gt; For additional commands, e-mail: beginners-cgi-help@perl.org<br/>&gt; http://learn.perl.org/<br/>&gt;<br/>&gt;<br/><br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2011/06/msg13571.html Mon, 27 Jun 2011 16:24:33 +0000 Re: sending scalar and hash to function [SUMMARY] by Mike Williams On Mon, Jun 27, 2011 at 2:44 PM, &lt;buzon@alejandro.ceballos.info&gt; wrote:<br/><br/>&gt;<br/>&gt; Found the solution (my apologies).<br/>&gt;<br/>&gt; I am receiving both an scalar, the second one as a reference, then it must<br/>&gt; be assigned to an other var.<br/>&gt;<br/>&gt; No. It does not have to be assigned to another var. Instead you should<br/>dereference the reference.<br/><br/> sub dosomething<br/>&gt; {<br/>&gt; ($myopt,$myparams) = @_;<br/>&gt; ## %myparams = $myparams; # skip the asssignment and creation oa a<br/>&gt; new hash<br/>&gt; print &quot;opt = $myopt\n&quot;;<br/>&gt;<br/><br/> #### while( my ($k, $v) = each %myparams )<br/> while( my ($k, $v) = each %{$myparams} ) # dereference the<br/>reference with %{$ref}<br/><br/>&gt; { print &quot;$k = $v \n&quot;; }<br/>&gt; }<br/>&gt;<br/>&gt;<br/>The assignment you had assigns the hash reference to a key of the hash you<br/>created, with nothing assigned as a value.<br/><br/>It is a real, real bad idea (for many reasons) to create variables of<br/>different types with the same names.<br/><br/>A major benefit of passing a reference is that you only move one item, the<br/>reference, instead of the entire hash. It doesn&#39;t make a lot of difference<br/>in this case, but if you had a hash with thousands of key/value pairs<br/>passing a reference and using that reference uses just a few bytes of<br/>memory. Copying the entire hash uses many thousands of bytes.<br/><br/>Happy hacking,<br/><br/>Mike<br/><br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2011/06/msg13570.html Mon, 27 Jun 2011 13:54:57 +0000 sending scalar and hash to function [SUMMARY] by buzon <br/>Found the solution (my apologies).<br/><br/>I am receiving both an scalar, the second one as a reference, then it <br/>must be assigned to an other var.<br/><br/> sub dosomething<br/> {<br/> ($myopt,$myparams) = @_;<br/> %myparams = $myparams;<br/> print &quot;opt = $myopt\n&quot;;<br/> while( my ($k, $v) = each %myparams )<br/> { print &quot;$k = $v \n&quot;; }<br/> }<br/><br/><br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2011/06/msg13569.html Mon, 27 Jun 2011 11:45:02 +0000 sending scalar and hash to function (note) by buzon of course that is<br/><br/> sub dosomething<br/><br/>but still not working.<br/><br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2011/06/msg13568.html Mon, 27 Jun 2011 11:36:59 +0000 sending scalar and hash to function by buzon I am trying to send an scalar and hash to a function, but is not <br/>receiving the value of the hash<br/><br/>My code is:<br/><br/> dosomething(&#39;option&#39;,{&#39;extraparam1&#39;=&gt;&#39;hello&#39;});<br/><br/> function dosomething<br/> {<br/> ($myopt,%myparams) = @_;<br/> print &quot;opt = $myopt\n&quot;;<br/> while( my ($k, $v) = each %myparams )<br/> { print &quot;$k = $v \n&quot;; }<br/> }<br/><br/>And result is:<br/><br/> opt = option<br/> HASH(0xcb4f490) =<br/> HASH(0xcb4f490) =<br/><br/><br/>I have tryied different solutions (look below) but no one <br/>loads/display the values of %myparams:<br/><br/>1) function dosomething<br/> {<br/> ($myopt,%myparams) = @_;<br/> print &quot;opt = $myopt\n&quot;;<br/> while( my ($k, $v) = each %{$myparams} )<br/> { print &quot;$k = $v \n&quot;; }<br/> }<br/><br/>2) function dosomething<br/> {<br/> $myopt = shift;<br/> %myparams = shift;<br/> print &quot;opt = $myopt\n&quot;;<br/> while( my ($k, $v) = each %$myparams )<br/> { print &quot;$k = $v \n&quot;; }<br/> }<br/><br/>3) function dosomething<br/> {<br/> use Tie::RefHash;<br/> ($myopt,%myparams) = @_;<br/> tie %hash_postparams, &quot;Tie::RefHash&quot;;<br/> print &quot;opt = $myopt\n&quot;;<br/> while( my ($k, $v) = each %myparams )<br/> { print &quot;$k = $v \n&quot;; }<br/> }<br/><br/>Any idea what I am doing wrong?<br/><br/><br/><br/>Really thank you in advance,<br/><br/>Alejandro<br/><br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2011/06/msg13567.html Mon, 27 Jun 2011 11:33:41 +0000 file upload issues! by Rahul!! Hi All,<br/><br/>Actually I am trying to store the file a user has uploaded through web-<br/>page to database. But its not getting updated fully and it&#39;s showing<br/>only few bytes. Point here is user will upload exe or dll and I have<br/>to store it in DB. I am highlighting the code snippet,<br/><br/><br/>//WEB PAGE CODE<br/>&lt;form method=post ENCTYPE=&quot;multipart/form-data&quot;&gt;<br/>&lt;input type=hidden name=type value=&quot;application/octet-stream&quot;&gt;<br/>&lt;b&gt;Path to file:&lt;/b&gt;&lt;br&gt;<br/>&lt;input type=file name=data size=60&gt;&lt;br&gt;&lt;br&gt;<br/><br/>&lt;b&gt;Description&lt;/b&gt;:&lt;br&gt;<br/>&lt;input name=description size=60&gt;&lt;br&gt;&lt;br&gt;<br/>&lt;input type=submit value=&quot;Submit&quot;&gt;<br/>&lt;/form&gt;<br/><br/># CGI code to insert data<br/> my $mimetype = $cgi-&gt;param(&#39;type&#39;);<br/><br/>$dbh-&gt;do&quot;insert into req_attachments&quot;<br/> . &quot; (filename, description, mimetype, submitter_id,<br/>thedata)&quot;<br/> . &quot; values&quot;<br/> . &quot;(&quot;<br/> . $dbh-&gt;quote($fname) . &quot;, &quot;<br/> . $dbh-&gt;quote ($description) . &quot;, &quot;<br/> . $dbh-&gt;quote($mimetype) . &quot;, &quot;<br/> . login_to_id($user-&gt;login) . &quot;, &quot;<br/> . $dbh-&gt;quote($cgi-&gt;param(&#39;data&#39;)) . &quot;)&quot;);<br/><br/>Please let me know if I am doing something is wrong here<br/>-Rahul<br/><br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2011/06/msg13566.html Tue, 14 Jun 2011 09:50:53 +0000 file upload issues! by Rahul!! Hi All,<br/><br/>Actually I am trying to store the file a user has uploaded through web-<br/>page to database. But its not getting updated fully and it&#39;s showing<br/>only few bytes. Point here is user will upload exe or dll and I have<br/>to store it in DB. I am highlighting the code snippet,<br/><br/><br/>//WEB PAGE CODE<br/>&lt;form method=post ENCTYPE=&quot;multipart/form-data&quot;&gt;<br/>&lt;input type=hidden name=type value=&quot;application/octet-stream&quot;&gt;<br/>&lt;b&gt;Path to file:&lt;/b&gt;&lt;br&gt;<br/>&lt;input type=file name=data size=60&gt;&lt;br&gt;&lt;br&gt;<br/><br/>&lt;b&gt;Description&lt;/b&gt;:&lt;br&gt;<br/>&lt;input name=description size=60&gt;&lt;br&gt;&lt;br&gt;<br/>&lt;input type=submit value=&quot;Submit&quot;&gt;<br/>&lt;/form&gt;<br/><br/># CGI code to insert data<br/> my $mimetype = $cgi-&gt;param(&#39;type&#39;);<br/><br/>$dbh-&gt;do&quot;insert into req_attachments&quot;<br/> . &quot; (filename, description, mimetype, submitter_id,<br/>thedata)&quot;<br/> . &quot; values&quot;<br/> . &quot;(&quot;<br/> . $dbh-&gt;quote($fname) . &quot;, &quot;<br/> . $dbh-&gt;quote ($description) . &quot;, &quot;<br/> . $dbh-&gt;quote($mimetype) . &quot;, &quot;<br/> . login_to_id($user-&gt;login) . &quot;, &quot;<br/> . $dbh-&gt;quote($cgi-&gt;param(&#39;data&#39;)) . &quot;)&quot;);<br/><br/>Please let me know if I am doing something is wrong here<br/>-Rahul<br/><br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2011/06/msg13565.html Tue, 14 Jun 2011 09:50:50 +0000 Debian, Apache, Perl, CGI.pm, ErrorDocument, and POST by David Christensen beginners-cgi:<br/><br/>I have a Debian 6.0, Apache 2.2.16, Perl 5.10.1, and CGI.pm 3.43 machine <br/>with a folder containing:<br/><br/><br/>$ cat .htaccess<br/>Options +ExecCGI<br/>AddHandler cgi-script pl<br/>ErrorDocument 404 /cgi.pm-get-post-errordocument/printcgi.pl<br/><br/><br/>$ cat index.html<br/>&lt;html&gt;<br/> &lt;body&gt;<br/> &lt;ul&gt;<br/> &lt;li&gt;direct:<br/> &lt;ul&gt;<br/> &lt;li&gt;GET<br/> &lt;form action=&quot;printcgi.pl&quot; method=&quot;GET&quot;&gt;<br/> &lt;input name=&quot;inputText&quot; type=&quot;text&quot;&gt;<br/> &lt;input name=&quot;inputSubmit&quot; type=&quot;submit&quot;&gt;<br/> &lt;/form&gt;<br/> &lt;/li&gt;<br/> &lt;li&gt;POST<br/> &lt;form action=&quot;printcgi.pl&quot; method=&quot;POST&quot;&gt;<br/> &lt;input name=&quot;inputText&quot; type=&quot;text&quot;&gt;<br/> &lt;input name=&quot;inputSubmit&quot; type=&quot;submit&quot;&gt;<br/> &lt;/form&gt;<br/> &lt;/li&gt;<br/> &lt;/ul&gt;<br/> &lt;/li&gt;<br/> &lt;li&gt;ErrorDocument:<br/> &lt;ul&gt;<br/> &lt;li&gt;GET<br/> &lt;form action=&quot;nosuchfile.pl&quot; method=&quot;GET&quot;&gt;<br/> &lt;input name=&quot;inputText&quot; type=&quot;text&quot;&gt;<br/> &lt;input name=&quot;inputSubmit&quot; type=&quot;submit&quot;&gt;<br/> &lt;/form&gt;<br/> &lt;/li&gt;<br/> &lt;li&gt;POST<br/> &lt;form action=&quot;nosuchfile.pl&quot; method=&quot;POST&quot;&gt;<br/> &lt;input name=&quot;inputText&quot; type=&quot;text&quot;&gt;<br/> &lt;input name=&quot;inputSubmit&quot; type=&quot;submit&quot;&gt;<br/> &lt;/form&gt;<br/> &lt;/li&gt;<br/> &lt;/ul&gt;<br/> &lt;/li&gt;<br/> &lt;/ul&gt;<br/> &lt;/body&gt;<br/>&lt;/html&gt;<br/><br/><br/>$ cat printcgi.pl<br/>#! /usr/bin/perl<br/>use strict;<br/>use warnings;<br/>use CGI;<br/>use Data::Dumper;<br/>use IO::Scalar;<br/>$Data::Dumper::Sortkeys = 1;<br/>my $stdin = join &#39;&#39;, &lt;STDIN&gt;;<br/>my $s;<br/>tie *STDIN, &#39;IO::Scalar&#39;, \$s;<br/>print STDIN $stdin;<br/>tied(*STDIN)-&gt;setpos(0);<br/>my $q= CGI::new();<br/>print $q-&gt;header(&#39;text/plain&#39;),<br/> Data::Dumper-&gt;Dump([$0, \@ARGV, $stdin, \%ENV, $q],<br/> [qw(0 *ARGV STDIN *ENV q)]);<br/><br/><br/><br/>When I browse to index.html, enter data in the text boxes, and click the <br/>submit buttons, the first case (direct hit, GET) works as expected:<br/><br/>$0 = <br/>&#39;/home/dpchrist/sandbox/apache2/public_html/cgi.pm-get-post-errordocument/printcgi.pl&#39;;<br/>@ARGV = ();<br/>$STDIN = &#39;&#39;;<br/>%ENV = (<br/> &#39;DOCUMENT_ROOT&#39; =&gt; &#39;/home/dpchrist/sandbox/apache2/public_html&#39;,<br/> &#39;GATEWAY_INTERFACE&#39; =&gt; &#39;CGI/1.1&#39;,<br/> &#39;HTTP_ACCEPT&#39; =&gt; <br/>&#39;text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&#39;,<br/> &#39;HTTP_ACCEPT_CHARSET&#39; =&gt; &#39;ISO-8859-1,utf-8;q=0.7,*;q=0.7&#39;,<br/> &#39;HTTP_ACCEPT_ENCODING&#39; =&gt; &#39;gzip,deflate&#39;,<br/> &#39;HTTP_ACCEPT_LANGUAGE&#39; =&gt; &#39;en-us,en;q=0.5&#39;,<br/> &#39;HTTP_CONNECTION&#39; =&gt; &#39;keep-alive&#39;,<br/> &#39;HTTP_HOST&#39; =&gt; &#39;apache2-sandbox-p43400e.holgerdanske.com&#39;,<br/> &#39;HTTP_KEEP_ALIVE&#39; =&gt; &#39;300&#39;,<br/> &#39;HTTP_REFERER&#39; =&gt; <br/>&#39;http://apache2-sandbox-p43400e.holgerdanske.com/cgi.pm-get-post-errordocument/&#39;,<br/> &#39;HTTP_USER_AGENT&#39; =&gt; &#39;Mozilla/5.0 (X11; U; Linux i686; en-US; <br/>rv:1.9.1.16) Gecko/20110302 Iceweasel/3.5.16 (like Firefox/3.5.16)&#39;,<br/> &#39;PATH&#39; =&gt; &#39;/usr/local/bin:/usr/bin:/bin&#39;,<br/> &#39;QUERY_STRING&#39; =&gt; &#39;inputText=direct+GET&amp;inputSubmit=Submit+Query&#39;,<br/> &#39;REMOTE_ADDR&#39; =&gt; &#39;192.168.0.34&#39;,<br/> &#39;REMOTE_PORT&#39; =&gt; &#39;58809&#39;,<br/> &#39;REQUEST_METHOD&#39; =&gt; &#39;GET&#39;,<br/> &#39;REQUEST_URI&#39; =&gt; <br/>&#39;/cgi.pm-get-post-errordocument/printcgi.pl?inputText=direct+GET&amp;inputSubmit=Submit+Query&#39;,<br/> &#39;SCRIPT_FILENAME&#39; =&gt; <br/>&#39;/home/dpchrist/sandbox/apache2/public_html/cgi.pm-get-post-errordocument/printcgi.pl&#39;,<br/> &#39;SCRIPT_NAME&#39; =&gt; &#39;/cgi.pm-get-post-errordocument/printcgi.pl&#39;,<br/> &#39;SERVER_ADDR&#39; =&gt; &#39;192.168.0.34&#39;,<br/> &#39;SERVER_ADMIN&#39; =&gt; &#39;[no address given]&#39;,<br/> &#39;SERVER_NAME&#39; =&gt; &#39;apache2-sandbox-p43400e.holgerdanske.com&#39;,<br/> &#39;SERVER_PORT&#39; =&gt; &#39;80&#39;,<br/> &#39;SERVER_PROTOCOL&#39; =&gt; &#39;HTTP/1.1&#39;,<br/> &#39;SERVER_SIGNATURE&#39; =&gt; &#39;&lt;address&gt;Apache/2.2.16 (Debian) Server <br/>at apache2-sandbox-p43400e.holgerdanske.com Port 80&lt;/address&gt;<br/>&#39;,<br/> &#39;SERVER_SOFTWARE&#39; =&gt; &#39;Apache/2.2.16 (Debian)&#39;<br/> );<br/>$q = bless( {<br/> &#39;.charset&#39; =&gt; &#39;ISO-8859-1&#39;,<br/> &#39;.fieldnames&#39; =&gt; {},<br/> &#39;.header_printed&#39; =&gt; 1,<br/> &#39;.parameters&#39; =&gt; [<br/> &#39;inputText&#39;,<br/> &#39;inputSubmit&#39;<br/> ],<br/> &#39;escape&#39; =&gt; 1,<br/> &#39;param&#39; =&gt; {<br/> &#39;inputSubmit&#39; =&gt; [<br/> &#39;Submit Query&#39;<br/> ],<br/> &#39;inputText&#39; =&gt; [<br/> &#39;direct GET&#39;<br/> ]<br/> },<br/> &#39;use_tempfile&#39; =&gt; 1<br/> }, &#39;CGI&#39; );<br/><br/><br/>The second case (direct hit, POST) works as expected:<br/><br/>$0 = <br/>&#39;/home/dpchrist/sandbox/apache2/public_html/cgi.pm-get-post-errordocument/printcgi.pl&#39;;<br/>@ARGV = ();<br/>$STDIN = &#39;inputText=direct+POST&amp;inputSubmit=Submit+Query&#39;;<br/>%ENV = (<br/> &#39;CONTENT_LENGTH&#39; =&gt; &#39;46&#39;,<br/> &#39;CONTENT_TYPE&#39; =&gt; &#39;application/x-www-form-urlencoded&#39;,<br/> &#39;DOCUMENT_ROOT&#39; =&gt; &#39;/home/dpchrist/sandbox/apache2/public_html&#39;,<br/> &#39;GATEWAY_INTERFACE&#39; =&gt; &#39;CGI/1.1&#39;,<br/> &#39;HTTP_ACCEPT&#39; =&gt; <br/>&#39;text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&#39;,<br/> &#39;HTTP_ACCEPT_CHARSET&#39; =&gt; &#39;ISO-8859-1,utf-8;q=0.7,*;q=0.7&#39;,<br/> &#39;HTTP_ACCEPT_ENCODING&#39; =&gt; &#39;gzip,deflate&#39;,<br/> &#39;HTTP_ACCEPT_LANGUAGE&#39; =&gt; &#39;en-us,en;q=0.5&#39;,<br/> &#39;HTTP_CONNECTION&#39; =&gt; &#39;keep-alive&#39;,<br/> &#39;HTTP_HOST&#39; =&gt; &#39;apache2-sandbox-p43400e.holgerdanske.com&#39;,<br/> &#39;HTTP_KEEP_ALIVE&#39; =&gt; &#39;300&#39;,<br/> &#39;HTTP_REFERER&#39; =&gt; <br/>&#39;http://apache2-sandbox-p43400e.holgerdanske.com/cgi.pm-get-post-errordocument/&#39;,<br/> &#39;HTTP_USER_AGENT&#39; =&gt; &#39;Mozilla/5.0 (X11; U; Linux i686; en-US; <br/>rv:1.9.1.16) Gecko/20110302 Iceweasel/3.5.16 (like Firefox/3.5.16)&#39;,<br/> &#39;PATH&#39; =&gt; &#39;/usr/local/bin:/usr/bin:/bin&#39;,<br/> &#39;QUERY_STRING&#39; =&gt; &#39;&#39;,<br/> &#39;REMOTE_ADDR&#39; =&gt; &#39;192.168.0.34&#39;,<br/> &#39;REMOTE_PORT&#39; =&gt; &#39;58810&#39;,<br/> &#39;REQUEST_METHOD&#39; =&gt; &#39;POST&#39;,<br/> &#39;REQUEST_URI&#39; =&gt; &#39;/cgi.pm-get-post-errordocument/printcgi.pl&#39;,<br/> &#39;SCRIPT_FILENAME&#39; =&gt; <br/>&#39;/home/dpchrist/sandbox/apache2/public_html/cgi.pm-get-post-errordocument/printcgi.pl&#39;,<br/> &#39;SCRIPT_NAME&#39; =&gt; &#39;/cgi.pm-get-post-errordocument/printcgi.pl&#39;,<br/> &#39;SERVER_ADDR&#39; =&gt; &#39;192.168.0.34&#39;,<br/> &#39;SERVER_ADMIN&#39; =&gt; &#39;[no address given]&#39;,<br/> &#39;SERVER_NAME&#39; =&gt; &#39;apache2-sandbox-p43400e.holgerdanske.com&#39;,<br/> &#39;SERVER_PORT&#39; =&gt; &#39;80&#39;,<br/> &#39;SERVER_PROTOCOL&#39; =&gt; &#39;HTTP/1.1&#39;,<br/> &#39;SERVER_SIGNATURE&#39; =&gt; &#39;&lt;address&gt;Apache/2.2.16 (Debian) Server <br/>at apache2-sandbox-p43400e.holgerdanske.com Port 80&lt;/address&gt;<br/>&#39;,<br/> &#39;SERVER_SOFTWARE&#39; =&gt; &#39;Apache/2.2.16 (Debian)&#39;<br/> );<br/>$q = bless( {<br/> &#39;.charset&#39; =&gt; &#39;ISO-8859-1&#39;,<br/> &#39;.fieldnames&#39; =&gt; {},<br/> &#39;.header_printed&#39; =&gt; 1,<br/> &#39;.parameters&#39; =&gt; [<br/> &#39;inputText&#39;,<br/> &#39;inputSubmit&#39;<br/> ],<br/> &#39;escape&#39; =&gt; 1,<br/> &#39;param&#39; =&gt; {<br/> &#39;inputSubmit&#39; =&gt; [<br/> &#39;Submit Query&#39;<br/> ],<br/> &#39;inputText&#39; =&gt; [<br/> &#39;direct POST&#39;<br/> ]<br/> },<br/> &#39;use_tempfile&#39; =&gt; 1<br/> }, &#39;CGI&#39; );<br/><br/><br/>The third case (ErrorDocument, GET) works as expected:<br/><br/>$0 = <br/>&#39;/home/dpchrist/sandbox/apache2/public_html/cgi.pm-get-post-errordocument/printcgi.pl&#39;;<br/>@ARGV = ();<br/>$STDIN = &#39;&#39;;<br/>%ENV = (<br/> &#39;DOCUMENT_ROOT&#39; =&gt; &#39;/home/dpchrist/sandbox/apache2/public_html&#39;,<br/> &#39;GATEWAY_INTERFACE&#39; =&gt; &#39;CGI/1.1&#39;,<br/> &#39;HTTP_ACCEPT&#39; =&gt; <br/>&#39;text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&#39;,<br/> &#39;HTTP_ACCEPT_CHARSET&#39; =&gt; &#39;ISO-8859-1,utf-8;q=0.7,*;q=0.7&#39;,<br/> &#39;HTTP_ACCEPT_ENCODING&#39; =&gt; &#39;gzip,deflate&#39;,<br/> &#39;HTTP_ACCEPT_LANGUAGE&#39; =&gt; &#39;en-us,en;q=0.5&#39;,<br/> &#39;HTTP_CONNECTION&#39; =&gt; &#39;keep-alive&#39;,<br/> &#39;HTTP_HOST&#39; =&gt; &#39;apache2-sandbox-p43400e.holgerdanske.com&#39;,<br/> &#39;HTTP_KEEP_ALIVE&#39; =&gt; &#39;300&#39;,<br/> &#39;HTTP_REFERER&#39; =&gt; <br/>&#39;http://apache2-sandbox-p43400e.holgerdanske.com/cgi.pm-get-post-errordocument/&#39;,<br/> &#39;HTTP_USER_AGENT&#39; =&gt; &#39;Mozilla/5.0 (X11; U; Linux i686; en-US; <br/>rv:1.9.1.16) Gecko/20110302 Iceweasel/3.5.16 (like Firefox/3.5.16)&#39;,<br/> &#39;PATH&#39; =&gt; &#39;/usr/local/bin:/usr/bin:/bin&#39;,<br/> &#39;QUERY_STRING&#39; =&gt; &#39;&#39;,<br/> &#39;REDIRECT_QUERY_STRING&#39; =&gt; <br/>&#39;inputText=ErrorDocument+GET&amp;inputSubmit=Submit+Query&#39;,<br/> &#39;REDIRECT_REQUEST_METHOD&#39; =&gt; &#39;GET&#39;,<br/> &#39;REDIRECT_STATUS&#39; =&gt; &#39;404&#39;,<br/> &#39;REDIRECT_URL&#39; =&gt; &#39;/cgi.pm-get-post-errordocument/nosuchfile.pl&#39;,<br/> &#39;REMOTE_ADDR&#39; =&gt; &#39;192.168.0.34&#39;,<br/> &#39;REMOTE_PORT&#39; =&gt; &#39;55219&#39;,<br/> &#39;REQUEST_METHOD&#39; =&gt; &#39;GET&#39;,<br/> &#39;REQUEST_URI&#39; =&gt; <br/>&#39;/cgi.pm-get-post-errordocument/nosuchfile.pl?inputText=ErrorDocument+GET&amp;inputSubmit=Submit+Query&#39;,<br/> &#39;SCRIPT_FILENAME&#39; =&gt; <br/>&#39;/home/dpchrist/sandbox/apache2/public_html/cgi.pm-get-post-errordocument/printcgi.pl&#39;,<br/> &#39;SCRIPT_NAME&#39; =&gt; &#39;/cgi.pm-get-post-errordocument/printcgi.pl&#39;,<br/> &#39;SERVER_ADDR&#39; =&gt; &#39;192.168.0.34&#39;,<br/> &#39;SERVER_ADMIN&#39; =&gt; &#39;[no address given]&#39;,<br/> &#39;SERVER_NAME&#39; =&gt; &#39;apache2-sandbox-p43400e.holgerdanske.com&#39;,<br/> &#39;SERVER_PORT&#39; =&gt; &#39;80&#39;,<br/> &#39;SERVER_PROTOCOL&#39; =&gt; &#39;HTTP/1.1&#39;,<br/> &#39;SERVER_SIGNATURE&#39; =&gt; &#39;&lt;address&gt;Apache/2.2.16 (Debian) Server <br/>at apache2-sandbox-p43400e.holgerdanske.com Port 80&lt;/address&gt;<br/>&#39;,<br/> &#39;SERVER_SOFTWARE&#39; =&gt; &#39;Apache/2.2.16 (Debian)&#39;<br/> );<br/>$q = bless( {<br/> &#39;.charset&#39; =&gt; &#39;ISO-8859-1&#39;,<br/> &#39;.fieldnames&#39; =&gt; {},<br/> &#39;.header_printed&#39; =&gt; 1,<br/> &#39;.parameters&#39; =&gt; [<br/> &#39;inputText&#39;,<br/> &#39;inputSubmit&#39;<br/> ],<br/> &#39;escape&#39; =&gt; 1,<br/> &#39;param&#39; =&gt; {<br/> &#39;inputSubmit&#39; =&gt; [<br/> &#39;Submit Query&#39;<br/> ],<br/> &#39;inputText&#39; =&gt; [<br/> &#39;ErrorDocument GET&#39;<br/> ]<br/> },<br/> &#39;use_tempfile&#39; =&gt; 1<br/> }, &#39;CGI&#39; );<br/><br/><br/>But the fourth case (ErrorDocument, POST) does not work as expected -- <br/>CGI.pm doesn&#39;t see the query parameters available on STDIN:<br/><br/>$0 = <br/>&#39;/home/dpchrist/sandbox/apache2/public_html/cgi.pm-get-post-errordocument/printcgi.pl&#39;;<br/>@ARGV = ();<br/>$STDIN = &#39;inputText=ErrorDocument+POST&amp;inputSubmit=Submit+Query&#39;;<br/>%ENV = (<br/> &#39;CONTENT_LENGTH&#39; =&gt; &#39;53&#39;,<br/> &#39;CONTENT_TYPE&#39; =&gt; &#39;application/x-www-form-urlencoded&#39;,<br/> &#39;DOCUMENT_ROOT&#39; =&gt; &#39;/home/dpchrist/sandbox/apache2/public_html&#39;,<br/> &#39;GATEWAY_INTERFACE&#39; =&gt; &#39;CGI/1.1&#39;,<br/> &#39;HTTP_ACCEPT&#39; =&gt; <br/>&#39;text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&#39;,<br/> &#39;HTTP_ACCEPT_CHARSET&#39; =&gt; &#39;ISO-8859-1,utf-8;q=0.7,*;q=0.7&#39;,<br/> &#39;HTTP_ACCEPT_ENCODING&#39; =&gt; &#39;gzip,deflate&#39;,<br/> &#39;HTTP_ACCEPT_LANGUAGE&#39; =&gt; &#39;en-us,en;q=0.5&#39;,<br/> &#39;HTTP_CONNECTION&#39; =&gt; &#39;keep-alive&#39;,<br/> &#39;HTTP_HOST&#39; =&gt; &#39;apache2-sandbox-p43400e.holgerdanske.com&#39;,<br/> &#39;HTTP_KEEP_ALIVE&#39; =&gt; &#39;300&#39;,<br/> &#39;HTTP_REFERER&#39; =&gt; <br/>&#39;http://apache2-sandbox-p43400e.holgerdanske.com/cgi.pm-get-post-errordocument/&#39;,<br/> &#39;HTTP_USER_AGENT&#39; =&gt; &#39;Mozilla/5.0 (X11; U; Linux i686; en-US; <br/>rv:1.9.1.16) Gecko/20110302 Iceweasel/3.5.16 (like Firefox/3.5.16)&#39;,<br/> &#39;PATH&#39; =&gt; &#39;/usr/local/bin:/usr/bin:/bin&#39;,<br/> &#39;QUERY_STRING&#39; =&gt; &#39;&#39;,<br/> &#39;REDIRECT_REQUEST_METHOD&#39; =&gt; &#39;POST&#39;,<br/> &#39;REDIRECT_STATUS&#39; =&gt; &#39;404&#39;,<br/> &#39;REDIRECT_URL&#39; =&gt; &#39;/cgi.pm-get-post-errordocument/nosuchfile.pl&#39;,<br/> &#39;REMOTE_ADDR&#39; =&gt; &#39;192.168.0.34&#39;,<br/> &#39;REMOTE_PORT&#39; =&gt; &#39;55220&#39;,<br/> &#39;REQUEST_METHOD&#39; =&gt; &#39;GET&#39;,<br/> &#39;REQUEST_URI&#39; =&gt; &#39;/cgi.pm-get-post-errordocument/nosuchfile.pl&#39;,<br/> &#39;SCRIPT_FILENAME&#39; =&gt; <br/>&#39;/home/dpchrist/sandbox/apache2/public_html/cgi.pm-get-post-errordocument/printcgi.pl&#39;,<br/> &#39;SCRIPT_NAME&#39; =&gt; &#39;/cgi.pm-get-post-errordocument/printcgi.pl&#39;,<br/> &#39;SERVER_ADDR&#39; =&gt; &#39;192.168.0.34&#39;,<br/> &#39;SERVER_ADMIN&#39; =&gt; &#39;[no address given]&#39;,<br/> &#39;SERVER_NAME&#39; =&gt; &#39;apache2-sandbox-p43400e.holgerdanske.com&#39;,<br/> &#39;SERVER_PORT&#39; =&gt; &#39;80&#39;,<br/> &#39;SERVER_PROTOCOL&#39; =&gt; &#39;HTTP/1.1&#39;,<br/> &#39;SERVER_SIGNATURE&#39; =&gt; &#39;&lt;address&gt;Apache/2.2.16 (Debian) Server <br/>at apache2-sandbox-p43400e.holgerdanske.com Port 80&lt;/address&gt;<br/>&#39;,<br/> &#39;SERVER_SOFTWARE&#39; =&gt; &#39;Apache/2.2.16 (Debian)&#39;<br/> );<br/>$q = bless( {<br/> &#39;.charset&#39; =&gt; &#39;ISO-8859-1&#39;,<br/> &#39;.fieldnames&#39; =&gt; {},<br/> &#39;.header_printed&#39; =&gt; 1,<br/> &#39;.parameters&#39; =&gt; [],<br/> &#39;escape&#39; =&gt; 1,<br/> &#39;param&#39; =&gt; {},<br/> &#39;use_tempfile&#39; =&gt; 1<br/> }, &#39;CGI&#39; );<br/><br/><br/>I would like the error handler script to be able to see the POST <br/>parameters via CGI.pm.<br/><br/><br/>Any suggestions?<br/><br/><br/>TIA,<br/><br/>David<br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2011/04/msg13564.html Sat, 02 Apr 2011 13:34:57 +0000 Re: PERL CGI SCRIPT killed by apache on client abort by Peter Scott On Sat, 26 Mar 2011 15:56:08 +0100, Przemys&#x142;aw Rejf<br/>wrote:<br/><br/>&gt; My upload script which uses upload hook works really nice. After the<br/>&gt; upload ends it writes some debug stuff to log file and sends some info<br/>&gt; to other host.<br/>&gt; When client aborts the upload the reminder of the script after hook is<br/>&gt; not executed and i get an error in my apache log: [Sat Mar 26 14:53:09<br/>&gt; 2011] [error] [client xxx.xxx.xxx.xxx] (70014)End + of file found: Error<br/>&gt; reading request entity data, referer: http://lo +calhost/upload<br/>&gt; [download]<br/>&gt; I&#39;m thinking its the fault of apache, because without abort the script<br/>&gt; works just fine. Does anyone have any clue about it ? The script:<br/><br/>Your script is invoked to read a file from the client. If the client <br/>doesn&#39;t send it what else would you expect to happen? How can it read a <br/>data stream that&#39;s not there? It&#39;s not apache&#39;s fault, it&#39;s the client&#39;s <br/>fault for not finishing what it said it would do or your script&#39;s fault <br/>for not trapping an exception it needs to handle.<br/><br/><br/><br/><br/>-- <br/>Peter Scott<br/>http://www.perlmedic.com/ http://www.perldebugged.com/<br/>http://www.informit.com/store/product.aspx?isbn=0137001274<br/>http://www.oreillyschool.com/courses/perl3/<br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2011/03/msg13563.html Mon, 28 Mar 2011 02:09:12 +0000 Re: PERL CGI SCRIPT killed by apache on client abort by Mike Williams 2011/3/26 Przemys&#x142;aw Rejf &lt;przemek@rejf.org&gt;:<br/>&gt; Hi,<br/>&gt; My upload script which uses upload hook works really nice. After the upload<br/>&gt; ends it writes some debug stuff to log file and sends some info to other<br/>&gt; host.<br/>&gt; When client aborts the upload the reminder of the script after hook is not<br/>&gt; executed and i get an error in my apache log:<br/>&gt; [Sat Mar 26 14:53:09 2011] [error] [client xxx.xxx.xxx.xxx] (70014)End<br/>&gt; + of file found: Error reading request entity data, referer: http://lo<br/>&gt; +calhost/upload<br/>&gt; [download]<br/>&gt; I&#39;m thinking its the fault of apache, because without abort the script works<br/>&gt; just fine. Does anyone have any clue about it ? The script:<br/><br/>Excuse me if I&#39;ve grabbed the wrong end of the stick here, but it<br/>looks to me like apache is doing the right thing. If the user aborts<br/>the upload then there is an error reading the data, which apache<br/>reports.<br/><br/>From a practical standpoint, if the user aborts the upload, they<br/>should know that they aborted the upload and expect to see an error.<br/>Furthermore, if they aborted the upload, it seems most likely that<br/>they canceled the upload because they realized that they had selected<br/>the wrong file and will try again with the correct file.<br/><br/>What difference does it make whether they get an error from your<br/>script or from apache, if they expected an error and intend to try<br/>again?<br/><br/>Mike<br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2011/03/msg13562.html Sun, 27 Mar 2011 13:11:03 +0000 PERL CGI SCRIPT killed by apache on client abort by Przemysław Rejf Hi,<br/>My upload script which uses upload hook works really nice. After the <br/>upload ends it writes some debug stuff to log file and sends some info <br/>to other host.<br/>When client aborts the upload the reminder of the script after hook is <br/>not executed and i get an error in my apache log:<br/>[Sat Mar 26 14:53:09 2011] [error] [client xxx.xxx.xxx.xxx] (70014)End<br/>+ of file found: Error reading request entity data, referer: http://lo<br/>+calhost/upload<br/>[download]<br/>I&#39;m thinking its the fault of apache, because without abort the script <br/>works just fine. Does anyone have any clue about it ? The script:<br/>#!/usr/bin/perl -w<br/>use strict;<br/>use CGI;<br/>use warnings;<br/>use Digest::MD5 qw(md5_hex);<br/>use POSIX qw/ceil/;<br/>use POSIX &#39;setsid&#39;;<br/>use LWP::Simple;<br/><br/>$CGI::DISABLE_UPLOADS = 0;<br/>$CGI::POST_MAX = 1024 * 1024 * 2000000;<br/><br/>our $php_exec = &#39;/usr/bin/php&#39;;<br/>our $www_root = &#39;www_root&#39;;<br/>our $SERVER_NUMBER = &#39;1&#39;;<br/><br/>our $pid = 666;<br/>our $data;<br/>our $first_hook = 1;<br/>our $sum_bytes = 0;<br/>our $approx_file_size = 0;<br/>our $original_filename = &quot;&quot;;<br/>our $storage_name = &quot;&quot;;<br/>our $db_path = &quot;path where the file with number of stored files is&quot;;<br/>our $upload_path = &quot;path to storage folder&quot;;<br/>our $debug_path = &quot;path to log folder&quot;;<br/>our $url = &#39;&#39;;<br/>our $content = &#39;&#39;;<br/><br/> #zmienna identyfikuj&amp;#261;ca urzytkownika wyci&amp;#261;gni&amp;#281;ta z<br/>+pola GET<br/> my $query_string = $ENV{QUERY_STRING};<br/> my $sessid = $query_string;<br/> my $upload_session = $query_string;<br/> $sessid =~ m/userid=([0-9]+)/i;<br/> our $userid = $1;<br/><br/> $upload_session =~ m/us=([a-zA-Z0-9]+)/i;<br/> our $upload_sess = $1;<br/><br/> my $line = 0;<br/> #zmiana aktualnej ilo&amp;#347;ci plik&oacute;w przechowywanych na serwerze<br/> open(UPLOAD_DB, &quot;+&lt;&quot;, $db_path.&quot;upload_db&quot;) or die &quot;Cannot open :<br/>+$!&quot;;<br/> flock(UPLOAD_DB, 2);<br/> $line = &lt;UPLOAD_DB&gt;;<br/> our $filenumber = $line + 1;<br/> seek(UPLOAD_DB, 0, 0); truncate(UPLOAD_DB, 0);<br/> print UPLOAD_DB $filenumber;<br/> close UPLOAD_DB;<br/><br/> our $dir = ceil($filenumber/5);<br/> unless (-d $upload_path.$dir)<br/> {<br/> mkdir $upload_path.$dir, 0777;<br/> #print $!;<br/> }<br/> $upload_path = $upload_path.$dir.&quot;/&quot;;<br/> our $logfile = $debug_path.&quot;hook_debug.txt&quot;;<br/> our $q = CGI-&gt;new(\&amp;hook, $logfile, 0);<br/><br/> sub hook<br/> {<br/> our ($filename, $buffer, $bytes_read, $logfile) = @_;<br/>+<br/> $sum_bytes = $bytes_read;<br/> if($first_hook)<br/> {<br/> $approx_file_size = $ENV{CONTENT_LENGTH};<br/> #print $approx_file_size.&#39;\n&lt;br /&gt;&#39;;<br/> $approx_file_size -= 197;<br/> $original_filename = $filename;<br/> $filename =~ s/^\s+|\s+$//g ;<br/> $storage_name = md5_hex($filename.&quot;salt666&quot;.$filenumbe<br/>+r);<br/><br/> open(UPLOADFILE, &quot;&gt;&gt;&quot;, $upload_path.$storage_name );<br/> chmod 0777, $upload_path.$storage_name;<br/> binmode UPLOADFILE;<br/> print UPLOADFILE $buffer;<br/> close UPLOADFILE;<br/> $first_hook = 0;<br/> }else{<br/> open(DEBUG, &quot;&gt;&gt;&quot;, $debug_path.&quot;abort_debug.txt&quot; );<br/> binmode DEBUG;<br/> print DEBUG &quot;BR: &quot;;<br/> print DEBUG &quot;$bytes_read\n&quot;;<br/> close DEBUG;<br/><br/> open(UPLOADFILE, &quot;&gt;&gt;&quot;, $upload_path.$storage_name );<br/> binmode UPLOADFILE;<br/> print UPLOADFILE $buffer;<br/> close UPLOADFILE;<br/><br/> if (($buffer eq &#39;&#39;) == 1)<br/> {<br/> unlink($upload_path.$storage_name);<br/> open(DEBUG, &quot;&gt;&gt;&quot;, $debug_path.&quot;abort_debug.txt&quot; );<br/> binmode DEBUG;<br/> print DEBUG &quot;error file upload aborted\n&quot;;<br/> close DEBUG;<br/> exit 0;<br/> }<br/> }<br/> }<br/> open(DEBUG, &quot;&gt;&gt;&quot;, $debug_path.&quot;end_debug.txt&quot; );<br/> binmode DEBUG;<br/> print DEBUG &quot;END\n#\n&quot;;<br/> close DEBUG;<br/> print &quot;Content-type: text/html\n\n END&quot;;<br/> exit;<br/><br/>Thank for replies,<br/>Best regards.<br/><br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2011/03/msg13561.html Sun, 27 Mar 2011 05:44:37 +0000 Re: when javascript is disabled in browser by J Alejandro Ceballos Z Use<br/><br/>&lt;noscript&gt;Javascript disabled&lt;/noscript&gt;<br/><br/><br/>Atentamente,<br/><br/>J. Alejandro Ceballos Z.<br/><br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2011/03/msg13560.html Thu, 17 Mar 2011 06:31:28 +0000 Re: when javascript is disabled in browser by David Christensen On 03/14/2011 06:25 AM, Rahul!! wrote:<br/>&gt; I am new to cgi-perl web development. When javascript is disabled in<br/>&gt; the browser, how to validate it from the CGI file?? I want to do<br/>&gt; something like this,<br/>&gt;<br/>&gt; if (/javascript is disabled){<br/>&gt; print &quot;&lt;br&gt; This webapp needs javascript, please enableable<br/>&gt; javascript and retry&quot;;<br/>&gt; exit;<br/>&gt; }else<br/>&gt; #move on<br/>&gt; }<br/><br/>I&#39;d look into the NOSCRIPT tag:<br/><br/> http://www.w3.org/TR/html4/interact/scripts.html#edef-NOSCRIPT<br/><br/><br/>HTH,<br/><br/>David<br/><br/><br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2011/03/msg13559.html Mon, 14 Mar 2011 15:24:24 +0000 when javascript is disabled in browser by Rahul!! I am new to cgi-perl web development. When javascript is disabled in<br/>the browser, how to validate it from the CGI file?? I want to do<br/>something like this,<br/><br/>if (/javascript is disabled){<br/> print &quot;&lt;br&gt; This webapp needs javascript, please enableable<br/>javascript and retry&quot;;<br/> exit;<br/>}else<br/>#move on<br/>}<br/><br/> http://www.nntp.perl.org/group/perl.beginners.cgi/2011/03/msg13558.html Mon, 14 Mar 2011 15:08:54 +0000