Re: Script Debugging Modules?
On Sun, Dec 10, 2000 at 07:26:38PM -0800, Bill Moseley wrote: Just how smart is the compiler? [snip] use constant DEBUG_TEMPLATE = 1; use constant DEBUG_SESSION = 2; use constant DEBUG_REQUEST = 4; use constant DEBUG_QUERY = 8; use constant DEBUG_QUERY_PARSED = 16; my $debug = DEBUG_REQUEST|DEBUG_QUERY; warn "query = '$query'\n" if $debug DEBUG_QUERY; Not quite that smart. It has no idea if `$debug' will have changed by the time you're asking about it. However, if you make `$debug' into a constant, it will work (where "work" is defined as "optimize out the conditional"). use constant FOO = 1; use constant BAR = 2; use constant FOOBAR = FOO|BAR; warn "baz" if FOOBAR FOO; use constant DEBUG_TEMPLATE = 0; # OFF use constant DEBUG_SESSION = 1; # ON use constant DEBUG_REQUEST = 0; use constant DEBUG_QUERY = 1; # ON use constant DEBUG_QUERY_PARSED = 0; warn $query if DEBUG_QUERY || DEBUG_QUERY_PARSED; This will also work, but I like the first approach better. It allows you to factor out the component you want to debug. -dlc
Re: Modperl conflicting with other modules
On Mon, Nov 13, 2000 at 08:20:53AM -0600, Yu Di wrote: [snip] Then I found that I cannot access any Mod_perl, PHP, or FastCGI programs, if I try, I will get an error, and the error.log of Apache will have a line like: "[...][notice] child pid x exit signal Segmentation Fault(11)" [snip] Then I compiled Mod_perl as a static module of Apache, and installed it, then installed mod_fastcgi and PHP as DSO. This time, Mod_perl programs and FastCGI programs can be accessed, but PHP programs will produce the same errors as above. So it seems that Mod_perl is conflicting with these two other modules, especially PHP. I have observed exactly these problems. My eventual conclusion was that mod_perl and mod_php[34] will not co-exist when either is a DSO. I currently have everything but mod_ssl compiled statically, and I would suggest that compiling mod_php as a static module will solve your remaining problem. On the plus side, I have been surprised and pleased by the stability of mod_perl as a DSO in an httpd without PHP (on Linux). -dlc
Re: [Apache::ASP] $Request-QueryString-('foo')-Item() support
On Mon, Oct 09, 2000 at 05:03:44PM -0700, Joshua Chamas wrote: When I execute $Request-Form-('test')-Item() on a real life code sample, even after building in support for $Request-Form('test')-Item(), I get this error: Not a CODE reference at (eval 14) line 10. I have seen this error before with this syntax... is this really supposed to work? I thought it was not supposed to be supported by perl. I saw that it passed compilation, but perl saves some things for runtime checking. It works in VBScript because that language has the notion of a default method for an object class to cover these instances. Those syntaxes are saying two separate things. $Request-Form('test')-Item() calls the method `Form' on the object `$Request' with argument `test', and calls the method `Item' with no arguments on the result. $Request-Form-('test')-Item() calls the method `Form' on the object `$Request' with no arguments, and calls the return value as a subroutine with argument `test'. Thus, if `Form' doesn't return a coderef, it will crash and burn. -dlc
Re: open(FH,'|qmail-inject') fails
On Thu, Sep 07, 2000 at 04:56:59PM -0400, Roger Espel Llima wrote: On Thu, Sep 07, 2000 at 01:25:21PM -0700, Randal L. Schwartz wrote: Man, if I see ONE MORE script that checks for a "legal email", well, you could always try to check the address against rfc822... but that would be one hell of a regexp, and it'd be mostly useless, since the worst that can happen is a bounced email. Well, see Jeff Friedl's RFC822 REx in MRE, and more interestingly Abigail's RFC::RFC822::Address, which uses Parse::RecDescent. Of course, as you say, in that instance there's not a whole lot of point to the check. But Abigail's module is great fun nonetheless. -dlc