Re: How do you run libapreq-0.31/eg/perl/file_upload.pl

2001-01-10 Thread Alexander Farber

> Alexander Farber wrote:
> > The only ways to see the expected results (like the initial empty web
> > form, when entering http://localhost/cgi-perl/file_upload.pl into my
> > Netscape 4.7) is to keep reloading or to go to the Edit->Preferences->
> > Advanced->Cache and swith "Every Time" on.
> 
> The currently missing 
> 
> 
> 

Gerd, you are correct! I totally overlooked it and was staring at the headers.

Doug, don't you want to add "print '';" to the end of your file
libapreq-0.31/eg/perl/file_upload.pl?



RE: How do you run libapreq-0.31/eg/perl/file_upload.pl

2001-01-10 Thread Geoffrey Young



> -Original Message-
> From: Gerd Kortemeyer [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, January 09, 2001 6:43 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: How do you run libapreq-0.31/eg/perl/file_upload.pl
> 

> 
> might help the browser to figure out that the first page is 
> over. Also, if
> nothing helps, send an explicit no-cache in the header:
> 
> $r->content_type('text/html');
> $r->header_out('Cache-control','no-cache');
> $r->header_out('Pragma','no-cache');
> $r->send_http_header;

all of that can be accomplished with 
  $r->no_cache(1);
  $r->send_http_header('text/html');

--Geoff

> 
> - Gerd.
> 



Re: How do you run libapreq-0.31/eg/perl/file_upload.pl

2001-01-09 Thread Gerd Kortemeyer

Alexander Farber wrote:

> However I have this strange problem now: the web page doesn't change
> until I reload it. (Un)commenting "PerlSendHeader On" doesn't help.
> The only ways to see the expected results (like the initial empty web
> form, when entering http://localhost/cgi-perl/file_upload.pl into my
> Netscape 4.7) is to keep reloading or to go to the Edit->Preferences->
> Advanced->Cache and swith "Every Time" on.
> 
> ...
> GET /cgi-perl/file_upload.pl HTTP/1.1
> 
> 

The currently missing 




might help the browser to figure out that the first page is over. Also, if
nothing helps, send an explicit no-cache in the header:

$r->content_type('text/html');
$r->header_out('Cache-control','no-cache');
$r->header_out('Pragma','no-cache');
$r->send_http_header;

- Gerd.

begin:vcard 
n:Kortemeyer;Gerd
tel;fax:(517) 432-2175
tel;work:(517) 432-5468
x-mozilla-html:TRUE
url:http://www.lite.msu.edu/kortemeyer/
org:Michigan State University;LITE Lab
adr:;;123 North Kedzie Labs;East Lansing;Michigan;48824;USA
version:2.1
email;internet:[EMAIL PROTECTED]
title:Instructional Technology Specialist
x-mozilla-cpt:;3
fn:Gerd Kortemeyer
end:vcard



RE: How do you run libapreq-0.31/eg/perl/file_upload.pl

2001-01-09 Thread Alexander Farber

Hi,

> well, almost...  either change that to a  directive or remove the
> filename from the  directive, so that Apache::Request applies to
> all scripts within cgi-bin...
> 
> see http://perl.apache.org/guide/config.html for more details...

thank you for your reply. I have changed  to  and
also moved the file_upload.pl into /cgi-perl/ to avoid any collisions
with the settings of the /cgi-bin/ directory:

  PerlWarn On

  Alias /cgi-perl/ /var/www/cgi-perl/

  
  SetHandler perl-script
  PerlHandler Apache::Registry
  Options ExecCGI
  #PerlSendHeader On
  


However I have this strange problem now: the web page doesn't change
until I reload it. (Un)commenting "PerlSendHeader On" doesn't help.
The only ways to see the expected results (like the initial empty web
form, when entering http://localhost/cgi-perl/file_upload.pl into my
Netscape 4.7) is to keep reloading or to go to the Edit->Preferences->
Advanced->Cache and swith "Every Time" on.

I am using OpenBSD 2.8 with the native Apache 1.3.12 and Perl 5.6.0
and the mod_perl 1.24 from its ports at home and I have the same
problem with Apache 1.3.14/Perl 5.6.0/mod_perl 1.24_01 installed
in my home dir at work - on a Solaris 2.6/Sparc workstation.

I decided to ask on this list first, before following the instructions
at http://perl.apache.org/guide/debug.html because nothing seems to be
broken - there is just something wrong with headers or similar... I
probably miss something obvious... Here's what I get when telnetting:

alex:alex {105} telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /cgi-perl/file_upload.pl HTTP/1.1
Host: localhost

HTTP/1.1 200 OK
Date: Tue, 09 Jan 2001 20:09:42 GMT
Server: Apache/1.3.12 (Unix) mod_perl/1.24 mod_ssl/2.6.6 OpenSSL/0.9.5a
Transfer-Encoding: chunked
Content-Type: text/html

209

File Upload Example

File Upload Example

Enter the file to process:

count lines
count words
count characters




0
^D
Connection closed by foreign host.

Regards
Alex

PS: I have put my config file and the example script at
http://home.t-online.de/home/Alexander.Farber/httpd.conf
http://home.t-online.de/home/Alexander.Farber/file_upload.pl
(they will propagate there in few minutes)



RE: How do you run libapreq-0.31/eg/perl/file_upload.pl ?

2001-01-04 Thread Michael

> > but maybe someone can provide 
> > me a small kick-start? Thank you
> 
short answer -- you don't need anything more that some simple 
scripting. Nothing at all in the server start up file.

client html file






server side
BEGIN {
  use Apache;
  use Apache::Request;
# etc.
}

my $r = Apache->request;
my $apr = Apache::Request->new($r);

@_ = $apr->param;   # get the query parmaters
foreach(@_) {
  $qs{$_} = $apr->param($_);
}

open(F,'>somefiletosave.xxx');
my $uploadhandle = $apr->upload->fh;
select F;
$| = 1;
select STDOUT;
while(read($fh,$_,1000)) {
  print F $_;
}
close F;
# bye now.
1;

This is short and sweet. It's up to you to insert appropriate error 
checking and failure escapes
[EMAIL PROTECTED]



RE: How do you run libapreq-0.31/eg/perl/file_upload.pl ?

2001-01-04 Thread Geoffrey Young



> -Original Message-
> From: Alexander Farber (EED) [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 04, 2001 4:58 AM
> To: [EMAIL PROTECTED]
> Subject: How do you run libapreq-0.31/eg/perl/file_upload.pl ?
> 
[snip]
> 
> 2) After putting 
> 
> PerlModule Apache::Request
> 
> SetHandler perl-script
> PerlHandler Apache::Request
> 

that won't work - Apache::Request is not a PerlHandler.  remember that
Perl*Handlers default to calling handler(), which Apache::Request doesn't
have (which is exactly what your error_log says)

> 
> into my httpd.conf, I get the following in my error_log:
> 
> [Thu Jan  4 10:47:39 2001] [notice] Apache/1.3.14 (Unix) 
> mod_perl/1.24_01 configured
> -- resuming normal operations
> [Thu Jan  4 10:47:51 2001] [error] Undefined subroutine 
> &Apache::Request::handler cal
> led.
> 
[snip]
> 3) And the:
> 
> PerlModule Apache::Request
> PerlModule Apache::Registry
> 
> SetHandler perl-script
> PerlHandler Apache::Registry
> Options ExecCGI
> PerlSendHeader On
> 

well, almost...  either change that to a  directive or remove the
filename from the  directive, so that Apache::Request applies to
all scripts within cgi-bin...

see http://perl.apache.org/guide/config.html for more details...

> 
> Displays the web form, but nothing happens (same form
> displayed again), when I click the "Process File" button 
> and nothing is shown in the error_log.
> 
> Also I have sometimes to reload several times to see a change.
> 
> Should I wrap the code in the file_upload.pl into a "package"?

no - keep it simple while you figure things out...

> Can't I use Apache::Request w/o Apache::Registry? 

Apache::Request can be used without Apache::Registry, as long as you use it
properly.  They aren't the same type of module - compare man Apache::Request
and man Apache::Registry

> Am I loading
> the modules wrong way?
> 
> I should of course read and re-read the complete guide and 
> finish the Eagle book (I will),

yes :)

> but maybe someone can provide 
> me a small kick-start? Thank you

HTH

--Geoff

> 
> Regards
> Alex
>