RE: Where can I find....
-Original Message- From: Michael [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 28, 2000 6:06 PM To: [EMAIL PROTECTED] Subject: Re: Where can I find Thanks, I have the complete list. It is given in man Apache::Constants What I'm trying to do is figure out how to use them. The two above OK, and DECLINED can be returned to an internal call from the auth portion of Apache and will allow it to proceed or bomb. I'd like to find out what the rest do. From their names many of them appear like they could be quite useful. get a copy of the Eagle book (www.modperl.com) and read it thoroughly - it has something to say about just about all of them. --Geoff Michael [EMAIL PROTECTED]
Re: Where can I find....
Look at the RFC of HTTP Michael wrote: Where can I find documentation on the how to use all the values that appear in Apache::Constants The obviously do something, but what??? I figured out what OK, DECLINED do by reading the source, but what about all the rest. Are they described somewhere?? [EMAIL PROTECTED] -- Don't be irreplaceable, if you can't be replaced, you can't be promoted.
$:: problem in Converting CGI to Apache::Registry
I've installed a webring management system, works ok under CGI. It uses $::vars everywhere. Under mod_perl / Apache::Registry these variables are not populated, I understand because mod_perl is the Main package. Any suggestions for a quick fix ? (Win 32, ActiveState 623 Perl, Apache 3.14, Mod_perl 1.24_02-dev) Thanks Rod
Re: File Upload problems
cbell wrote: Everytime I try to upload a file, the browser will stall a couple of times, and the file ends up on the server as a zero byte file. How about: # Upload Procedure my $buffer; my $inputfile = upload ('uploaded_file'); open (OUTFILE,"$ENV{DOCUMENT_ROOT}/images/test.gif") or die "Can not write to file because of $!"; binmode OUTFILE; binmode $inputfile; while (read($inputfile,$buffer,1024)) { print OUTFILE $buffer; } ## end while close OUTFILE;
Re: XMas printing benchmark
Perrin Harkins wrote: I know it's not the point, but I'd consider it poor style if I saw someone using anything other than a HERE doc for the job you're testing. Why? With HERE you can't indent your code: my @text = ( "!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\"\n", "HTML\n", " HEAD\n", "TITLE\n", " Test page\n",
Re: XMas printing benchmark
Since when??? I've always done... print"end_o_doc"; form action="../scripts/pgr_req03.cgi" method="post" table border="0" cellpadding="0" cellspacing="0" width="100%" tr td colspan="4" div align="left" font face="Arial" size="4" color="#80" strongIndividual Requesting the Service:/strong /font br font face="Arial" size="2" color="#ff" em(Person filling out this form)/em /font /div /td /tr tr tdRequestor's Name/td tdinput type="text" name="req_name" value="$ldap_requestor{'fullname'}"/td tdRequestor's Employee #/td tdinput type="text" name="req_empno" value="$ldap_requestor{'uid'}"/td /tr tr tdRequestor's Phone/td tdinput type="text" name="req_phone" value="$ldap_requestor{'telephonenumber'}"/td tdRequestor's E-mail Address/td tdinput type="text" name="req_email" value="$ldap_requestor{'mail'}"/td /tr end_o_doc ; which works quite nicely and provides a very neat and indented source page. It also allows me to use quotes without an escape character. The only thing you _MUST_ have in column 1 is the "end_o_doc" indicating the end of the text. Problems with this??? Ron "Alexander Farber (EED)" wrote: Perrin Harkins wrote: I know it's not the point, but I'd consider it poor style if I saw someone using anything other than a HERE doc for the job you're testing. Why? With HERE you can't indent your code: my @text = ( "!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\"\n", "HTML\n", " HEAD\n", "TITLE\n", " Test page\n",
Re: XMas printing benchmark
Ron Beck wrote: Since when??? I've always done... print"end_o_doc"; form action="../scripts/pgr_req03.cgi" method="post" ... Problems with this??? Ron I mean indenting code, not data. "Alexander Farber (EED)" wrote: Why? With HERE you can't indent your code: my @text = ( "!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\"\n", "HTML\n", " HEAD\n", "TITLE\n", " Test page\n",
Re: File Upload problems
I think that was it!!! I wasn't closing the file after uploading it, thanks alot "Alexander Farber (EED)" wrote: cbell wrote: Everytime I try to upload a file, the browser will stall a couple of times, and the file ends up on the server as a zero byte file. How about: # Upload Procedure my $buffer; my $inputfile = upload ('uploaded_file'); open (OUTFILE,"$ENV{DOCUMENT_ROOT}/images/test.gif") or die "Can not write to file because of $!"; binmode OUTFILE; binmode $inputfile; while (read($inputfile,$buffer,1024)) { print OUTFILE $buffer; } ## end while close OUTFILE;
problems with mod_perl
Hi, My name is Peter. I am trying to configure my mod_perl for my Linux 6.2. I have encountered the problems with carrying out: perl Makefile.PL APACHE_SRC=../apache_1.3.6/src \ DO_HTTPD=1 USE_APACI=1 EVERYTHING=1 Also, I am have problems with the "make" portion of the configuration. I have recorded the results on the following URL: http://home.netvigator.com/~yungp/my_perl.html If anyone has time, it would be appreciated if anyone could look at it and offer some helpful suggestions. I am a newbie at this. Thanks Peter
Re: problems with mod_perl
Did you tried using apache_1.3.14? -- Daniel Alejandro Grunblatt COO - Portal InfoNegocio. Tel: (+54-11) 4332-3332 Cel: (+54-11) 41461971. Dir: Tucuman 1 piso 5. CP: C1049AAA. On Sat, 30 Dec 2000, Yung Kwong Wing wrote: Hi, My name is Peter. I am trying to configure my mod_perl for my Linux 6.2. I have encountered the problems with carrying out: perl Makefile.PL APACHE_SRC=../apache_1.3.6/src \ DO_HTTPD=1 USE_APACI=1 EVERYTHING=1 Also, I am have problems with the "make" portion of the configuration. I have recorded the results on the following URL: http://home.netvigator.com/~yungp/my_perl.html If anyone has time, it would be appreciated if anyone could look at it and offer some helpful suggestions. I am a newbie at this. Thanks Peter
Re: XMas printing benchmark
How about this: ### Code: (my $text ='foo') =~ s/^\s+://mg; :h1Hello, World!/h1 : pa href="http://foo.org/"I/a am an indented link./p : pSo am a href="http://bar.org/"I/a./p foo print $text; ### Output: h1Hello, World!/h1 pa href="http://foo.org/"I/a am an indented link./p pSo am a href="http://bar.org/"I/a./p (darren) The only thing you _MUST_ have in column 1 is the "end_o_doc" indicating the end of the text. Problems with this??? Ron "Alexander Farber (EED)" wrote: Perrin Harkins wrote: I know it's not the point, but I'd consider it poor style if I saw someone using anything other than a HERE doc for the job you're testing. Why? With HERE you can't indent your code: my @text = ( "!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\"\n", "HTML\n", " HEAD\n", "TITLE\n", " Test page\n", -- Eschew obfuscation.
Re: problems with mod_perl
Yung Kwong Wing ([EMAIL PROTECTED]) said something to this effect on 12/29/2000: I have encountered the problems with carrying out: Here is your answer: configure:Error: No such rule named 'EXPAT' Checking for LWP::UserAgent..failed Checking for HTML::HeadParserfailed The Expat error is because you are using an old version of Apache; use a newer version (it's at 1.3.14 now) and install libwww and the required HTML modules. Also, be sure to so a "make install" from the mod_perl directory before you run make in the Apache source directory! Otherwise your mod_perl stuff will not be put into the Apache tree. (darren) -- Reisner's Rule of Conceptual Inertia: If you think big enough, you'll never have to do it.
RE: Where can I find....
-Original Message- From: Michael [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 28, 2000 6:06 PM To: [EMAIL PROTECTED] Subject: Re: Where can I find Thanks, I have the complete list. It is given in man Apache::Constants What I'm trying to do is figure out how to use them. The two above OK, and DECLINED can be returned to an internal call from the auth portion of Apache and will allow it to proceed or bomb. I'd like to find out what the rest do. From their names many of them appear like they could be quite useful. get a copy of the Eagle book (www.modperl.com) and read it thoroughly - it has something to say about just about all of them. GREAT I have the Eagle book and lo and behold on page 66+ and Chap 9 all is detailed Just needed a little nudge to look in the right place. Thanks Guys :-) Michael [EMAIL PROTECTED]
[OT] Here document indenting (Was: XMas printing benchmark)
Hello, DC(my $text ='foo') =~ s/^\s+://mg; DC:h1Hello, World!/h1 DC: pa href="http://foo.org/"I/a am an indented link./p DC: pSo am a href="http://bar.org/"I/a./p DCfoo DCprint $text; This, and other methods (without the beginning colon, for example) are discussed in recipe 1.11 of the Perl Cookbook. If you just want to indent your code, and don't care about the indentation of the HTML, you can do something less expensive (let's pretend the above was in a loop, or had interpolated variables, in which case the regex could be potentially expensive): print"EndHTML"; pThis HTML code will appear indented in the output. But, the ending delimiter can also be delimited, yay./p EndHTML The only bad thing is that you have to count spaces carefully. Also if you DO indent your HTML (pretty rare as I've observed in dynamically generated pages that aren't templatized), you get slightly ugly code like this: print"EndHTML"; pThe HTML I'm outputting dictates that this lt;pgt; appears at the indent level shown here. This makes my code ugly./p EndHTML That's still better IMO than this: printEndHTML; pThe HTML I'm outputting dictates that this lt;pgt; appears at the indent level shown here. This makes my code ugly./p EndHTML Because the latter totally destroys your identation. FWIW, Ruby (http://www.ruby-lang.org/) has a nice abbreviation for the indented delimiter--if you use an end token with a prepended hyphen, it lets you indent the end token. Example: print -EndHTML pThis HTML code will appear indented in the output. In Ruby, this is slightly neater than the equivalent Perl syntax./p EndHTML This would be a great feature to port to Perl; it eliminates the tedious "how many spaces did I indent?" problem which results in a "Can't find string terminator..." error. Oddly enough, Ruby will complain, though, if you omit the space between the print and the . Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --
Re: XMas printing benchmark
On Fri, 29 Dec 2000, Alexander Farber (EED) wrote: Why? With HERE you can't indent your code: Left-aligning the final line never really bothered me, since it doesn't bother emacs. To each their own I guess. I find the HERE doc to be one of the nicest Perl idioms. - Perrin
Re: problems with mod_perl
Thanks for your reply. So, how do I uninstall the old apache and install the new one or how do I uninstall this mod_perl? Peter On Fri, 29 Dec 2000, darren chamberlain wrote: Yung Kwong Wing ([EMAIL PROTECTED]) said something to this effect on 12/29/2000: I have encountered the problems with carrying out: Here is your answer: configure:Error: No such rule named 'EXPAT' Checking for LWP::UserAgent..failed Checking for HTML::HeadParserfailed The Expat error is because you are using an old version of Apache; use a newer version (it's at 1.3.14 now) and install libwww and the required HTML modules. Also, be sure to so a "make install" from the mod_perl directory before you run make in the Apache source directory! Otherwise your mod_perl stuff will not be put into the Apache tree. (darren) -- Reisner's Rule of Conceptual Inertia: If you think big enough, you'll never have to do it.
Re: problems with mod_perl
OH I forgot to ask. How do I install the libww and the required HTML modules? Exactly what modules do they need? On Fri, 29 Dec 2000, darren chamberlain wrote: Yung Kwong Wing ([EMAIL PROTECTED]) said something to this effect on 12/29/2000: I have encountered the problems with carrying out: Here is your answer: configure:Error: No such rule named 'EXPAT' Checking for LWP::UserAgent..failed Checking for HTML::HeadParserfailed The Expat error is because you are using an old version of Apache; use a newer version (it's at 1.3.14 now) and install libwww and the required HTML modules. Also, be sure to so a "make install" from the mod_perl directory before you run make in the Apache source directory! Otherwise your mod_perl stuff will not be put into the Apache tree. (darren) -- Reisner's Rule of Conceptual Inertia: If you think big enough, you'll never have to do it.
directive handlers + LoadModule foo_module
this was reported a few times, with php as the suspect, but it happens with any LoadModule config. problem was that the xs module structure was only added to the Apache module list once at startup. it needs to be removed/added each time apache is restarted, patch below does that. Index: lib/Apache/ExtUtils.pm === RCS file: /home/cvs/modperl/lib/Apache/ExtUtils.pm,v retrieving revision 1.21 diff -u -r1.21 ExtUtils.pm --- lib/Apache/ExtUtils.pm 2000/12/23 02:23:09 1.21 +++ lib/Apache/ExtUtils.pm 2000/12/30 05:00:48 @@ -122,6 +122,9 @@ sub xs_cmd_table { my($self, $class, $cmds) = @_; (my $modname = $class) =~ s/::/__/g; +(my $pmname = $class) =~ s,::,/,g; +$pmname .= '.pm'; + my $cmdtab = ""; my $infos = ""; @@ -252,6 +255,25 @@ NULL, /* [1] post read_request handling */ }; +#define this_module "$pmname" + +static void remove_module_cleanup(void *data) +{ +if (find_linked_module("$class")) { +/* need to remove the module so module index is reset */ +remove_module(XS_${modname}); +} +if (data) { +/* make sure BOOT section is re-run on restarts */ +(void)hv_delete(GvHV(incgv), this_module, +strlen(this_module), G_DISCARD); + if (dowarn) { + /* avoid subroutine redefined warnings */ + perl_clear_symtab(gv_stashpv("$class", FALSE)); + } +} +} + MODULE = $classPACKAGE = $class PROTOTYPES: DISABLE @@ -260,14 +282,14 @@ XS_${modname}.name = "$class"; add_module(XS_${modname}); stash_mod_pointer("$class", XS_${modname}); +register_cleanup(perl_get_startup_pool(), (void *)1, + remove_module_cleanup, null_cleanup); void END() CODE: -if (find_linked_module("$class")) { -remove_module(XS_${modname}); -} +remove_module_cleanup(NULL); EOF } Index: src/modules/perl/mod_perl.h === RCS file: /home/cvs/modperl/src/modules/perl/mod_perl.h,v retrieving revision 1.106 diff -u -r1.106 mod_perl.h --- src/modules/perl/mod_perl.h 2000/12/20 07:24:43 1.106 +++ src/modules/perl/mod_perl.h 2000/12/30 05:00:52 @@ -1210,6 +1210,7 @@ void perl_perl_cmd_cleanup(void *data); void perl_section_self_boot(cmd_parms *parms, void *dummy, const char *arg); +void perl_clear_symtab(HV *symtab); CHAR_P perl_section (cmd_parms *cmd, void *dummy, CHAR_P arg); CHAR_P perl_end_section (cmd_parms *cmd, void *dummy); CHAR_P perl_pod_section (cmd_parms *cmd, void *dummy, CHAR_P arg); Index: src/modules/perl/perl_config.c === RCS file: /home/cvs/modperl/src/modules/perl/perl_config.c,v retrieving revision 1.107 diff -u -r1.107 perl_config.c --- src/modules/perl/perl_config.c 2000/09/28 03:53:01 1.107 +++ src/modules/perl/perl_config.c 2000/12/30 05:00:52 @@ -1675,7 +1675,7 @@ } } -static void clear_symtab(HV *symtab) +void perl_clear_symtab(HV *symtab) { SV *val; char *key; @@ -1686,6 +1686,7 @@ SV *sv; HV *hv; AV *av; + CV *cv; dTHR; if((SvTYPE(val) != SVt_PVGV) || GvIMPORTED((GV*)val)) @@ -1696,6 +1697,8 @@ hv_clear(hv); if((av = GvAV((GV*)val))) av_clear(av); + if((cv = GvCV((GV*)val))) + cv_undef(cv); } } @@ -1830,7 +1833,7 @@ if(usv SvTRUE(usv)) ; /* keep it around */ else - clear_symtab(symtab); + perl_clear_symtab(symtab); } return NULL; }
Re: segmentation fault when using custom config module
On Wed, 29 Nov 2000, Dave Rolsky wrote: I created a module that contains custom configs with the following code: i cannot reproduce this with or without the patch just posted. i did have to change this line for it to run: $AH = HTML::Mason::ApacheHandler( interp = $interp ); to: $AH = HTML::Mason::ApacheHandler-new( interp = $interp ); but it only caused a server error, no core dump. give the patch a shot anyhow, if you're still having this problem, we'll need a stack trace (see SUPPORT).
cvs commit: modperl/src/modules/perl Apache.xs
dougm 00/12/29 09:10:09 Modified:.Changes src/modules/perl Apache.xs Log: allow $r-finfo to be modified Revision ChangesPath 1.565 +2 -0 modperl/Changes Index: Changes === RCS file: /home/cvs/modperl/Changes,v retrieving revision 1.564 retrieving revision 1.565 diff -u -r1.564 -r1.565 --- Changes 2000/12/23 02:23:07 1.564 +++ Changes 2000/12/29 17:10:06 1.565 @@ -10,6 +10,8 @@ =item 1.24_02-dev +allow $r-finfo to be modified + if Perl is linked with -lpthread, then httpd needs to be linked with -lpthread, make sure that happens with USE_DSO=1, warn if USE_APXS=1 1.119 +17 -1 modperl/src/modules/perl/Apache.xs Index: Apache.xs === RCS file: /home/cvs/modperl/src/modules/perl/Apache.xs,v retrieving revision 1.118 retrieving revision 1.119 diff -u -r1.118 -r1.119 --- Apache.xs 2000/12/22 20:56:24 1.118 +++ Apache.xs 2000/12/29 17:10:08 1.119 @@ -1906,10 +1906,26 @@ # struct stat finfo;/* ST_MODE set to zero if no such file */ SV * -finfo(r) +finfo(r, sv_statbuf=Nullsv) Apache r +SV *sv_statbuf CODE: +if (sv_statbuf) { +if (SvROK(sv_statbuf) SvOBJECT(SvRV(sv_statbuf))) { +STRLEN sz; +char *buf = SvPV((SV*)SvRV(sv_statbuf), sz); +if (sz != sizeof(r-finfo)) { +croak("statbuf size mismatch, got %d, wanted %d", + sz, sizeof(r-finfo)); +} +memcpy(r-finfo, buf, sz); +} +else { +croak("statbuf is not an object"); +} +} + statcache = r-finfo; if (r-finfo.st_mode) { laststatval = 0;
cvs commit: modperl/src/modules/perl mod_perl.h perl_config.c
dougm 00/12/29 21:09:01 Modified:.Changes lib/Apache ExtUtils.pm src/modules/perl mod_perl.h perl_config.c Log: fix directive handlers bug triggered by LoadModule foo_module Revision ChangesPath 1.566 +2 -0 modperl/Changes Index: Changes === RCS file: /home/cvs/modperl/Changes,v retrieving revision 1.565 retrieving revision 1.566 diff -u -r1.565 -r1.566 --- Changes 2000/12/29 17:10:06 1.565 +++ Changes 2000/12/30 05:08:55 1.566 @@ -10,6 +10,8 @@ =item 1.24_02-dev +fix directive handlers bug triggered by LoadModule foo_module + allow $r-finfo to be modified if Perl is linked with -lpthread, then httpd needs to be linked with 1.22 +25 -3 modperl/lib/Apache/ExtUtils.pm Index: ExtUtils.pm === RCS file: /home/cvs/modperl/lib/Apache/ExtUtils.pm,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- ExtUtils.pm 2000/12/23 02:23:09 1.21 +++ ExtUtils.pm 2000/12/30 05:08:57 1.22 @@ -122,6 +122,9 @@ sub xs_cmd_table { my($self, $class, $cmds) = @_; (my $modname = $class) =~ s/::/__/g; +(my $pmname = $class) =~ s,::,/,g; +$pmname .= '.pm'; + my $cmdtab = ""; my $infos = ""; @@ -252,6 +255,25 @@ NULL, /* [1] post read_request handling */ }; +#define this_module "$pmname" + +static void remove_module_cleanup(void *data) +{ +if (find_linked_module("$class")) { +/* need to remove the module so module index is reset */ +remove_module(XS_${modname}); +} +if (data) { +/* make sure BOOT section is re-run on restarts */ +(void)hv_delete(GvHV(incgv), this_module, +strlen(this_module), G_DISCARD); + if (dowarn) { + /* avoid subroutine redefined warnings */ + perl_clear_symtab(gv_stashpv("$class", FALSE)); + } +} +} + MODULE = $class PACKAGE = $class PROTOTYPES: DISABLE @@ -260,14 +282,14 @@ XS_${modname}.name = "$class"; add_module(XS_${modname}); stash_mod_pointer("$class", XS_${modname}); +register_cleanup(perl_get_startup_pool(), (void *)1, + remove_module_cleanup, null_cleanup); void END() CODE: -if (find_linked_module("$class")) { -remove_module(XS_${modname}); -} +remove_module_cleanup(NULL); EOF } 1.107 +1 -0 modperl/src/modules/perl/mod_perl.h Index: mod_perl.h === RCS file: /home/cvs/modperl/src/modules/perl/mod_perl.h,v retrieving revision 1.106 retrieving revision 1.107 diff -u -r1.106 -r1.107 --- mod_perl.h2000/12/20 07:24:43 1.106 +++ mod_perl.h2000/12/30 05:08:59 1.107 @@ -1210,6 +1210,7 @@ void perl_perl_cmd_cleanup(void *data); void perl_section_self_boot(cmd_parms *parms, void *dummy, const char *arg); +void perl_clear_symtab(HV *symtab); CHAR_P perl_section (cmd_parms *cmd, void *dummy, CHAR_P arg); CHAR_P perl_end_section (cmd_parms *cmd, void *dummy); CHAR_P perl_pod_section (cmd_parms *cmd, void *dummy, CHAR_P arg); 1.108 +5 -2 modperl/src/modules/perl/perl_config.c Index: perl_config.c === RCS file: /home/cvs/modperl/src/modules/perl/perl_config.c,v retrieving revision 1.107 retrieving revision 1.108 diff -u -r1.107 -r1.108 --- perl_config.c 2000/09/28 03:53:01 1.107 +++ perl_config.c 2000/12/30 05:08:59 1.108 @@ -1675,7 +1675,7 @@ } } -static void clear_symtab(HV *symtab) +void perl_clear_symtab(HV *symtab) { SV *val; char *key; @@ -1686,6 +1686,7 @@ SV *sv; HV *hv; AV *av; + CV *cv; dTHR; if((SvTYPE(val) != SVt_PVGV) || GvIMPORTED((GV*)val)) @@ -1696,6 +1697,8 @@ hv_clear(hv); if((av = GvAV((GV*)val))) av_clear(av); + if((cv = GvCV((GV*)val))) + cv_undef(cv); } } @@ -1830,7 +1833,7 @@ if(usv SvTRUE(usv)) ; /* keep it around */ else - clear_symtab(symtab); + perl_clear_symtab(symtab); } return NULL; }