Re: error messages..
You're exposing your username/password you're using to connect to your DBMS to public. Those messages are there because $Apache::DBI::DEBUG is set. Rgds, Edwin. Sam Park wrote: Anybody knows why I'm getting this messages...??? 5744 Pinging 'prodcrank.excite.com~crank~crank~RaiseError=1' 5744 Apache::DBI already connected to 'prodcrank.excite.com~crank~crank~RaiseErr or=1' 5744 Pinging 'prodcrank.excite.com~crank~crank~RaiseError=1' 5744 Apache::DBI already connected to 'prodcrank.excite.com~crank~crank~RaiseErr or=1' 5744 Pinging 'prodcrank.excite.com~crank~crank~RaiseError=1' 5744 Apache::DBI already connected to
PROBLEMITH APACHE::ASP
Hi all. I'm trying to install APACHE::ASP into my Linux box. I have a RedHat 6.0 + apache 1.3.12 + MOD_PERL . Looking into the documentation at www.apache-asp.org, i compiled the mod_perl as a static module, i compiled APACHE::ASP and added ASP.pm to $PERRLLIB/SITE/APACHE. In my httpd.conf i added this rules: Location /home/httpd/html/ASP SetHandler perl-script PerlHandler Apache::ASP PerlSetVar Global /tmp /Location Files ~ (\.asp) SetHandler perl-script PerlHandler Apache::ASP PerlSetVar CookiePath / PerlSetVar SessionTimeout .25 # PerlSetVar StateSerializer Storable # PerlSetVar StateDB DB_File # PerlSetVar StatScripts 0 PerlSetVar XMLSubsMatch my:\w+ /Files My .asp files are all in /home/httpd/html/ASP. I restarted apache and trying to load an ASP page, the server give me an error: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, [EMAIL PROTECTED] and inform them of the time the error occurred, and anything you might have done that may have caused the error. No error are reported to error.log ! Help me! Thanks. More information about this error may be available in the server error log.
Re: OOP and mod_perl question
Andreas Grupp wrote: Hello I am trying to develop for the first time a perl module. It should work on a server with mod_perl. The objects are not using mod_perl ($r) and are just solving some of my work in a nicer way. Since I'm new in OOP on perl (I only know C++) I would hear from some experts that the following is allowed in Perl OO modules and does not conflict with mod_perl. The question belongs to the constructor. I have $self as a class reference on the brandnew object. Now in the rest of my constructor I do some Querys on a MySQL database to get information about the authenticated user (.htaccess with AuthenDBI). Afterwards I store the user-data retrieved from the database in a hash-variable and put a reference to this hash in the $self object in the following way: $self-{'userdata'}-$hashref Now I can get the different parts of userdata in other instance-methods with code like the following ($po is an object of this class): my $po = new Peseta; print "pThis desk belongs to: " . $po-{'userdata'}-{'ulname'} . "/p"; er ... this may be wrong but ... Here you are directly referancing the Objects data structure - which in OO is a little naughty (you should repsect an Objects privacy, but perl will not enforce it). Hence you would need a method call to return said data, in your Peseta package put something thus: sub get_desk_owner { my $self = shift; my $name = shift; return $self-{'userdata'}-{$name}; } and the secound line becomes: print "pThis desk belongs to: " . $po-get_desk_owner('ulname'} . "/p"; Why bother - well you may change the internal objects data structure and hence your method will break all code that uses it, yet in mine all I need is to change the object implemetation. My question is now: Can I be sure that there are no conflicts when several users are requesting pages that work with this module? Can I be sure that the object data is not shared between different requests and the object has really only data corresponding to the actual request when I follow the general rules for OOP under perl? The objects instance data will not be shared between requests if you are carfull (and useing strict, and -w will help alot here) to initialise and scope variables properly. In your example you use 'my' and hence this will be fine. The way to make something global (BEWARE) is to use a package global (via use vars), and not to reinitaialise it after the first request - then the variable WILL have the same value as it had after its last use IN THAT CHILD (as apache is a multi-process model - the var will have different states in different children). The mod_perl guide covers these issues very well. Hope that helps. Greg Cope Thanks a lot for your answers Andreas -- Elektronikschule Tettnang http://www.elektronikschule.de/~grupp Oberhofer Str. 25 mailto:[EMAIL PROTECTED] 88069 Tettnang PGP-Key available via mail. Use subject Tel.: +49 7542 9372-33 Use subject: send pgp-public-key Fax.: +49 7542 9372-40
Re: NOT_FOUND from a PerlHandler causing problems with ErrorDocument
* Doug MacEachern | | On 28 Sep 2000, Bjørn Ola Smievoll wrote: | | [Sorry for being so verbose, hope somebody still have the time and | patience to read it all]. | | I have a setup where a PerlTransHandler registers a PerlContentHandler | based simply on whether $r-uri ends with '.html' or not. The | TransHandler does no verifying of the existence of the file, that | doesn't happen until the ContentHandler kicks in. For an unsuccessful | '-e' test, NOT_FOUND is returned from the ContentHandler. All this | worked fine until I added an perl-based handler for the 404 using the | ErrorDocument parameter in httpd.conf[1]. | | your error handler works fine for me with 404's. what is your | PerlTransHandler doing? Well, I'm not shure it works. Request that it handles shows up in the access_log with status 200. I must admit; I'm quite confused at the moment. Is it correct to use $r-send_http_header? Anyways, I've made a couple of dummy modules to make an to-the-point example. Using them should cause looping. First the httpd.conf entries: PerlTransHandler UiO::TransDummy Location /http_error SetHandler perl-script PerlHandler UiO::ErrDoc /Location ErrorDocument 404 /http_error The transhandler: package UiO::TransDummy; use strict; use Apache::Constants qw(OK DECLINED); sub handler { my $r = shift; unless ($r-is_initial_req) { $r-log-debug('DECLINED'); return DECLINED; } if (substr($r-uri, -5) eq '.html') { $r-filename($r-document_root . $r-uri); $r-handler('perl-script'); $r-push_handlers(PerlHandler = 'UiO::ContentDummy'); $r-log-debug('Registered ' . $r-filename); return OK; } $r-log-debug('DECLINED'); return DECLINED; } 1; __END__ And the contenthandler: package UiO::ContentDummy; use strict; use Apache::Constants qw(:common); sub handler { my $r = shift; $r-log-debug('Hello'); return NOT_FOUND; } 1; __END__ (bo)
Re: OOP and mod_perl question
Andreas Grupp wrote: Hello I am trying to develop for the first time a perl module. It should work on a server with mod_perl. The objects are not using mod_perl ($r) and are just solving some of my work in a nicer way. Since I'm new in OOP on perl (I only know C++) I would hear from some experts that the following is allowed in Perl OO modules and does not conflict with mod_perl. The question belongs to the constructor. I have $self as a class reference on the brandnew object. Now in the rest of my constructor I do some Querys on a MySQL database to get information about the authenticated user (.htaccess with AuthenDBI). Afterwards I store the user-data retrieved from the database in a hash-variable and put a reference to this hash in the $self object in the following way: $self-{'userdata'}-$hashref Now I can get the different parts of userdata in other instance-methods with code like the following ($po is an object of this class): my $po = new Peseta; print "pThis desk belongs to: " . $po-{'userdata'}-{'ulname'} . "/p"; er ... this may be wrong but ... Here you are directly referancing the Objects data structure - which in OO is a little naughty (you should repsect an Objects privacy, but perl will not enforce it). Hence you would need a method call to return said data, in your Peseta package put something thus: sub get_desk_owner { my $self = shift; my $name = shift; return $self-{'userdata'}-{$name}; } here something we have been quite successfull using. It allows us to retrieve nested data from all of our object without directly poking insid e the object. Very similar to $r-param(); sub getAttr{ my $self = shift; my $req = shift; # we generally tend to store data in a second level hash $return $self-{'attr'}-{$req} || ''; } for setting instance data ... sub setAttr { my $self = shift; my $i = {@_}; foreach my $key (keys %{$i}){ $self-{'attr'}-{$key} = $i-{$key}; } return; } hope this helps Sean Cook Systems Analyst Edutest.com Phone: 804.673.22531.888.335.8378 email: [EMAIL PROTECTED] __ Save the whales. Collect the whole set.
[OT] advice needed.
Hi, I know it's very OT, but don't kick me I just need advice. I am going to work in a Web Company to write some mod_perl apps. They gave me a contract (I think the terrible one) which contains paragraph (among the others) that signs the rights to all inventions over to them. The problem is .. I have never sign such contracts and I don't know if it's "common" contract template that programmers sign when start coding for somebody. If someone have 15 minutes to have a look at the my contract (I'll send link) or tell where I can find a "typical" contract for such work, let me know. /Vlad.
Re: [OT] advice needed.
Vladislav Safronov wrote: I am going to work in a Web Company to write some mod_perl apps. They gave me a contract (I think the terrible one) which contains paragraph (among the others) that signs the rights to all inventions over to them. The same paragraph (the inventions resulted from your contracting work belong to the company who hired you) is in my contract here in Germany and my lawyer told me it's a usual thing. The problem is .. I have never sign such contracts and I don't know if it's "common" contract template that programmers sign when start coding for somebody. I'd go to a lawyer to check the contract.
Re: [OT] advice needed.
"Alexander Farber (EED)" wrote: Vladislav Safronov wrote: I am going to work in a Web Company to write some mod_perl apps. They gave me a contract (I think the terrible one) which contains paragraph (among the others) that signs the rights to all inventions over to them. The same paragraph (the inventions resulted from your contracting work belong to the company who hired you) is in my contract here in Germany and my lawyer told me it's a usual thing. The problem is .. I have never sign such contracts and I don't know if it's "common" contract template that programmers sign when start coding for somebody. I'd go to a lawyer to check the contract. It's a very common clause here in the UK. The only thing that you need to watch out for is that the clause covers only those inventions made 'while in the course of your duties'. This allows you to do other work in your spare time. Most employers want to hold title to the work produced by their employees while they are paying them to do that work. -- John Reid Senior Analyst/Programmer Open Connect (Ireland) Ltd http://www.openconnect.ie/
Re: [OT] advice needed.
"Vladislav Safronov" [EMAIL PROTECTED] writes: Hi, I know it's very OT, but don't kick me I just need advice. I am going to work in a Web Company to write some mod_perl apps. They gave me a contract (I think the terrible one) which contains paragraph (among the others) that signs the rights to all inventions over to them. The problem is .. I have never sign such contracts and I don't know if it's "common" contract template that programmers sign when start coding for somebody. It depends what you're developing IMHO. I could care less about the sites I'm writing for and what they do. What _is_ important is honing your skills and the techniques you use. These are what I feel increase my value: the ability to do whatever job better and faster. I'm not likely to want to go out and do a ferry booking B2C site on my own in the very near future...however, using the Template Toolkit as a mod_perl handler is WAY up the list of Good Things. HTH, Dave -- Dave Hodgkinson, http://www.hodgkinson.org Editor-in-chief, The Highway Star http://www.deep-purple.com Apache, mod_perl, MySQL, Sybase hired gun for, well, hire -
RE: [OT] advice needed.
Something else I generally don't want to see in my contracts is a statement which says basically anything you learn while there you cannot use anywhere else. If I see that I will force them to take it out or not sign it... I have heard it is legally unenforcable (Who can say you cannot take your ideas and knowledge with you when you leave), but I still don't like it. Richard -Original Message- From: John Reid [mailto:[EMAIL PROTECTED]] Sent: Friday, September 29, 2000 8:41 AM To: Alexander Farber (EED) Cc: [EMAIL PROTECTED] Subject: Re: [OT] advice needed. "Alexander Farber (EED)" wrote: Vladislav Safronov wrote: I am going to work in a Web Company to write some mod_perl apps. They gave me a contract (I think the terrible one) which contains paragraph (among the others) that signs the rights to all inventions over to them. The same paragraph (the inventions resulted from your contracting work belong to the company who hired you) is in my contract here in Germany and my lawyer told me it's a usual thing. The problem is .. I have never sign such contracts and I don't know if it's "common" contract template that programmers sign when start coding for somebody. I'd go to a lawyer to check the contract. It's a very common clause here in the UK. The only thing that you need to watch out for is that the clause covers only those inventions made 'while in the course of your duties'. This allows you to do other work in your spare time. Most employers want to hold title to the work produced by their employees while they are paying them to do that work. -- John Reid Senior Analyst/Programmer Open Connect (Ireland) Ltd http://www.openconnect.ie/
Re: Why isn't PerlSetEnv working for me?
Doug MacEachern wrote: On Wed, 27 Sep 2000, Keith G. Murphy wrote: Upon further investigation, what I am seeing is that PERL5LIB gets passed into %ENV just fine. It's just not being used to locate modules; it is not in @INC. Could the part of Perl that pushes the PERL5LIB setting to @INC have already executed prior to my PerlSetEnv statement? i don't think so, it's set by mod_perl.c on every request, in perl_per_request_init(): /* SetEnv PERL5LIB */ if (!MP_INCPUSH(cld)) { char *path = (char *)table_get(r-subprocess_env, "PERL5LIB"); if (path) { perl_incpush(path); MP_INCPUSH_on(cld); } } what version of mod_perl are you using? 1.21_03-dev (it's the one in the current Debian release).
RE: [OT] advice needed.
this is the contract (one paragraph is already excluded) : http://vlad.narod.ru/contract.html is it really looks like a usual thing? (the matter of the job is just making mod_perl apps.) /Vlad. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, September 29, 2000 4:32 PM Cc: [EMAIL PROTECTED] Subject: Re: [OT] advice needed. Vladislav Safronov wrote: I am going to work in a Web Company to write some mod_perl apps. They gave me a contract (I think the terrible one) which contains paragraph (among the others) that signs the rights to all inventions over to them. The same paragraph (the inventions resulted from your contracting work belong to the company who hired you) is in my contract here in Germany and my lawyer told me it's a usual thing. The problem is .. I have never sign such contracts and I don't know if it's "common" contract template that programmers sign when start coding for somebody. I'd go to a lawyer to check the contract.
[OT] C question - message size in hex
Does anyone know where in Apache's code it prints the outbound response message size in hex? Example (the size is 112 on this particular message): HTTP/1.1 404 Not Found Date: Fri, 29 Sep 2000 13:58:56 GMT Server: Apache/1.3.6 (Unix) Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html 112 !DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN" HTMLHEAD TITLE404 Not Found/TITLE /HEADBODY H1Not Found/H1 ...snip I'm looking for the C function that actually prints it to a buffer or to the client. I've looked up and down through http_protocol.c and can't find it; I'm guessing it is hiding in another file. Thanks, Brian B. [EMAIL PROTECTED]
Re: open - does not work
Jerrad Pierce wrote: No... that opens a handle to ehir INPUT output is open(OUT, "magic_open |"); I am not sure why, but the command line Perl script with open (AAA, "|some_program"); accepts input via "print AAA" AND prints the output of the program on stdout. Or you could just slurp in a string with $_ = `normal_open`; Yes, I know. I just want to see how far I can go with the "open". Besides, according to the author of the script (it's for the analog web log analyzer), using open is more secure. Simon -- _ | x | Simon (Vsevolod ILyushchenko) [EMAIL PROTECTED] | y = e | |_| http://www.simonf.com[EMAIL PROTECTED] | Disclaimer: This is not me. This is just my mailer talking to your mailer...
Re: Apache::Registry error_log quirk
Thanks, this works fine and is just what we required. Martin On Thu, Sep 28, 2000 at 09:33:38AM -0700, Doug MacEachern wrote: On Fri, 22 Sep 2000, Martin Wood wrote: We have a collection of CGIs in a single directory handled by Apache::Registry, however if we enter the name of a resource under that location that doesn't exist, say www.noddy.com/registry_dir/dont_exist.cgi this is not recorded in the error_log, just the access log, yet the correct 404 "File not found" response is displayed to the client. For locations managed by default handlers, attempts to access non-existent files is logged in both the access and error logs. Is is possible to activate this behaviour for the Apache::Registry handled location? i guess that's because Apache::Registry doesn't log an error, whoopsie. this patch fixes that. Index: lib/Apache//PerlRun.pm === RCS file: /home/cvs/modperl/lib/Apache/PerlRun.pm,v retrieving revision 1.29 diff -u -r1.29 PerlRun.pm --- lib/Apache//PerlRun.pm2000/06/01 21:07:56 1.29 +++ lib/Apache//PerlRun.pm2000/09/28 16:31:12 @@ -60,6 +60,7 @@ $pr-{'mtime'} = -M _; return wantarray ? (OK, $pr-{'mtime'}) : OK; } +$pr-log_error("$filename not found or unable to stat"); return NOT_FOUND; } Index: lib/Apache//Registry.pm === RCS file: /home/cvs/modperl/lib/Apache/Registry.pm,v retrieving revision 1.32 diff -u -r1.32 Registry.pm --- lib/Apache//Registry.pm 2000/08/02 15:53:15 1.32 +++ lib/Apache//Registry.pm 2000/09/28 16:31:15 @@ -165,6 +165,7 @@ #} return $r-status($old_status); } else { +$r-log_error("$filename not found or unable to stat"); return NOT_FOUND unless $Debug $Debug 2; return Apache::Debug::dump($r, NOT_FOUND); }
Re: mod-perl as DSO (solaris)
More testing but still problems... First I downloaded GCC and make from sunfreeware.com just in case Sun's versions are messed up (this is the ones distributed with Solaris 8). I built apache clean first with the following criteria: CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fno-strict-aliasing" \ ./configure \ "--with-layout=Apache" \ "--prefix=/usr/local/apache2" \ "--enable-shared=max" \ "--enable-module=most" \ "--enable-rule=SHARED_CORE" \ "$@" Then, I built perl clean with -Ubincompat5005. I did build a shared perl though. Then I built mod perl via APXS as a DSO with: $ perl Makefile.PL \ USE_APXS=1 \ WITH_APXS=/path/to/bin/apxs \ EVERYTHING=1 \ [...] $ make $ make test $ make install Note that make test does not work with APXS (docs should be updated !). But I got the followin errors: First, with the default http.conf 'apachectl configtest' fails with: Syntax error on line 212 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/libexec/mod_negotiation.so into server: ld.so.1: /usr/local/apache2/bin/httpd: fatal: relocation error: file /usr/local/apache2/libexec/mod_negotiation.so: symbol __floatdisf: referenced symbol not found Disabling mod_negotiation: Syntax error on line 231 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/libexec/libproxy.so into server: ld.so.1: /usr/local/apache2/bin/httpd: fatal: relocation error: file /usr/local/apache2/libexec/libproxy.so: symbol __floatdisf: referenced symbol not found And finally, disabling mod_proxy: Syntax error on line 238 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/libexec/libperl.so into server: ld.so.1: /usr/local/apache2/bin/httpd: fatal: relocation error: file /usr/local/apache2/libexec/libperl.so: symbol Perl_free_tmps: referenced symbol not found So what now ??? HELP !!! Doug MacEachern wrote: On Tue, 26 Sep 2000, Ricardo Stella wrote: Solaris 2.8 Apache 1.3.12 GCC 2.95.2 Perl 5.6.0 Enterprise 250 (64bitish) Modperl 1.24 I can't get modperl compiled as a DSO neither via the 'flexible-method' nor the APXS method. The first method, seg faults. The second method won't configure, stating I should not build mod-perl as a DSO or compile perl with -Ubincompat5005. My current perl was compiled with bincompat5005 (perl -V:bincompat5005 shows as 'defined') exactly, -Ubincompat5005 will _un_ define bincompat5005, perl -V:bincompat5005 should report: bincompat5005='undef'; this is a requirement for solaris (or any Perl where Perl's malloc is used, rather than system malloc) , because Perl's malloc with bincompat5005 will pollute malloc() and free() into the main server, then when mod_perl's dso is closed (it is closed/re-opened at startup), the everything in the main server using free/malloc now has a function pointer into la-la land. when you turn off bincompat5005, then Perl's malloc/free are namespace protected, so only Perl uses Perl's malloc. -- -- Ricardo Stella O.I.T. (609)896-5000 x7436 _suAve_ Rider University *** Remove 'no-spam' from e-mail address before replying. *** begin:vcard adr;dom:;;;Lawrenceville;NJ;08648; adr:;;2083 Lawreceville Road;Lawrenceville;NJ;08648; n:Stella;Ricardo tel;fax:1-609-219-4994 tel;work:1-609-896-5000 x7436 x-mozilla-html:FALSE url:http://poseidon.rider.edu org:Rider University;O.I.T. version:2.1 title:Manager x-mozilla-cpt:;-9584 fn:Ricardo Stella end:vcard
Re: [OT] advice needed.
Vladislav Safronov wrote: http://vlad.narod.ru/contract.html is it really looks like a usual thing? Fairly usual, once read carefully and you realize that they're only claiming inventions that relate to them/resourced by them - the rest is disclosure, in an attempt to forestall any future problems. The problem is really in section 3. Section 1 is relatively normal, except that the last sentence doesn't limit the restrictions to work related to the company. It would, for example, prohibit you from volunteer work in an unrelated field. This is silly. Obtain written clarification. Section 2 is normal. Courts will uphold restrictions on proprietary information, provided that the definition of proprietary information is reasonable (ie: company customer information, proprietary technology etc). Not normal stuff you learn about your field. ATT came to some grief trying to enforce restrictions on "normal stuff". Section 3, first sentence is absurd. It means that you can't work in your field for two years after termination. In Canada, such a clause would be considered by the court to be a blatant attempt to deprive you of your right to earn a living in your chosen profession, and would likely cause the entire contract to be invalidated (also cf. ATT's grief). A former employer of mine tried this stunt on me and we laughed in their face. They folded. The rest of section 3 is common, but rarely enforceable (it is also probably too broad). Companies usually draft this in such a way that you're prohibited from directly competing with their business using proprietary knowledge that you obtained from them, or raping their employee base directly. In context with section 5 (which limits what inventions they have a legitimate interest in), section 4 is reasonable - they're only asking you to tell them about them so that if they do have a Section 5 interest, they can pursue it. If there is such a clash, it's better to find out about it sooner than later. Section 7 (disclosure of prior inventions) protects you, not them.
RE: [OT] advice needed.
It is funny that you mention ATT. That was exactly who I was talking about when I mentioned "Be sure they don't say you can't take your knowledge with you". As I used to work for ATT and they tried that. Richard -Original Message- From: Chris Lewis [mailto:[EMAIL PROTECTED]] Sent: Friday, September 29, 2000 11:29 AM To: modperl Subject: Re: [OT] advice needed. Vladislav Safronov wrote: http://vlad.narod.ru/contract.html is it really looks like a usual thing? Fairly usual, once read carefully and you realize that they're only claiming inventions that relate to them/resourced by them - the rest is disclosure, in an attempt to forestall any future problems. The problem is really in section 3. Section 1 is relatively normal, except that the last sentence doesn't limit the restrictions to work related to the company. It would, for example, prohibit you from volunteer work in an unrelated field. This is silly. Obtain written clarification. Section 2 is normal. Courts will uphold restrictions on proprietary information, provided that the definition of proprietary information is reasonable (ie: company customer information, proprietary technology etc). Not normal stuff you learn about your field. ATT came to some grief trying to enforce restrictions on "normal stuff". Section 3, first sentence is absurd. It means that you can't work in your field for two years after termination. In Canada, such a clause would be considered by the court to be a blatant attempt to deprive you of your right to earn a living in your chosen profession, and would likely cause the entire contract to be invalidated (also cf. ATT's grief). A former employer of mine tried this stunt on me and we laughed in their face. They folded. The rest of section 3 is common, but rarely enforceable (it is also probably too broad). Companies usually draft this in such a way that you're prohibited from directly competing with their business using proprietary knowledge that you obtained from them, or raping their employee base directly. In context with section 5 (which limits what inventions they have a legitimate interest in), section 4 is reasonable - they're only asking you to tell them about them so that if they do have a Section 5 interest, they can pursue it. If there is such a clash, it's better to find out about it sooner than later. Section 7 (disclosure of prior inventions) protects you, not them.
Re: Problem with Apache::SIG
On Thu, 28 Sep 2000, Bill Moseley wrote: Nope. I just downloaded a fresh 1.24, and 1.3.12 and built with ah, it happens for non-Registry handlers. patch below fixes. you can also change your handler to: sub handler { my $r = shift; $r-exit(HTTP_NOT_MODIFIED); } BTW --disable-module=include causes: modules/ssi.FAILED before any test output arrived Any way to detect that SSI is disabled and not run the test? yeah, i'll fix that. Index: src/modules/perl/mod_perl.c === RCS file: /home/cvs/modperl/src/modules/perl/mod_perl.c,v retrieving revision 1.129 diff -u -r1.129 mod_perl.c --- src/modules/perl/mod_perl.c 2000/09/27 16:13:28 1.129 +++ src/modules/perl/mod_perl.c 2000/09/29 16:24:42 @@ -1654,14 +1654,17 @@ SPAGAIN; -if(perl_eval_ok(r-server) != OK) { - dTHRCTX; - MP_STORE_ERROR(r-uri, ERRSV); -if (r-notes) { -ap_table_set(r-notes, "error-notes", SvPVX(ERRSV)); +if ((status = perl_eval_ok(r-server)) != OK) { +dTHRCTX; +if (status == SERVER_ERROR) { +MP_STORE_ERROR(r-uri, ERRSV); +if (r-notes) { +ap_table_set(r-notes, "error-notes", SvPVX(ERRSV)); +} } - if(!perl_sv_is_http_code(ERRSV, status)) - status = SERVER_ERROR; +else if (status == DECLINED) { +status = r-status == 200 ? OK : r-status; +} } else if(count != 1) { mod_perl_error(r-server, Index: src/modules/perl/perl_util.c === RCS file: /home/cvs/modperl/src/modules/perl/perl_util.c,v retrieving revision 1.42 diff -u -r1.42 perl_util.c --- src/modules/perl/perl_util.c2000/09/28 21:00:47 1.42 +++ src/modules/perl/perl_util.c2000/09/29 16:24:48 @@ -677,17 +677,27 @@ int perl_eval_ok(server_rec *s) { +int status; SV *sv; dTHR; dTHRCTX; sv = ERRSV; -if(SvTRUE(sv)) { - MP_TRACE_g(fprintf(stderr, "perl_eval error: %s\n", SvPV(sv,na))); - mod_perl_error(s, SvPV(sv, na)); - return -1; +if (SvTRUE(sv)) { +/* Apache::exit was called */ +if (SvMAGICAL(sv) (SvCUR(sv) 4) +strnEQ(SvPVX(sv), " at ", 4)) +{ +return DECLINED; +} +if (perl_sv_is_http_code(ERRSV, status)) { +return status; +} +MP_TRACE_g(fprintf(stderr, "perl_eval error: %s\n", SvPV(sv,na))); +mod_perl_error(s, SvPV(sv, na)); +return SERVER_ERROR; } -return 0; +return OK; } int perl_sv_is_http_code(SV *errsv, int *status)
Re: mod-perl as DSO (solaris)
Might have figured out the problem, and it might be an apache issue dealing with largefiles: I compiled apache cleanly as: ./configure \ "--with-layout=Apache" \ "--prefix=/usr/local/apache2" \ "--enable-module=most" \ "--enable-shared=max" \ This worked. 'apachectl configtest' did not complain. Then I compiled mod_perl as: $ perl Makefile.PL \ USE_APXS=1 \ WITH_APXS=/path/to/bin/apxs \ EVERYTHING=1 \ And I got the following error message: Your Perl is uselargefiles enabled, but Apache is not, suggestions: *) Rebuild Apache with CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" *) Rebuild Perl with Configure -Uuselargefiles *) Let mod_perl build Apache (USE_DSO=1 instead of USE_APXS=1) So I cleand and compiled apache again, but enabling these CFLAGS. Apache chocked on mod_negotiation. Any ideas now ??? Doug MacEachern wrote: On Tue, 26 Sep 2000, Ricardo Stella wrote: Solaris 2.8 Apache 1.3.12 GCC 2.95.2 Perl 5.6.0 Enterprise 250 (64bitish) Modperl 1.24 I can't get modperl compiled as a DSO neither via the 'flexible-method' nor the APXS method. The first method, seg faults. The second method won't configure, stating I should not build mod-perl as a DSO or compile perl with -Ubincompat5005. My current perl was compiled with bincompat5005 (perl -V:bincompat5005 shows as 'defined') exactly, -Ubincompat5005 will _un_ define bincompat5005, perl -V:bincompat5005 should report: bincompat5005='undef'; this is a requirement for solaris (or any Perl where Perl's malloc is used, rather than system malloc) , because Perl's malloc with bincompat5005 will pollute malloc() and free() into the main server, then when mod_perl's dso is closed (it is closed/re-opened at startup), the everything in the main server using free/malloc now has a function pointer into la-la land. when you turn off bincompat5005, then Perl's malloc/free are namespace protected, so only Perl uses Perl's malloc. -- -- Ricardo Stella O.I.T. (609)896-5000 x7436 _suAve_ Rider University *** Remove 'no-spam' from e-mail address before replying. *** begin:vcard adr;dom:;;;Lawrenceville;NJ;08648; adr:;;2083 Lawreceville Road;Lawrenceville;NJ;08648; n:Stella;Ricardo tel;fax:1-609-219-4994 tel;work:1-609-896-5000 x7436 x-mozilla-html:FALSE url:http://poseidon.rider.edu org:Rider University;O.I.T. version:2.1 title:Manager x-mozilla-cpt:;-9584 fn:Ricardo Stella end:vcard
Re: PROBLEMITH APACHE::ASP
Make sure you have found the right error log. Also look for hints in the access log. Apache::ASP itself won't error without throwing something to the error log. If the .asp files are in question, make sure you can request other files from your web server so you know that's working. --Joshua Linux wrote: Hi all. I'm trying to install APACHE::ASP into my Linux box. I have a RedHat 6.0 + apache 1.3.12 + MOD_PERL . Looking into the documentation at www.apache-asp.org, i compiled the mod_perl as a static module, i compiled APACHE::ASP and added ASP.pm to $PERRLLIB/SITE/APACHE. In my httpd.conf i added this rules: Location /home/httpd/html/ASP SetHandler perl-script PerlHandler Apache::ASP PerlSetVar Global /tmp /Location Files ~ (\.asp) SetHandler perl-script PerlHandler Apache::ASP PerlSetVar CookiePath / PerlSetVar SessionTimeout .25 # PerlSetVar StateSerializer Storable # PerlSetVar StateDB DB_File # PerlSetVar StatScripts 0 PerlSetVar XMLSubsMatch my:\w+ /Files My .asp files are all in /home/httpd/html/ASP. I restarted apache and trying to load an ASP page, the server give me an error: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, [EMAIL PROTECTED] and inform them of the time the error occurred, and anything you might have done that may have caused the error. No error are reported to error.log ! Help me! Thanks. More information about this error may be available in the server error log.
Re: [OT] advice needed.
Where the heck does trying to do the right thing by GPL (or similar), in attempting to return some improved OpenSource code to the community. Or however the license phrases it. Shouldn't these contracts address that issue specifically, especially when the project is _based_ on OpenSource/GPL'd code? Mike D.
Re: [OT] advice needed.
Mike, I think many developers share a similar desire to not have projects (that leverage free software) close down what are really generic programming techniques, routines, classes, protocols, etc. And further, we'd like to contribute enhancements and documentation based upon our work. I'd like to find a lawyer who has experience and/or want to pursue legal means of removing the friction that keeps us from giving back. Part of that work would of course involve contract writing/editing. I'm hiring. Contact me if you are such. It is up to you to educate your potential employers about just how much of what you do is pior open art and how free software can empower them. That means the first contract has to be amended. ;-) Be very explicit about your intentions from the get go, and repeat yourself a few times; never assume they'll look at the code or even closely read your written self-description. Ed Michael Dearman wrote: Where the heck does trying to do the right thing by GPL (or similar), in attempting to return some improved OpenSource code to the community. Or however the license phrases it. Shouldn't these contracts address that issue specifically, especially when the project is _based_ on OpenSource/GPL'd code? Mike D.
Re: mod-perl as DSO (solaris)
On Fri, 29 Sep 2000, Ricardo Stella wrote: *) Rebuild Perl with Configure -Uuselargefiles if you do this and re-build Apache without the extra CFLAGS, that problem will go away.
Re: Problems with proxying POST?
On Thu, 28 Sep 2000, Chris Lewis wrote: It works to proxy the HTTP to the system fine, however, POST parameters seem to get mangled and/or truncated. they should get passed through by mod_proxy, provided nobody else has read the POST data first. When I try to reference $r-content the thing appears to hang. that means something else has already read the POST data. btw, in the cvs version, multiple calls to $r-content will not block, but anything after the first call returns undef.
Re: Why isn't PerlSetEnv working for me?
On Fri, 29 Sep 2000, Stas Bekman wrote: Hmm, I didn't take it out of my head, I cannot remember now when it was added. Was it different before and I've missed the patch? according to changes, it's been there 1.00_02. Anyway, that means that I should fix the guide, to remove the note about PERL5LIB and PerlTaintMode, right? right.
Re: (possible bug) PerlAccessHandler called twice?
On Thu, 28 Sep 2000, Adi wrote: As it turns out, the second call to My::ProxyAccessOnly is an internal redirect ... Is there a logical reason why PerlAccessHandler should be called twice, the because internal_redirects are implemented with subrequests and subrequests run all phases (except post_read_request, content handler and logging)
Re: open - does not work
On Fri, 29 Sep 2000, Vsevolod Ilyushchenko wrote: I am not sure why, but the command line Perl script with open (AAA, "|some_program"); accepts input via "print AAA" AND prints the output of the program on stdout. because C-level stdout is not hooked up to the client under mod_perl. Or you could just slurp in a string with $_ = `normal_open`; Yes, I know. I just want to see how far I can go with the "open". Besides, according to the author of the script (it's for the analog web log analyzer), using open is more secure. i've never heard that before, how is it more secure? more efficient maybe, but doubt that its more secure.
Re: Update: Re: PerlSendHeader Off socket persistence (was Re:question: usingApache for non-HTML messages)
On Thu, 28 Sep 2000, B. Burke wrote: Once I changed how I was printing the header from the script, the socket persistence worked with PerlSendHeader Off. So I guess I solved my problem although I don't really know why. because CGI.pm will trigger a call to $r-send_http_header, regardless of PerlSendHeader settings. whereas: "print Content-type: text/html\n\n"; will not, unless PerlSendHeader is On.
Re: open - does not work
On Sep 29, Doug MacEachern wrote: On Fri, 29 Sep 2000, Vsevolod Ilyushchenko wrote: Yes, I know. I just want to see how far I can go with the "open". Besides, according to the author of the script (it's for the analog web log analyzer), using open is more secure. i've never heard that before, how is it more secure? more efficient maybe, but doubt that its more secure. probably a reference to the fact that you have to escape the arguments used in something like $foo = `cat $bar` because it will go through /bin/sh, but you can avoid that by using open/fork/exec (or the three-argument open in perl 5.6). jim
Re: Problems with proxying POST?
Doug MacEachern wrote: On Thu, 28 Sep 2000, Chris Lewis wrote: It works to proxy the HTTP to the system fine, however, POST parameters seem to get mangled and/or truncated. they should get passed through by mod_proxy, provided nobody else has read the POST data first. When I try to reference $r-content the thing appears to hang. that means something else has already read the POST data. btw, in the cvs version, multiple calls to $r-content will not block, but anything after the first call returns undef. What I actually seem to be seeing is that one of the parameters has the last two characters lopped off its value. Is there something other than $r-content or $r-read that could eat the POST data? as_string? [Given that Stronghold is a bit old, I'm endeavering to build Apache/mod_ssl/mod_perl from scratch, but it complains about not being able to load Apache.pm... Is there a step-by-step set of Solaris instructions somewhere?]
Determine which subroutine to call at runtime
Hi all, I'm going to write a perl cgi which needs to determine which subroutine to call at runtime. And the number of choice is huge (more than 300 and it is growing). I know I could do a bunch of if-then-else but it makes the code looks very unreadable. I've basically figured out how to do so. I'd like to seek advice from you gurus of whether the way I'm doing it is good. As I'm going to run it under mod_perl, anything I need consider (memory consumption, performance, etc)? The basic idea is, in the package, I export a hash which stores subroutine name and the corresponding anonymous sub reference. The caller could determine which subroutine to call by getting the sub ref from the hash with the subroutine name. Below is the prototype I've written. Any suggestion/comment are highly appreciated. Thanks a lot. -- Cheers, Sammy Lau Outblaze Co. Ltd. Mail: [EMAIL PROTECTED] = myfunc.pm package myfunc; require Exporter; @ISA = qw(Exporter); @EXPORT = qw(%func_ptr); %func_ptr = (); $func_ptr{funcone} = sub { my $var = shift; print "Fx) One : $var \n"; }; $func_ptr{functwo} = sub { my $var = shift; print "F(x) Two : $var \n"; }; = caller.pl #!/usr/bin/perl -w use myfunc; {$func_ptr{$ARGV[0]}}($ARGV[1]); EXAMPLE: ./caller.pl funcone xxx Fx) One : xxx ./caller.pl functwo yyy Fx) Two : yyy
Re: Determine which subroutine to call at runtime
On Sat, 30 Sep 2000 [EMAIL PROTECTED] wrote: I'm going to write a perl cgi which needs to determine which subroutine to call at runtime. And the number of choice is huge (more than 300 and it is growing). I know I could do a bunch of if-then-else but it makes the code looks very unreadable. Yes. And unmaintainable. I've basically figured out how to do so. I'd like to seek advice from you gurus of whether the way I'm doing it is good. As I'm going to run it under mod_perl, anything I need consider (memory consumption, performance, etc)? It depends on the spec of your server, mod_perl servers can take up a lot of memory. All of your code will be loaded all of the time, so you want the loading of the hash to occur at compile time, so it will be shared as much as possible across all the apache children. The basic idea is, in the package, I export a hash which stores subroutine name and the corresponding anonymous sub reference. The caller could determine which subroutine to call by getting the sub ref from the hash with the subroutine name. This is a good way of doing things. Below is the prototype I've written. Any suggestion/comment are highly appreciated. Thanks a lot. You might want to think about the security of your system. For example, is there any verification that something the user has just typed in is a sensible thing to run code with? Is there any kind of verification that this function exists first? can they get stuff into the hash by some spurious quoting? MBM -- The Universe shipped by weight, not by volume. Some expansion of the contents may have occurred during shipment.
Re: Problems with proxying POST?
I figured out what it was. One of the $r-header_in() was trying to insert an Authorize header, and I didn't notice that base64_encode() tacks on a newline. After Apache core got thru with it, it ended up looking like: Authorize: Basic \n \r\n \r\n parameters which caused the destination server to start parsing the parameters two characters early, hence the last parameter had two characters lopped off the end. Sigh. Thanks all.
Re: Apache::Status Memory Usage metrics
On Thu, 28 Sep 2000, Doug MacEachern wrote: On Tue, 29 Aug 2000, Lyle D. Brooks wrote: This is my first time posting to this list, so forgive me if this question has been asked before (I did not see it in the archives or in the mod_perl guide). Apache::Status seems like a nice module, but I don't understand what the Memory usage section is telling me. For a given package, I have a function foo() that has a line like this. foo 48293 bytes | 1172 OPs Here's my questions... 1) 48293 bytes is what? Is that code?, stack?, data? or a combination of some of the three? TerseSize measures the sizeof() all structures (and strlen() of any strings) pointed to by the syntax (op) tree, lexical variables and globals. 2) 1172 OPs - what's an OPs? Is it good to have more or less? How does that affect memory usage? see matt's explanation. less is better. 3) Without changing the code, I can reload the memory usage page and the same function foo() will generally have the same number of bytes, but not always. The OPs always seem to remain the same number however. The bytes can vary but they don't seem to grow a great deal. Is this varying number a memory leak in the function? If not, what causes the number to vary from one invocation to the next? i'm not sure if stas has added a section to guide, but this has been explained a bunch of times here on the list. in a nutshell, Perl hangs It's there: http://perl.apache.org/guide/performance.html#Are_My_Variables_Shared_ And probably in a few other places, search for Apache::Peek and Devel::Peek. But these all talk about this effect on the way of showing something else. I guess I should make an explicit section that stresses this point. onto many of the allocations your scripts makes, such as the first time a variable is used by a script (they are all NULL at compile time), string copies, array and hash sizes, scratch pads for things like join, concatination, etc. B-LexInfo includes a handler to show this behavior in action. _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://apachetoday.com http://jazzvalley.com http://singlesheaven.com http://perlmonth.com perl.org apache.org
cvs commit: modperl/t/modules ssi.test
dougm 00/09/29 13:33:52 Modified:.ToDo Changes t/modules ssi.test Log: skip modules/ssi test if mod_include is not installed Revision ChangesPath 1.263 +2 -0 modperl/ToDo Index: ToDo === RCS file: /home/cvs/modperl/ToDo,v retrieving revision 1.262 retrieving revision 1.263 diff -u -r1.262 -r1.263 --- ToDo 2000/09/28 21:16:07 1.262 +++ ToDo 2000/09/29 20:33:50 1.263 @@ -3,6 +3,8 @@ (well, close to it anyhow) --- +- disable PERL_SSI unless mod_include is listed in httpd -l + - document Apache::Status Apache::Request preference over CGI.pm and make it more clear that Apache::Status should not be used in a production environment, as it adds quite a bit of bloat 1.541 +2 -0 modperl/Changes Index: Changes === RCS file: /home/cvs/modperl/Changes,v retrieving revision 1.540 retrieving revision 1.541 diff -u -r1.540 -r1.541 --- Changes 2000/09/29 16:33:38 1.540 +++ Changes 2000/09/29 20:33:51 1.541 @@ -10,6 +10,8 @@ =item 1.24_01-dev +skip modules/ssi test if mod_include is not installed + Apache::test enhancements [Ken Williams [EMAIL PROTECTED]] 1.2 +2 -0 modperl/t/modules/ssi.test Index: ssi.test === RCS file: /home/cvs/modperl/t/modules/ssi.test,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ssi.test 1997/12/06 17:57:28 1.1 +++ ssi.test 2000/09/29 20:33:52 1.2 @@ -1,6 +1,8 @@ use Apache::test; +skip_test unless fetch("/perl/have_module.pl?mod_include.c"); + my $ua = LWP::UserAgent-new;# create a useragent to test print fetch($ua, "http://$net::httpserver/rgy-include.shtml");