Re: Can't build Apache::Dispatch on Windows / Perl 5.8.0
Stas Bekman wrote: Steve Hay wrote: [...] Having a pointer to where the mod_perl.lib library was installed would be useful. I'm not sure calling it MODPERL_STATIC_LIB_LOCATION would be the best thing on Win32, as it's not a static library as such, but something could be come up with ... Well, if ModPerl::MM does the right thing, a developer will not even need to know where it is located. So probably leaving it as it's now is fine. The only misleading part is that MODPERL_LIB_LOCATION points to the build dir, so it should probably be renamed to reflect that. I'm not sure that's the *only* mis-leading part, but, as you say, if it all works then it shouldn't really matter too much. What other misleading parts are we talking about? I'm just getting confused with changes in Apache itself, I think. Apache 1 used to have lib, libexec and modules: lib stored the static .lib's, libexec stored the import libraries for various dll's, and modules stored the .so (aka .dll) files for Apache modules. But with Apache 2, I have only lib and modules. The latter still (rightly) contains just the .so files for Apache modules, so presumably all the static *and* import libraries are thrown together into lib now? Now, my mp2's Apache::BuildConfig contains this: 'MODPERL_AP_LIBDIR' = 'C:\\apache2/lib', 'MODPERL_AP_LIBEXECDIR' = 'C:\\apache2/modules', which I find confusing. The first line there is fine, but the second line seems wrong. One would think that MODPERL_AP_LIBEXECDIR specifies where Apache's libexec directory is, but there isn't one any more! Furthermore, it seems that the files that would have been in it are now in lib? So maybe MODPERL_AP_LIBEXECDIR should say C:\\apache2/lib (that's an ugly mess of back- and forward slashes too), and that should be used as the location to install mod_perl.lib into (since mod_perl.lib is one of these import library things). That would be wrong as things stand, though, because MODPERL_AP_LIBEXECDIR seems to be used as the location to install mod_perl.so, which should indeed be C:\\apache2/modules. Perhaps the simplest thing would be to rename MODPERL_AP_LIBEXECDIR to MODPERL_AP_MODDIR since it specifies where Apache's modules directory is and there isn't a libexec anymore? - Steve
[PATCH] Re: mp2 with perl-5.8.1 on Windows
Randy Kobes wrote: On Fri, 12 Sep 2003, Steve Hay wrote: Hi, Has anybody else got mp2 (CVS) working with recent perl-5.8.1's on Windows? I've got it building, but I can't start the Apache server at all. (It's fine without the mod_perl bits in the httpd.conf file.) See this thread on p5p for what I'm getting: http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2003-09/msg00795.html Cheers, - Steve I also found a problem, as below: == Perl_safesysmalloc(unsigned int 0x0010) line 70 + 21 bytes : perl-5.8.1/util.c modperl_hash_seed_init(apr_pool_t * 0x0026a7f0) line 44 + 7 bytes : modperl-2.0/src/modules/perl/mod_perl.c modperl_hook_pre_config(apr_pool_t * 0x0026a7f0, apr_pool_t * 0x00848100, apr_pool_t * 0x0084a108) line 594 + 9 bytes : modperl-2.0/src/modules/perl/mod_perl.c ap_run_pre_config(apr_pool_t * 0x00401441, apr_pool_t * 0x0026a7f0, apr_pool_t * 0x00848100) line 126 + 49 bytes main(int 0x00401d82, const char * const * 0x0008) line 575 + 19 bytes APACHE! mainCRTStartup + 227 bytes == which seems to be related to the safemalloc() call on line 44 of src/modules/perl/mod_perl.c. (by the way, I had to comment out the fprintf() call at line 66 to get it to compile, otherwise an error about my_perl being undeclared was found). I still haven't found out what the problem with the server crashing on startup is, but the attached patch against CVS seems to fix the fprintf() problem that you refer to. I've no idea how advisable what I've done is, but without it I get: = cl -IC:/Temp/modperl-2.0/src/modules/perl -IC:/Temp/modperl-2.0/xs -IC:\ apache2/include -IC:\apache2/include -nologo -Gf -W3 -Od -MD -Zi -DDEBUGGING -DW IN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IM PLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX -IC:\perl\lib\CORE -DMOD_PERL - DMP_COMPAT_1X -Od -MD -Zi -DDEBUGGING -c mod_perl.c C:\perl\bin\perl.exe -M ExtUtils::Command -e mv mod_perl.obj mod_perl.lo mod_perl.c mod_perl.c(66) : error C2065: 'my_perl' : undeclared identifier mod_perl.c(66) : warning C4047: 'function' : 'struct interpreter *' differs in l evels of indirection from 'int ' mod_perl.c(66) : warning C4024: 'Perl_IStdIO_ptr' : different types for formal a nd actual parameter 1 mod_perl.c(66) : warning C4047: 'function' : 'struct interpreter *' differs in l evels of indirection from 'int ' mod_perl.c(66) : warning C4024: 'Perl_IStdIO_ptr' : different types for formal a nd actual parameter 1 NMAKE : fatal error U1077: 'cl' : return code '0x2' Stop. = and with it, it all builds OK. - Steve PS. Randy: How do you that stacktrace output that you've posted? Is that using MSVC++, or something else? --- mod_perl.c.orig 2003-09-11 19:10:39.0 +0100 +++ mod_perl.c 2003-09-15 12:00:30.273019100 +0100 @@ -22,7 +22,7 @@ #endif /* see modperl_hash_seed_set() */ -static void modperl_hash_seed_init(apr_pool_t *p) +static void modperl_hash_seed_init(pTHX_ apr_pool_t *p) { #ifdef MP_NEED_HASH_SEED_FIXUP char *s; @@ -63,7 +63,8 @@ if (s) { int i = atoi(s); if (i == 1) { -fprintf(stderr, \nmod_perl: using init hash seed: %UVuf\n, +PerlIO_printf(PerlIO_stderr(), + \nmod_perl: using init hash seed: %UVuf\n, MP_init_hash_seed); } } @@ -587,10 +588,12 @@ int modperl_hook_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp) { +dTHX; + /* we can't have PerlPreConfigHandler without first configuring mod_perl */ /* perl 5.8.1+ */ -modperl_hash_seed_init(p); +modperl_hash_seed_init(aTHX_ p); return OK; }
Re: [PATCH] Re: mp2 with perl-5.8.1 on Windows
Randy Kobes wrote: On Mon, 15 Sep 2003, Steve Hay wrote: PS. Randy: How do you that stacktrace output that you've posted? Is that using MSVC++, or something else? Hi Steve, I'm using MSVC++ ... When a problem like this occurs, an offer is made to call up the VC++ debugger, where the trace is then done. In order to get a more useful trace (with symbol information), I compiled Perl using some patches to perl-5.8.x/win32/Makefile that ActiveState introduced (http://aspn.activestate.com/ASPN/Downloads/ActivePerl/Source). This patch enables debug symbols in release builds, and involves using '-Zi' in $(OPTIMIZE) and '-debug -opt:ref,icf' for $(LINK_DBG). With this, one gets .pdb files corresponding to compiled libraries, which hold the symbol information (I had to manually copy perl58.pdb [corresponding to perl58.dll] to C:\Perl\bin). The Apache/2.0.47 sources have this also enabled for the release build, by default, and building mod_perl as 'perl Makefile.PL ... MP_DEBUG=1' will enable them in mod_perl as well. Sorry, I should have made my question more specific. I've actually rebuilt Perl and Apache as full debug builds so I have all these .pdb files already. mod_perl gets them too because it inherits Perl's debug build mode. My question was where in the DevStudio GUI do you get at the stacktrace that you posted, or how do you get DevStudio to dump it out for you? All I can find is a Context drop-down (in the panel showing variables' values) from which I have to manually copy down the information (hence I only posted a list of functions!) It doesn't look like you've done that! - Steve
Re: Can't build Apache::Dispatch on Windows / Perl 5.8.0
Randy Kobes wrote: On Thu, 11 Sep 2003, Geoffrey Young wrote: The problem you described before with the missing symbols can be resolved by linking against the mod_perl.lib built when you build mod_perl.so. This can be done by adding in a LIBS attribute to WriteMakefile() in Makefile.PL with a value of ' -L/Path/to/mod_perl_lib -lmod_perl'. ah, right. thanks randy. examples of this can be found in Apache::WinBitHack, for example, the format of which should probably go in Apache::Dispatch (as well as just about all Apache:: modules to make sure they are Win32 compliant :) Here's a patch against the Apache-Dispatch Makefile.PL to allow it to build on Win32 Your patch does the trick for me, except that I had to rebuild mod_perl too. The problem is that my installed mod_perl setup (Apache in C:\apache, Perl in C:\perl5) didn't contain the mod_perl.lib required. The MODPERL_LIB entry in Apache::MyConfig said C:/Temp/mod_perl-1.28/src/modules/win32/Release, which is, of course, where it was when I was building mod_perl. I believe that mod_perl 2 now installs the mod_perl.lib somewhere to solve that kind of problem. Is there an option in the mod_perl 1 build process to thave that library installed, or could that be added to the next release? Anyway, Apache::Dispatch is now up and running for me. Thanks, Randy! - Steve
mp2 with perl-5.8.1 on Windows
Hi, Has anybody else got mp2 (CVS) working with recent perl-5.8.1's on Windows? I've got it building, but I can't start the Apache server at all. (It's fine without the mod_perl bits in the httpd.conf file.) See this thread on p5p for what I'm getting: http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2003-09/msg00795.html Cheers, - Steve
Re: Can't build Apache::Dispatch on Windows / Perl 5.8.0
Stas Bekman wrote: Randy Kobes wrote: On Fri, 12 Sep 2003, Steve Hay wrote: I believe that mod_perl 2 now installs the mod_perl.lib somewhere to solve that kind of problem. Is there an option in the mod_perl 1 build process to thave that library installed, or could that be added to the next release? That's a good suggestion - you're right that mod_perl 2 installs the mod_perl.lib under the Apache2/ tree, and it would make sense for mod_perl 1 to do the same, with Apache::MyConfig adjusted to reflect that. I'll look into putting together something to do that. Does it? According to Apache::Build, it should be installed under the apache tree's lib: Yes, in my Apache2 setup (the one that I can't get working with Perl 5.8.1...) I have mod_perl.lib in C:\Apache2\lib. I didn't change any of the installation locations. I'd assumed that's what Randy meant, actually - Apache2/lib being under the Apache2/ tree :-) Having said that, the BuildConfig.pm doesn't actually seem to refer to the location that the library has been installed into -- like mp1, it refers to the location in which it was built! I have: 'MODPERL_LIB_LOCATION' = 'C:/Temp/modperl-2.0/src/modules/perl/mod_perl.lib', in BuildConfig.pm. Wouldn't it be better for that to be 'C:/Apache2/lib/mod_perl.lib'? - Steve
Can't build Apache::Dispatch on Windows / Perl 5.8.0
Hi, I posted this problem the other day, deep inside a thread about something else, and didn't get any replies; maybe nobody spotted it? Does anybody have Apache::Dispatch working on Windows with Perl 5.8.0? Randy? I'm trying to build it on Windows XP (MSVC++ 6) with Perl 5.8.0 / Apache 1.3.27 / mod_perl 1.28, but I get these errors: [...] link -out:blib\arch\auto\Apache\Dispatch\Dispatch.dll -dll -nologo -node faultlib -release -libpath:C:\perl5\lib\CORE -machine:x86 Dispatch.obj C:\ perl5\lib\CORE\perl58.lib libeay32.lib oldnames.lib kernel32.lib user32.lib gdi 32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.li b netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib o dbccp32.lib msvcrt.lib -def:Dispatch.def Creating library blib\arch\auto\Apache\Dispatch\Dispatch.lib and object blib\ arch\auto\Apache\Dispatch\Dispatch.exp Dispatch.obj : error LNK2001: unresolved external symbol _perl_perl_merge_dir_co nfig Dispatch.obj : error LNK2001: unresolved external symbol _perl_cmd_perl_TAKE1 Dispatch.obj : error LNK2001: unresolved external symbol __imp__ap_register_clea [EMAIL PROTECTED] Dispatch.obj : error LNK2001: unresolved external symbol _perl_perl_cmd_cleanup Dispatch.obj : error LNK2001: unresolved external symbol __imp__ap_null_cleanup Dispatch.obj : error LNK2001: unresolved external symbol [EMAIL PROTECTED] Dispatch.obj : error LNK2001: unresolved external symbol _perl_clear_symtab Dispatch.obj : error LNK2001: unresolved external symbol __imp__ap_remove_module @4 Dispatch.obj : error LNK2001: unresolved external symbol __imp__ap_find_linked_m [EMAIL PROTECTED] Dispatch.obj : error LNK2001: unresolved external symbol _perl_get_startup_pool Dispatch.obj : error LNK2001: unresolved external symbol [EMAIL PROTECTED] blib\arch\auto\Apache\Dispatch\Dispatch.dll : fatal error LNK1120: 11 unresolved externals NMAKE : fatal error U1077: 'link' : return code '0x460' Stop. Any ideas? - Steve
Re: Help wanted with locations / configuration
Steve Hay wrote: Thomas Klausner wrote: Hi! On Mon, Sep 08, 2003 at 04:51:55PM +0100, Steve Hay wrote: The project is going to be written as a series of mod_perl handlers - one for the main home page, and others for various sub-components. Each handler is implemented by a separate module (all sub-classes of a common base class). I don't want to have to configure a separate Location for each sub-component. You might want to take a look at Apache::Dispatch, which does exactly this. Will do! I've grabbed it off CPAN and will take a good look at it. It does indeed look like exactly what I'm after. Does anybody have Apache::Dispatch working on Windows? I'm trying to build it on Windows XP (MSVC++ 6) with Perl 5.8.0 / Apache 1.3.27 / mod_perl 1.28, but I get these errors: [...] link -out:blib\arch\auto\Apache\Dispatch\Dispatch.dll -dll -nologo -node faultlib -release -libpath:C:\perl5\lib\CORE -machine:x86 Dispatch.obj C:\ perl5\lib\CORE\perl58.lib libeay32.lib oldnames.lib kernel32.lib user32.lib gdi 32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.li b netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib o dbccp32.lib msvcrt.lib -def:Dispatch.def Creating library blib\arch\auto\Apache\Dispatch\Dispatch.lib and object blib\ arch\auto\Apache\Dispatch\Dispatch.exp Dispatch.obj : error LNK2001: unresolved external symbol _perl_perl_merge_dir_co nfig Dispatch.obj : error LNK2001: unresolved external symbol _perl_cmd_perl_TAKE1 Dispatch.obj : error LNK2001: unresolved external symbol __imp__ap_register_clea [EMAIL PROTECTED] Dispatch.obj : error LNK2001: unresolved external symbol _perl_perl_cmd_cleanup Dispatch.obj : error LNK2001: unresolved external symbol __imp__ap_null_cleanup Dispatch.obj : error LNK2001: unresolved external symbol [EMAIL PROTECTED] Dispatch.obj : error LNK2001: unresolved external symbol _perl_clear_symtab Dispatch.obj : error LNK2001: unresolved external symbol __imp__ap_remove_module @4 Dispatch.obj : error LNK2001: unresolved external symbol __imp__ap_find_linked_m [EMAIL PROTECTED] Dispatch.obj : error LNK2001: unresolved external symbol _perl_get_startup_pool Dispatch.obj : error LNK2001: unresolved external symbol [EMAIL PROTECTED] blib\arch\auto\Apache\Dispatch\Dispatch.dll : fatal error LNK1120: 11 unresolved externals NMAKE : fatal error U1077: 'link' : return code '0x460' Stop. Any ideas? - Steve
Re: Help wanted with locations / configuration
Marc Slagle wrote: On Mon, 2003-09-08 at 11:51, Steve Hay wrote: It also needs to have access to various static resources (images, stylesheets, JavaScript libraries etc.). Thus, I want to have something like this: /myproject [mp1] /myproject/component1 [mp1] /myproject/component2 [mp1] ... /myproject/images [static] /myproject/javascript [static] /myproject/stylesheets [static] You might want to look at having a translation handler. As in a PerlTransHandler, yes? We're doing something similar to this, where images and javascripts live under the same directory structure as the handler is managing. Instead of trying to configure this via that httpd.conf file, we chose to have a translation handler look at the incoming uri and determine whether the request is for a static file or for the code. Is there a performance penalty with this? You're using Perl code to inspect the URI, and then handing control back to the Apache core if it is a static file. I wanted to avoid requests for static files wasting time by going to a Perl handler only to be returned to the Apache core to serve the file, hence my LocationMatch override that catches requests for static files. Thanks for the code snippet, though - it looks pretty good to me aside from that concern. - Steve
Re: Help wanted with locations / configuration
Perrin Harkins wrote: On Mon, 2003-09-08 at 11:51, Steve Hay wrote: Thus, I want to have something like this: /myproject [mp1] /myproject/component1 [mp1] /myproject/component2 [mp1] ... /myproject/images [static] /myproject/javascript [static] /myproject/stylesheets [static] The question is: What is the best way to configure this? Others have already given good advice, They have, indeed. Thanks, everyone! but I would add that your URLs and your filesystem don't need to be tied tightly together. You could just alias the static files to somewhere else: [snip] Alternatively, you could use a Location setting for your dispatcher that has nothing to do with your files: Those were actually my very frist ideas, but I decided that I prefer to have all the URL's to begin with /myproject. I don't necessarily require that URL to be related to the filesystem structure, but I just want all the URL's (dynamic and static) to begin the same. - Steve
Re: Help wanted with locations / configuration
petersm wrote: Steve Hay [EMAIL PROTECTED] wrote Location /myproject SetHandler perl-script PerlHandler MyProject-dispatcher /Location LocationMatch ^/myproject/(images|javascript|stylesheets) SetHandler default-handler /LocationMatch Correct me if I'm wrong, but can't you just say Location /myproject Location /myproject AddHandler perl-script .cgi PerlHandler MyProject-dispatcher /Location using AddHandler instead of SetHandler. This will not override the default handler for things like images/stylesheets/static html. This way you don't need the LocationMatch ^/myproject/(images|javascript|stylesheets) ... tags. I prefer for reasons that I can't really explain to have the Perl handler locations having no extension - e.g. things like /myproject/component1 rather than /myproject/component1.cgi. I can't see how to achieve that with an AddHandler. (And even if I did get that working somehow, then the Perl handler would have to hand control back to the Apache core when it receives a request for /myproject/images.) Thanks for the idea, though. If I manage to overcome my inexplicable aversion to file extensions then it certainly looks like the simplest solution. - Steve
Help wanted with locations / configuration
Hi, I'm having trouble deciding what the best plan is for the arrangement of the components of a new project that I'm starting. The project is going to be written as a series of mod_perl handlers - one for the main home page, and others for various sub-components. Each handler is implemented by a separate module (all sub-classes of a common base class). I don't want to have to configure a separate Location for each sub-component. It also needs to have access to various static resources (images, stylesheets, JavaScript libraries etc.). Thus, I want to have something like this: /myproject [mp1] /myproject/component1 [mp1] /myproject/component2 [mp1] ... /myproject/images [static] /myproject/javascript [static] /myproject/stylesheets [static] The question is: What is the best way to configure this? So far I've come up with two options: OPTION 1. Specify a /myproject Location with dispatcher method as the mod_perl handler; then specify a LocationMatch for the images, javascript and stylesheets that overrides the /myproject Location: Location /myproject SetHandler perl-script PerlHandler MyProject-dispatcher /Location LocationMatch ^/myproject/(images|javascript|stylesheets) SetHandler default-handler /LocationMatch The dispatcher method there looks at the URI requested and either returns DECLINED (or 404?) if it doesn't recognise it, or else loads the appropriate MyProject sub-class and then runs the real content generation routine in that (i.e. a routine like I would have specified as the handler for that URI if I had configured a separate Location for each component). This seems to have a minor problem in practice -- if I request a directory, rather than a file, in one of the static locations (e.g. /myproject/images or /myproject/images/) then the dispatcher method gets called! The LocationMatch override only seems to work if I request a file (e.g. /myproject/images/piccy1.jpg). Thus, I need to put some extra code into the dispatcher to repeat the pattern match for the static locations, and change the handler to the default-handler and return DECLINED if it has received such a URI. OPTION 2. Specify a /myproject Location with a PerlFixupHandler that behaves very much like the dispatcher above, except that it actually sets the handler to PerlHandler and assigns the appropriate callback method (i.e. the content generation routine in the component sub-class) when it spots a recognised component URI; otherwise it just returns DECLINED, leaving the request to be handled by the default-handler: Location /myproject PerlFixupHandler MyProject-fixup /Location (Am I correct in thinking that I don't need to specify SetHandler: perl-script for a PerlFixupHandler? That's only for the main PerlHandler response handler, isn't it?) Does either of these options have any benefit over the other? Are there other better ways to do it? Thanks in advance, - Steve
RE: HTTP POST: parameters empty when using ModPerl::Registry(okay when using ModPerl:PerlRun)...
Perrin, Thanks for your response...my replies below: -- Steve Bannerman [EMAIL PROTECTED] 44.(0)1865.273866 -Original Message- From: Perrin Harkins [mailto:[EMAIL PROTECTED] Sent: 06 August 2003 20:40 To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: HTTP POST: parameters empty when using ModPerl::Registry(okay when using ModPerl:PerlRun)... ...snip... I believe I see the source of your troubles in the code that you posted. You are creating a closure by using a lexical variable and then accessing it from within a sub. This is a no-no with any long-running system like mod_perl. You can get away with it in a standard CGI environment (or PerlRun) because it just exits after each request instead of running the same code again. Here is the offending section: my $cgi = new CGI; saveFile(); sub saveFile { my $inputfile = $cgi-param('file'); ... etc ... } Change it to this: my $cgi = new CGI; saveFile($cgi); sub saveFile { my $cgi = shift; my $inputfile = $cgi-param('file'); ... etc ... } I think that will do it. You're correct...that made it work. So with respect to your explanation about the long running perl system, am I to understand that the old version of the saveFile() subroutine uses a reference to a different $cgi instance that the $cgi instance in the main body of the script? As I said, I'm new to perl but that seems to be an awfully strange behavior of the language...if true, shouldn't the compilation (of the subroutine) fail because it references an undeclared variable ($cgi)? Cheers - Perrin
RE: HTTP POST: parameters empty when usingModPerl::Registry(okay when using ModPerl:PerlRun)...
Perrin, Thanks...your explanation makes sense. I was thinking of the subroutine as a method on a class and that the objects in the class had a cgi instance associated with them. I was thinking in the object paradigm rather than in the procedural paradigm. Cheers -- Steve Bannerman [EMAIL PROTECTED] 44.(0)1865.273866 -Original Message- From: Perrin Harkins [mailto:[EMAIL PROTECTED] Sent: 07 August 2003 19:10 To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: HTTP POST: parameters empty when usingModPerl::Registry(okay when using ModPerl:PerlRun)... On Thu, 2003-08-07 at 03:36, Steve Bannerman wrote: So with respect to your explanation about the long running perl system, am I to understand that the old version of the saveFile() subroutine uses a reference to a different $cgi instance that the $cgi instance in the main body of the script? It uses a reference to the $cgi variable that was in scope when saveFile() was compiled. As I said, I'm new to perl but that seems to be an awfully strange behavior of the language...if true, shouldn't the compilation (of the subroutine) fail because it references an undeclared variable ($cgi)? But it doesn't reference an undeclared variable; it references the original $cgi that was available when the sub was compiled. Closures are a feature of Perl. You can read about them in general in perlfaq7 and the perlref man page: http://www.perldoc.com/perl5.8.0/pod/perlfaq7.html#What's-a-closure- http://www.perldoc.com/perl5.8.0/pod/perlref.html Note that those both talk a lot about anonymous subs, but any sub can be a closure if it refers to a lexical variable defined in an enclosing scope. There is some mod_perl specific stuff on this here: http://perl.apache.org/docs/general/perl_reference/perl_reference. html#my___Scoped_Variable_in_Nested_Subroutines If you had warnings on, you would have received a message about $cgi not staying shared. In brief terms, what happens is that your program creates a lexical called $cgi, then saveFile() refers to it, locking in that variable as the $cgi that will always be referenced by saveFile(). At the end of the script $cgi goes out of scope and disappears, but saveFile() keeps referencing it. In a CGI program this is not a problem, because Perl exits and the process quits. In mod_perl, the code gets run again and saveFile() still refers to the original $cgi. There are a number of ways to solve this problem, but I prefer the one I showed you. Explicitly passing all arguments to subs is well established as a best practice in programming. What you were doing with $cgi before is basically treating it as a global. So, I'd suggest you turn on warnings, turn on strict, and embrace the good practice of passing variables to your subs. - Perrin
Re: [mp2] Child process exited
Jean-Sebastien Guay wrote: Steve, and the good news for you is that I've reproduced your problem. GREAT! Thank you so much for persevering through this! So do you have a traceback or some info that the developers might be able to use to track this down? Not sure how to get a stack backtrace on Windows. I don't even get the Application Error popup window with a Debug button inviting me to have go :-( However, I have massively simplified the test program that reproduces the problem. I've moved the template itself in-core rather than processing an external file and removed everything else that I could without the problem going away. I found that almost whatever I removed from the template -- not just the nobr tag -- fixed it, and I began to wonder about the *size* of the template. So then I replaced the HTML page content with loads of dots, and sure enough, the problem goes away if you reduce the number of dots sufficiently. It seems that the program breaks if the template size is 612 bytes, and works if it is = 612 bytes! (Try changing $size from 613 to 612 in getTemplate() to fix it!) Template-Toolkit's Template::Manual::Config manpage says that Perl will segfault using the INTERPOLATE option with templates 32 kB due to limitations in Perl's regex engine, and sure enough another way to fix the attached program is to change INTERPOLATE = 1 to INTERPOLATE = 0. I don't know where the 612 byte limit comes from, but it's certainly not Perl itself that has such a small limit -- the program runs fine in CGI and mod_perl 1 environments with $size set way higher than 32 kB on my machine. So a temporary fix would appear to be to not use the INTERPOLATE option if you can manage without it. I might have to leave it to Randy for a fuller explanation of where the 612 bytes limit is creeping in. Steve #!perl use strict; use warnings; use Template; MAIN: { print qq[Content-Type: text/html\n\n]; processTemplate(); } sub processTemplate { my $template = Template-new({ INTERPOLATE = 1 }); my $t_text = getTemplate(); $template-process($t_text) or die(Error processing template: . $template-error()); } sub getTemplate { my $size = 612; my $header = 'htmlbody'; my $footer = '/body/html'; my $centre = '.' x ($size - length($header) - length($footer)); my $t_text = $header . $centre . $footer; return \$t_text; }
RE: HTTP POST: parameters empty when using ModPerl::Registry (okay when using ModPerl:PerlRun)...
Stas, Replies below: -- Steve Bannerman [EMAIL PROTECTED] 44.(0)1865.273866 -Original Message- From: Stas Bekman [mailto:[EMAIL PROTECTED] Sent: 05 August 2003 18:07 To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: HTTP POST: parameters empty when using ModPerl::Registry (okay when using ModPerl:PerlRun)... ...snip... The docs need work, this is just a copy of mp1 registry docs, which need adjustments. However most things work the same way. The differences between Registry and PerlRun are easily summarizes with this diff: ModPerl-Registry diff -u lib/ModPerl/Registry.pm lib/ModPerl/PerlRun.pm --- lib/ModPerl/Registry.pm 2003-03-22 20:52:24.0 -0800 +++ lib/ModPerl/PerlRun.pm 2003-03-22 20:52:24.0 -0800 @@ -1,4 +1,4 @@ -package ModPerl::Registry; +package ModPerl::PerlRun; use strict; use warnings FATAL = 'all'; @@ -30,11 +30,11 @@ make_namespace = 'make_namespace', namespace_root = 'namespace_root', namespace_from = 'namespace_from_filename', -is_cached = 'is_cached', -should_compile = 'should_compile_if_modified', -flush_namespace = 'NOP', +is_cached = 'FALSE', +should_compile = 'TRUE', +flush_namespace = 'flush_namespace_normal', cache_table = 'cache_table_common', -cache_it= 'cache_it', +cache_it= 'NOP', read_script = 'read_script', rewrite_shebang = 'rewrite_shebang', set_script_name = 'set_script_name', @@ -53,17 +53,10 @@ PerlRun doesn't cache the script on each request and it flushes the script's namespace on each request. You can see the actual functions in lib/ModPerl/RegistryCooker.pm. Thanks, that's helpful...it shows me why PerlRun works. However, it doesn't really explain why the root problem exists. The way I think about it, the creation of a new CGI object should create a new set of slots for instance data. Then, each request's parameters would be stored in a slot of the new CGI instance rather than in the global set of slots for the class of CGI instances. Maybe I don't understand the object paradigm in perl correctly; however, I do understand it very well in general. Thus, it seems like a defect in either perl (the language) or CGI.pm. I'm guessing there's some justification for it in performance...however, it just doesn't seem right. Thoughts? If you can try to take it from here and see what the problem is (your code/registry?), that would be cool. Thanks. Unfortunately, I don't really know how to take it from here. I'm pretty new to perl and very new to mod_perl. Thus I'm reaching out to you guys to find out if anybody has solved this problem...unfortunately, Christopher's suggestion didn't work (unless I implemented it incorrectly). Also make sure you are using the latest CGI.pm (2.93 or higher is good). I'm using CGI.pm-2.98. Cheers __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [mp2] Child process exited
Jean-Sebastien Guay wrote: Steve, How did you build Apache 2? I downloaded the binaries... Sorry, can't help there. Please keep me posted as to your progress. OK, I've now got Apache 2 building (with a little off-list help from Randy Kobes - the secret is to use the .zip sources rather than the .tar.gz sources!), and I've built mod_perl 1.99_09 (not 1.99_10-dev as your have) and the good news for you is that I've reproduced your problem. The bads news is that I haven't solved it, but I'll keep trying and let you know if/when I do. I don't any Application Error popup window, but my NS7.1 browser says The document contained no data, while IE6.0 gives the usual useless The page cannot be displayed crap that it always does. I also get nothing in the access.log. The error.log contained this: Variable $template will not stay shared at C:/apache2/perl-bin/index.cgi line 26. Variable $vars will not stay shared at C:/apache2/perl-bin/index.cgi line 26. [Thu Aug 14 10:37:04 2003] [notice] Parent: child process exited with status 128 -- Restarting. The variable will not stay shared error is a common problem with mod_perl scripts that have file-scope lexical variables in them which subroutines access. My usual solution is to put the main part of the program into a block labelled MAIN:. That way they can't be shared to start with, and I have to explicitly pass them into any subroutines that require them. The attached new version of your index.cgi does this, and makes these errors go away. I now have just this in the error.log: [Thu Aug 14 10:41:42 2003] [notice] Parent: child process exited with status 128 -- Restarting. The index.cgi program runs fine in a command prompt (with SCRIPT_ROOT set in the environment), so its not an obvious TT error. TTYL, Steve #!D:\perl\bin\perl -w #--- use strict; use warnings; use Template; MAIN: { #--- my $vars = { VERSION = 0.75, }; # Template toolkit config. my $config = { INCLUDE_PATH = $ENV{SCRIPT_ROOT}, INTERPOLATE = 1, # expand $var in plain text POST_CHOMP = 1, # cleanup whitespace }; my $template = Template-new($config); #--- print qq[Content-Type: text/html\n\n]; processTemplate($template, 'header.html.tmpl', $vars); #print qq[htmlheadtitleApache should hopefully crash.../title/headbody]; print plural('bottle', $_) . of beer on the wall, br . plural('bottle', $_) . of beer, br . Take one down and pass it around, br . plural('bottle', $_ - 1) . of beer on the wall.brbr\n foreach (reverse (1 .. 99)); print qq[/body/html]; } #--- sub processTemplate { my $template = shift; my $t_file = shift; my $vars = shift; $template-process($t_file, $vars) or die(Error pressing $t_file: . $template-error); } sub plural { my ($word, $number) = @_; return ($number == 0 ? 'no' : $number) . $word . ($number == 1 ? '' : 's'); }
Re: [MP1.28 + perl maint. 20512] Build failure due to error in Apache/ExtUtils.pm
Sreeji K Das wrote: I tried to compile mod_perl-1.28 with perl maint. 20512 (http://www.iki.fi/jhi/[EMAIL PROTECTED]). I had a build failure (different errors each time trying to build). Have you tried http://www.iki.fi/jhi/[EMAIL PROTECTED] ? That snapshot worked OK for me on WinXP. - Steve
HTTP POST: parameters empty when using ModPerl::Registry (okay when using ModPerl:PerlRun)...
All, I apologize if this has already been covered...I looked at the archives since May but couldn't see anything covering this (there were related items but their solutions didn't solve this problem). Here an explanation of the problem: We want to post experiment results to an upload server which is running Apache HTTP Server (2.0.46) and mod_perl (1.99_09). When we post a sequence of files to the server, some of them are written to the local disk and some are not. That is, the test fails when using ModPerl::Registry but it succeeds when using ModPerl::PerlRun. In analyzing which ones work and which ones do not, I wrote a quick test to see why the transfer is not working. From the looks of the results, it appears that the first request handled by a particular Apache process/thread works and that any subsequent requests handled by that thread fail. Works means that the file in the test gets saved to disk and fail means that a file of size 0 gets written to disk. Below are the httpd.conf segments (working and failing), the test client (test_client.pl) and the test server (test_server.pl which is accessible from the /cpdn/cgi-bin location). Any suggestions? Thanks in advance... Also, does it matter if I use ModPerl::PerlRun instead of ModPerl::Registry (I have read some about this at http://apache.perl.org/docs/2.0/api/ModPerl/Registry.html but the documentation there is a little light). -- Working httpd.conf -- Location /cpdn/cgi-bin AllowOverride None SetHandler perl-script PerlResponseHandler ModPerl::PerlRun PerlOptions +ParseHeaders Options +ExecCGI Allow from All /Location -- Failing httpd.conf -- Location /cpdn/cgi-bin AllowOverride None SetHandler perl-script PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders Options +ExecCGI Allow from All /Location -- test_client.pl -- #!/usr/bin/perl use strict; use LWP::UserAgent; use HTTP::Request::Common; my $postUrl = $ARGV[0]; my $file = $ARGV[1]; my $postType = 'form-data'; my $ua = new LWP::UserAgent; my $req = POST($postUrl, Content_Type = $postType, Content = [ file = [$file] ]); my $res = $ua-request($req); if ($res-is_success()) { print POST test successful\n; print $res-content(); } else { print STDERR POST test failed; print STDERR code: . $res-code() . \n; print STDERR message: . $res-message() . \n; } -- test_server.pl -- use strict; use CGI qw(:standard); my $cgi = new CGI; saveFile(); sub saveFile { my $inputfile = $cgi-param('file'); my $outputfile = /tmp/file- . $$ . - . time(); open(FILE,$outputfile) || printError(); my $buffer; while (read($inputfile,$buffer,2096)) { print FILE $buffer; } close(FILE); undef $buffer; } sub printError { print header(); print Content-type: text/plain\n; print Status: 500$\n; print Message: Internal Error\n; exit; } Cheers -- Steve Bannerman [EMAIL PROTECTED] 44.(0)1865.273866
Re: [mp2] Child process exited
Jean-Sebastien Guay wrote: So, did anyone have time to check this out? This is pretty major for me, I can't implement mod_perl at my site until I find out what is causing this crash and fix it. And I really have no idea what could be causing it. I'm using CGI.pm 2.98, Template-Toolkit 2.10, Apache/2.0.47 (Win32) mod_perl/1.99_10-dev Perl/v5.8.0. I'm willing to try this out using Apache 2 -- I've been meaning to take a look at Apache 2 for some now, but just never quite got around to it :-( -- but at the moment I can't even build it! I've download httpd-2.0.47.tar.gz, unpacked it, cd'd to the top-level directory and typed nmake /f makefile.win installr, which I believe should build and install (into the default location, C:\apache2) a release build of Apache 2. However, that command produces this output: == C:\Temp\httpd-2.0.47nmake /f makefile.win installr Microsoft (R) Program Maintenance Utility Version 6.00.8168.0 Copyright (C) Microsoft Corp 1988-1998. All rights reserved. Please check out or download and unpack the Apache Portability Runtime sources (apr, apr-iconv and apr-util) into your \srclib dir. Apache cannot build without these libraries! makefile.win(39) : fatal error U1050: Need \srclib\ apr, apr-iconv and apr-util Stop. == If I look inside the srclib directory then I only find apr, apr-util and pcre, not apr-iconv. Where is that supposed to come from? How did you build Apache 2? Steve
Re: [mp2] Child process exited
Jean-Sebastien Guay wrote: Can't get http://whitestar02.webhop.org/Files/ApacheCrash.zip it resolves to an internal address: 192.168.0.3 Darn, looks like my web server didn't come back up right last night. I'll have to be there to fix it, because ssh doesn't get through either. Here's another link, on my ISP's server: http://pages.infinit.net/jeans13/ApacheCrash.zip Is it only mp2 that it fails under? I've tried it under mp1.28/perl5.8.0/apache1.3.27 on WinXP and it runs fine. What version of Template-Toolkit do you have? It's worth ensuring that you're running the latest version (2.10, I think) if you suspect that it might be involved in the problem. - Steve
RE: HTTP POST: parameters empty when using ModPerl::Registry (okay when using ModPerl:PerlRun)...
Christopher, Thanks for the suggestion; unfortunately, it doesn't work. I made the change you suggested (inserting CGI-initialize_globals(); just before creating an instance of CGI) and restarted apache/httpd. The same result...the first time the script executes it saves the file properly...after that, a file is created with 0 size. Besides, as you (and others prescribing the use of initialize_globals()) described it, shouldn't subsequent executions of the script write the same file as the first execution. That is, if the parameters of the CGI instances are actually global, wouldn't the same array of bytes still be in the global 'file' parameter? Cheers -- Steve Bannerman [EMAIL PROTECTED] 44.(0)1865.273866 -Original Message- From: Christopher Knight [mailto:[EMAIL PROTECTED] Sent: 05 August 2003 18:20 To: Stas Bekman; [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: HTTP POST: parameters empty when using ModPerl::Registry (okay when using ModPerl:PerlRun)... try CGI-initialize_globals(); at the begining of the script but before you use params if you are depending on the 'use CGI' statement to initialize your params (like a command line script), it will cause problems in Registry. Thats becuase it is initialized once on the initial 'use CGI' and it stays in memory for the life of the webserver. So each time you use a script, you have to initialize the CGI params to your current request. -Original Message- From: Stas Bekman [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 05, 2003 12:07 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: HTTP POST: parameters empty when using ModPerl::Registry (okay when using ModPerl:PerlRun)... Steve Bannerman wrote: All, I apologize if this has already been covered...I looked at the archives since May but couldn't see anything covering this (there were related items but their solutions didn't solve this problem). Here an explanation of the problem: We want to post experiment results to an upload server which is running Apache HTTP Server (2.0.46) and mod_perl (1.99_09). When we post a sequence of files to the server, some of them are written to the local disk and some are not. That is, the test fails when using ModPerl::Registry but it succeeds when using ModPerl::PerlRun. In analyzing which ones work and which ones do not, I wrote a quick test to see why the transfer is not working. From the looks of the results, it appears that the first request handled by a particular Apache process/thread works and that any subsequent requests handled by that thread fail. Works means that the file in the test gets saved to disk and fail means that a file of size 0 gets written to disk. Below are the httpd.conf segments (working and failing), the test client (test_client.pl) and the test server (test_server.pl which is accessible from the /cpdn/cgi-bin location). Any suggestions? Thanks in advance... Also, does it matter if I use ModPerl::PerlRun instead of ModPerl::Registry (I have read some about this at http://apache.perl.org/docs/2.0/api/ModPerl/Registry.html but the documentation there is a little light). The docs need work, this is just a copy of mp1 registry docs, which need adjustments. However most things work the same way. The differences between Registry and PerlRun are easily summarizes with this diff: ModPerl-Registry diff -u lib/ModPerl/Registry.pm lib/ModPerl/PerlRun.pm --- lib/ModPerl/Registry.pm 2003-03-22 20:52:24.0 -0800 +++ lib/ModPerl/PerlRun.pm 2003-03-22 20:52:24.0 -0800 @@ -1,4 +1,4 @@ -package ModPerl::Registry; +package ModPerl::PerlRun; use strict; use warnings FATAL = 'all'; @@ -30,11 +30,11 @@ make_namespace = 'make_namespace', namespace_root = 'namespace_root', namespace_from = 'namespace_from_filename', -is_cached = 'is_cached', -should_compile = 'should_compile_if_modified', -flush_namespace = 'NOP', +is_cached = 'FALSE', +should_compile = 'TRUE', +flush_namespace = 'flush_namespace_normal', cache_table = 'cache_table_common', -cache_it= 'cache_it', +cache_it= 'NOP', read_script = 'read_script', rewrite_shebang = 'rewrite_shebang', set_script_name = 'set_script_name', @@ -53,17 +53,10 @@ PerlRun doesn't cache the script on each request and it flushes the script's namespace on each request. You can see the actual functions in lib/ModPerl/RegistryCooker.pm. If you can try to take it from here and see what the problem is (your code/registry?), that would be cool. Thanks. Also make sure you are using the latest CGI.pm (2.93 or higher is good). __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http
Re: need your help to test mod_perl with perl-5.8.1-RC3
Michael G Schwern wrote: The problem is likely the MY::dynamic hack in c/Makefile.PL. 6.05 and previous had this: dynamic :: Makefile $(INST_DYNAMIC) $(INST_BOOT) 6.06_01 and up have this dynamic :: $(FIRST_MAKEFILE) $(INST_DYNAMIC) $(INST_BOOT) for some reason, MY::dynamic is trying to lop off everything after Makefile and moving $(INST_DYNAMIC) to a different target in MY::top_targets. (Where INST_BOOT is run from, I dunno). But dynamic no longer matches /Makefile/ so the hack fails and you wind up with INST_DYNAMIC built from two places. Coupled with the fact that its set LINKTYPE 'static' with a comment problems with things finding libareq.so, sort out later leads me to believe this was a work around a MakeMaker bug. Chaning s/(Makefile\s+).*/$1/g to s{ \$\(INST_DYNAMIC\) }{}g; s{ \$\(INST_BOOT\) }{}g; should fix the symptoms by restoring the hack for a quick fix. I tried changing the s/// to: $string =~ s{ \$\(INST_DYNAMIC\)}{}g; $string =~ s{ \$\(INST_BOOT\)}{}g; (I've dropped the trailing spaces in the patterns), which produced: dynamic :: $(FIRST_MAKEFILE) $(NOECHO) $(NOOP) in the Makefile as desired, but now the build process fails with this error: fatal error U1073: don't know how to make 'C:\perl5\lib\ExtUtils\typemap' For a longer term solution, try removing the MY::dynamic and MY::top_targets overrides entirely, plus changing LINKTYPE to 'dynamic' and see what happens. I tried removing MY::dynamic and MY::top_targets, plus *adding* LINKTYPE 'dynamic' to the Win32-specific section. That seems to get me back to square one - the Makefile contains: dynamic :: $(FIRST_MAKEFILE) $(INST_DYNAMIC) $(INST_BOOT) $(NOECHO) $(NOOP) and the build fails as it originally did with: libapreq.def : error LNK2001: unresolved external symbol boot_libapreq Only the fix previously posted by Stas (adding 'SKIP' = [qw(dynamic dynamic_lib dynamic_bs)], to both WriteMakefile() calls) works for me so far, but Joe had a problem that... Steve
Re: need your help to test mod_perl with perl-5.8.1-RC3
Michael G Schwern wrote: On Mon, Aug 04, 2003 at 08:46:27AM +0100, Steve Hay wrote: I tried changing the s/// to: $string =~ s{ \$\(INST_DYNAMIC\)}{}g; $string =~ s{ \$\(INST_BOOT\)}{}g; (I've dropped the trailing spaces in the patterns), which produced: dynamic :: $(FIRST_MAKEFILE) $(NOECHO) $(NOOP) in the Makefile as desired, but now the build process fails with this error: fatal error U1073: don't know how to make 'C:\perl5\lib\ExtUtils\typemap' That's odd. Does that file exist? If not, where is your typemap file? Somehow, it has contrived to disappear! It always used to exist there, which is why it didn't occur to me to check :-( I must have lost it somewhere along the line when shoe-horning earlier MakeMaker's into place. Having now restored that file, the patch above does indeed fix it for me. Steve
Re: need your help to test mod_perl with perl-5.8.1-RC3
Michael G Schwern wrote: On Mon, Aug 04, 2003 at 09:35:55AM +0100, Steve Hay wrote: Somehow, it has contrived to disappear! It always used to exist there, which is why it didn't occur to me to check :-( I must have lost it somewhere along the line when shoe-horning earlier MakeMaker's into place. Possibly you deleted the ExtUtils/ directory? Yes, I think I did delete it when installing MM 6.06_01 because its own Makefile was broken so I couldn't run nmake install. I see that Perl's lib/ExtUtils directory contains a typemap and ExtUtils-MakeMaker's lib/ExtUtils directory doesn't. So that would explain it. Why isn't the typemap file distributed as part of ExtUtils-MakeMaker?
Re: need your help to test mod_perl with perl-5.8.1-RC3
Michael G Schwern wrote: On Thu, Jul 31, 2003 at 03:23:36PM +0100, Steve Hay wrote: This patch finally fixes it for me: I'm glad you guys got it working, but there's still the problem of why MakeMaker's behavior changed. Since I tend not to touch the XS building code much its likely a bug. Try the snapshot on makemaker.org. I just fixed a minor issue with argument passing in recursive builds. I just tried MM 6.13: that made no difference. Then I tried the snapshot (taken at 01 Aug 2003 07:55 UTC): that failed loads of its own tests, but made no difference to the libapreq build process. If I could see the Makefiles from 6.03 and 6.12 I might be able to figure out what's different. Also, if you could try various alpha versions between those two, show the Makefiles and whether or not they exhibited the behavior that would help alot in narrowing it down. I've also tried MM 6.05: that works OK. Attached are the various Makefiles (the top-level one, plus those from the c, Cookie and Request sub-directories), and a transcript of the nmake step, from a build using MM 6.05 (which worked) and another build using MM 6.12 (which failed). I'll move on to trying out those alpha versions and get back to you on which was the first one that failed. Steve makefiles.tar.gz Description: GNU Zip compressed data
Re: need your help to test mod_perl with perl-5.8.1-RC3
Steve Hay wrote: Michael G Schwern wrote: If I could see the Makefiles from 6.03 and 6.12 I might be able to figure out what's different. Also, if you could try various alpha versions between those two, show the Makefiles and whether or not they exhibited the behavior that would help alot in narrowing it down. I've also tried MM 6.05: that works OK. Attached are the various Makefiles (the top-level one, plus those from the c, Cookie and Request sub-directories), and a transcript of the nmake step, from a build using MM 6.05 (which worked) and another build using MM 6.12 (which failed). I'll move on to trying out those alpha versions and get back to you on which was the first one that failed. This bug evidently goes back a long way: MM 6.06_02 fails in the same way as 6.13. I tried to use MM 6.06_01, but it wouldn't build itself (don't know how to make 'C:\perl5\libNAME'). Instead, I knife-and-forked it into place, but when I tried to use it to build libapreq, I just got the same error again - don't know how to make 'C:\perl5\libNAME'. So the best I can offer you at this stage is that something between 6.05 and 6.06_02 broke it. (Probably not what you wanted to hear, I guess, looking at the number of changes in 6.06_01.) Steve
Re: need your help to test mod_perl with perl-5.8.1-RC3
Steve Hay wrote: This bug evidently goes back a long way: MM 6.06_02 fails in the same way as 6.13. I tried to use MM 6.06_01, but it wouldn't build itself (don't know how to make 'C:\perl5\libNAME'). Instead, I knife-and-forked it into place, but when I tried to use it to build libapreq, I just got the same error again - don't know how to make 'C:\perl5\libNAME'. OK, I've got MM 6.06_01 building now (it was generating broken Makefiles -- needed to change DIRFILESEP from \ to ^\, and fill in the missing *PERLSAFE macros), and the bad news is that it doesn't build libapreq-1.2 either! I still get the unresolved external symbol boot_libapreq error. So it's one of the many changes between 6.05 and 6.06_01 that broke it. Steve
Re: need your help to test mod_perl with perl-5.8.1-RC3
Michael G Schwern wrote: On Fri, Aug 01, 2003 at 10:03:20AM +0100, Steve Hay wrote: This bug evidently goes back a long way: MM 6.06_02 fails in the same way as 6.13. I tried to use MM 6.06_01, but it wouldn't build itself (don't know how to make 'C:\perl5\libNAME'). Instead, I knife-and-forked it into place, but when I tried to use it to build libapreq, I just got the same error again - don't know how to make 'C:\perl5\libNAME'. OK, I've got MM 6.06_01 building now (it was generating broken Makefiles -- needed to change DIRFILESEP from \ to ^\, and fill in the missing *PERLSAFE macros), and the bad news is that it doesn't build libapreq-1.2 either! I still get the unresolved external symbol boot_libapreq error. So it's one of the many changes between 6.05 and 6.06_01 that broke it. Well, that narrows it down quite a bit. Which version of mod_perl and Apache is this against and *exactly* what do I have to do to exercise this bug? I haven't built mod_perl in a long time. I'm using Apache 1.3.27, mod_perl 1.28, libapreq-1.2, but I'm on Windows with MS VC++ 6.0, so this might not be very useful to you since you haven't got such a setup yourself... Anyway, here goes; it's probably pretty similar on whatever OS you're on (perhaps with an extra ./configure ... line before the Apache make?) - Unpack Apache, mod_perl, libapreq into C:\Temp - cd to C:\Temp\apache_1.3.27\src - Run nmake /f makefile.win installr. That builds Apache and installs it into C:\apache by default. - cd to C:\Temp\mod_perl-1.28 - Run perl Makefile.PL APACHE_SRC=C:/apache INSTALL_DLL=C:/apache/modules. - Run nmake, nmake test, nmake install as usual. - cd to C:\Temp\libapreq-1.2 - Run perl Makefile.PL - Run nmake -- that fails with the unresolved external symbol boot_libapreq error. That's it. BTW, I've been looking at the Makefiles that I sent previously, and have found something interesting. The Makefile in the c sub-directory from the 6.05 build contains this: = # --- MakeMaker dynamic section: ## $(INST_PM) has been moved to the all: target. ## It remains here for awhile to allow for old usage: make dynamic #dynamic :: Makefile dynamic :: Makefile @$(NOOP) = while the corresponding section from the 6.12 build contains this: = # --- MakeMaker dynamic section: ## $(INST_PM) has been moved to the all: target. ## It remains here for awhile to allow for old usage: make dynamic dynamic :: $(FIRST_MAKEFILE) $(INST_DYNAMIC) $(INST_BOOT) $(NOECHO) $(NOOP) = If that's relevant, then the latter looks more likely to be correct, doesn't it? Perhaps MM 6.06+ has correctly fixed a bug in MM 6.05, and the only problem here is that libapreq was previously relying on that bug? Steve
Re: Apache-print() problem with UTF-8 data in Perl 5.8
Steve Hay wrote: Randy Kobes wrote: On Tue, 29 Jul 2003, Steve Hay wrote: Is anybody going to take a serious look at the problem that I previously reported with Apache-print()'s handling of UTF-8 data in Perl 5.8? The patch that I sent (http://marc.theaimsgroup.com/?l=apache-modperlm=105912130001046w=2) seems to fix it for me on Windows as long as I've got perl #20203 incorporated. Does it work on other platforms? The #ifdef version-checks need a little work: on Windows (and other platforms [-- which ones?] that rely on Perl's makedef.pl to get symbols exported from the Perl library) you need perl-5.8.1; on other platforms the test for perl-5.8.0 should be fine. The brokenness of Apache-print() under perl-5.8.0 on Windows et al would also need documenting somewhere since it can't be fixed properly. mod_perl 2 makes two special cases for handling systems that use export files - Win32 and aix ($^O eq 'aix'). So these might be the only two one has to worry about in this regard. These were the only two that Nicholas Clark mentioned when I asked about the missing PerlIO_isutf8() on the perl-xs list, so that may well be true. I will double-check with p5p to see if there are any more. Apparently there are a few more -- several listed in Perl's makedef.pl, plus VMS which evidently has a completely different build process. The attached patch (against mod_perl 1.28) sorts out the version-check stuff, which was the only remaining issue that I had. This leaves Apache-print() broken on Windows et al under Perl 5.8.0, and fixes it under Perl 5.8.0 on other platforms and under Perl 5.8.1+ on all platforms. Steve --- Apache.xs.orig 2003-06-06 12:31:10.0 +0100 +++ Apache.xs 2003-07-31 09:45:37.0 +0100 @@ -51,6 +51,16 @@ #include mod_perl.h #include mod_perl_xs.h +/* Figure out if we've got PerlIO_isutf8(). This is needed to handle UTF-8 + * data correctly in Perl 5.8.0+, but was not exported by Perl in 5.8.0 itself + * on those OS's where symbols to export have to be explicitly listed. */ +#if !( PERL_REVISION 5 || \ + (PERL_REVISION == 5 PERL_VERSION 8) || \ + (PERL_REVISION == 5 PERL_VERSION == 8 PERL_SUBVERSION == 0 \ + (defined(WIN32) || defined(NETWARE) || defined(OS2) || \ +defined(_AIX) || defined(MACOS_TRADITIONAL) || defined(VMS))) ) +#define _HAVE_ISUTF8 +#endif #ifdef USE_SFIO #undef send_fd_length @@ -1119,11 +1129,27 @@ SV *sv = sv_newmortal(); SV *rp = ST(0); SV *sendh = perl_get_sv(Apache::__SendHeader, TRUE); +#ifdef _HAVE_ISUTF8 + PerlIO *fp = IoOFP(GvIOp(defoutgv)); +#endif if(items 2) do_join(sv, sv_no, MARK+1, SP); /* $sv = join '', @_[1..$#_] */ else sv_setsv(sv, ST(1)); +#ifdef _HAVE_ISUTF8 + if (PerlIO_isutf8(fp)) { + if (!SvUTF8(sv)) + sv_utf8_upgrade(sv = sv_mortalcopy(sv)); + } + else if (DO_UTF8(sv)) { + if (!sv_utf8_downgrade((sv = sv_mortalcopy(sv)), TRUE) +ckWARN_d(WARN_UTF8)) + { + Perl_warner(aTHX_ packWARN(WARN_UTF8), Wide character in print); + } + } +#endif PUSHMARK(sp); XPUSHs(rp); @@ -1176,6 +1202,20 @@ int sent = 0; SV *sv = SvROK(ST(i)) (SvTYPE(SvRV(ST(i))) == SVt_PV) ? (SV*)SvRV(ST(i)) : ST(i); +#ifdef _HAVE_ISUTF8 + PerlIO *fp = IoOFP(GvIOp(defoutgv)); + if (PerlIO_isutf8(fp)) { + if (!SvUTF8(sv)) + sv_utf8_upgrade(sv = sv_mortalcopy(sv)); + } + else if (DO_UTF8(sv)) { + if (!sv_utf8_downgrade((sv = sv_mortalcopy(sv)), TRUE) +ckWARN_d(WARN_UTF8)) + { + Perl_warner(aTHX_ packWARN(WARN_UTF8), Wide character in print); + } + } +#endif buffer = SvPV(sv, len); #ifdef APACHE_SSL while(len 0) {
Re: need your help to test mod_perl with perl-5.8.1-RC3
Stas Bekman wrote: Jarkko has just released perl-5.8.1-RC3. Quite a few things have changed since 5.8.0. So it's *very* important that you test your code with this release and immediatelly report to p5p if you have any problems, since Jarkko wants to release 5.8.1 any moment now. BAD NEWS: There seems to be a problem with ExtUtils-MakeMaker 6.12 included in perl-5.8.1-RC3. I successfully built and tested mod_perl 1.28 using RC3 on Windows XP / MS VC++ 6.0, but I just thought that I'd give libapreq-1.2 a quick whirl as well, and found that it doesn't build. I get the following error: ... link -out:..\blib\arch\auto\libapreq\libapreq.dll ... libapreq.def : error LNK2001: unresolved external symbol boot_libapreq If I downgrade ExtUtils-MakeMaker to 6.03 (the version included in perl-5.8.0) then it it's all OK. The question is: why is it trying to build libapreq.dll? It should only build Request.dll and Cookie.dll, which would probably explain why boot_libapreq is undefined. I'll continue looking into it myself, and can supply more info to anyone that wants it, but I thought I'd better raise the alarm quickly first. Steve
Re: need your help to test mod_perl with perl-5.8.1-RC3
Stas Bekman wrote: Here is what happens: MM 6.03 used to create libapreq.a but not libapreq.so, libapreq.a was just a by product and never was intented to be installed. Request.so was statically linking libapreq.a into it. Now with 6.12 it creates both libapreq.so and libapreq.so, so when Request.so is linked, it links libapreq.so dynamically, and of course it can't resolve it later when loading. This patch fixes things for me in libapreq and works with MM 6.03 and 6.12. Steve, please confirm that it works for you and I'll commit it. No, it doesn't fix it :-( My problem sounds a little different to yours. You talk above about ... when Request.so is linked..., but my build process doesn't get that far. Under MM 6.03 it used to build libapreq.lib, then Request.dll then Cookie.dll. Now, under MM 6.12, it builds libapreq.lib, then falls over (boot_libapreq unresolved) when trying to build libapreq.dll. It seems likely that if my build ever got as far as trying to build Request.dll then it would fail without your patch, and your patch would fix that bit, but at the moment I'm not getting that far. Steve
Re: need your help to test mod_perl with perl-5.8.1-RC3
Stas Bekman wrote: Steve Hay wrote: Stas Bekman wrote: Stas Bekman wrote: Steve Hay wrote: Stas Bekman wrote: Here is what happens: MM 6.03 used to create libapreq.a but not libapreq.so, libapreq.a was just a by product and never was intented to be installed. Request.so was statically linking libapreq.a into it. Now with 6.12 it creates both libapreq.so and libapreq.so, so when Request.so is linked, it links libapreq.so dynamically, and of course it can't resolve it later when loading. This patch fixes things for me in libapreq and works with MM 6.03 and 6.12. Steve, please confirm that it works for you and I'll commit it. No, it doesn't fix it :-( My problem sounds a little different to yours. You talk above about ... when Request.so is linked..., but my build process doesn't get that far. Under MM 6.03 it used to build libapreq.lib, then Request.dll then Cookie.dll. Now, under MM 6.12, it builds libapreq.lib, then falls over (boot_libapreq unresolved) when trying to build libapreq.dll. I think the cause is the same. MM 6.12 builds the shared object of libapreq (dll in your case and .so in mine), and it didn't use to do that. OK, try this patch: No, still doesn't fix it :-( Doesn't seem to make any difference, actually. It still tries to build libapreq.dll, and still fails in the same way. I've attached the c/Makefile that was generated by the patched c/Makefile.PL (which should have skipped the dynamic_* bits, but seems not to have done). But it never received the SKIP argument, from your Makefile: # MakeMaker Parameters: # INC = q[ -IC:/apache/include -IC:/apache/include/../os/win32 -IC:/Temp/mod_perl-1.28/src/modules/perl ] # NAME = q[libapreq] # OBJECT = q[apache_request.o apache_cookie.o apache_multipart_buffer.o] # TYPEMAPS = [q[C:/Temp/mod_perl-1.28/src/modules/perl/typemap]] # VERSION = q[1.2] ah, of course c/Makefile.PL has a special case for WIN32. Try this: G. OK, that's better, but it now falls over saying don't know how to make 'dynamic'! This patch finally fixes it for me: --- Makefile.PL.orig2001-04-03 20:24:12.0 +0100 +++ Makefile.PL2003-07-31 15:17:03.0 +0100 @@ -18,7 +18,7 @@ WriteMakefile( #grr, problems with things finding libapreq.so, sort out later. 'LINKTYPE' = 'static', -# 'SKIP' = [qw(dynamic_lib dynamic_bs)], + 'SKIP' = [qw(dynamic dynamic_lib dynamic_bs)], 'NAME' = 'libapreq', 'INC' = $src-inc, 'TYPEMAPS' = $src-typemaps, @@ -67,6 +67,8 @@ WriteMakefile('NAME' = 'libapreq', 'TYPEMAPS' = [ $ENV{MP_INC}/typemap ], 'VERSION' = $myVERSION, +'LINKTYPE' = 'static', +'SKIP' = [qw(dynamic dynamic_lib dynamic_bs)], 'OBJECT' = @objs, 'INC' = qq{ -I$ENV{AP_INC} -I$ENV{AP_INC}/../os/win32 -I$ENV{MP_INC} }, ); Steve
Apache-print() problem with UTF-8 data in Perl 5.8
Is anybody going to take a serious look at the problem that I previously reported with Apache-print()'s handling of UTF-8 data in Perl 5.8? The patch that I sent (http://marc.theaimsgroup.com/?l=apache-modperlm=105912130001046w=2) seems to fix it for me on Windows as long as I've got perl #20203 incorporated. Does it work on other platforms? The #ifdef version-checks need a little work: on Windows (and other platforms [-- which ones?] that rely on Perl's makedef.pl to get symbols exported from the Perl library) you need perl-5.8.1; on other platforms the test for perl-5.8.0 should be fine. The brokenness of Apache-print() under perl-5.8.0 on Windows et al would also need documenting somewhere since it can't be fixed properly. Maybe it's just easier to change the version-checks to 5.8.1 for all platforms, and document the broken behaviour under 5.8.0? Steve
Re: Apache-print() problem with UTF-8 data in Perl 5.8
Stas Bekman wrote: Steve Hay wrote: Is anybody going to take a serious look at the problem that I previously reported with Apache-print()'s handling of UTF-8 data in Perl 5.8? Steve, At the moment I'm busy fixing things for p5.8.1 for which mod_perl 2.0 is one of the showstoppers and Jarkko really wants to release 5.8.1 now. Is there a problem with mod_perl 1.28 under the forthcoming perl 5.8.1 as well? I just tried out Jarkko's latest release (http://www.iki.fi/jhi/[EMAIL PROTECTED]), and I found that mod_perl 1.28 doesn't work with it. (And that's without my patch -- just a plain mp1.28 straight out of the box.) It built OK (after I installed various prerequisites -- HTML-Tagset, HTML-Parser, libwin32, LWP, URI), but the test suite doesn't run at all. Manually running C:\apache\apache.exe -f C:\Temp\mod_perl-1.28\t\conf\httpd.conf -t just causes Windows to throw up an Application Error window. Once finished (should be soon) I will take care of all the outstanding issues, and there are quite a few. I apologize for not following up on those. No problem. Just wanted to check that it hadn't been forgotten. Steve
Re: Apache-print() problem with UTF-8 data in Perl 5.8
Randy Kobes wrote: On Tue, 29 Jul 2003, Steve Hay wrote: Is anybody going to take a serious look at the problem that I previously reported with Apache-print()'s handling of UTF-8 data in Perl 5.8? The patch that I sent (http://marc.theaimsgroup.com/?l=apache-modperlm=105912130001046w=2) seems to fix it for me on Windows as long as I've got perl #20203 incorporated. Does it work on other platforms? The #ifdef version-checks need a little work: on Windows (and other platforms [-- which ones?] that rely on Perl's makedef.pl to get symbols exported from the Perl library) you need perl-5.8.1; on other platforms the test for perl-5.8.0 should be fine. The brokenness of Apache-print() under perl-5.8.0 on Windows et al would also need documenting somewhere since it can't be fixed properly. Maybe it's just easier to change the version-checks to 5.8.1 for all platforms, and document the broken behaviour under 5.8.0? mod_perl 2 makes two special cases for handling systems that use export files - Win32 and aix ($^O eq 'aix'). So these might be the only two one has to worry about in this regard. These were the only two that Nicholas Clark mentioned when I asked about the missing PerlIO_isutf8() on the perl-xs list, so that may well be true. I will double-check with p5p to see if there are any more. I take it this is a problem in principle on all platforms running perl-5.8? Yes. If so, what might work is, for all platforms running 5.8.x, apply the patch, except for Win32 and aix (I'm not sure of aix), which would require 5.8.1. So something like #if PERL_VERSION = 8 #if ( defined(WIN32) || defined(_AIX) ) PERL_SUBVERSION = 1 #endif #endif And then, as you say, document the broken behaviour under Win32 (and aix?) for 5.8.0. I agree entirely with your sentiment, but shouldn't the logic be more like this: #if PERL_VERSION = 8 ((!defined(WIN32) !defined(_AIX)) || PERL_SUBVERSION = 1) ... #endif Steve
Re: Undocumented behaviour in Apache-print()?
Steve Hay wrote: Stas Bekman wrote: I have attempted to shoe-horn this into mod_perl's print() method (in src/modules/perl/Apache.xs). Here's the diff against mod_perl 1.28: [Unfortunately, I've had to comment-out the first part of that if block, because I got an unresolved external symbol error relating to the PerlIO_isutf8() function otherwise (which may be because that function isn't documented in the perlapio manpage).] mod_perl 1.x doesn't use perlio, hence you have this problem. adding: #include perlio.h should resolve it I think. No. The error was unresolved external symbol, which means that the compiler is happy (it evidently has pulled in perlio.h, or something else that declares PerlIO_isutf8() as extern ...), but that the linker couldn't find the definition of that function. (Check: If I change PerlIO_isutf8 to PerlIO_isutf (deliberate typo) then I get a different error - undefined; assuming extern returning int - because now no declaration has been supplied.) Listing the symbols exported from perl58.lib shows that PerlIO_isutf8 is *not* one of them. So where's the definition supposed to come from? I'll ask about this on the perlxs mailing list, I think. Having asked about this, it turns out that the problem was PerlIO_isutf8() not being exported from perl58.lib on Windows (and other platforms where the symbols to export have to be explicitly listed). I sent a patch off to p5p which fixes this (http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2003-07/msg01096.html), and it has been integrated as #20203. So presumably this will not be a problem in the upcoming perl-5.8.1, but how do we cope with the perl-5.8.0 case? I've attached a new patch (against mod_perl-1.28) which (I believe) fixes the UTF-8 problem, but it won't build on Windows with perl-5.8.0 without #20203. Steve --- Apache.xs.orig 2003-06-06 12:31:10.0 +0100 +++ Apache.xs 2003-07-18 08:47:59.0 +0100 @@ -1119,11 +1119,27 @@ SV *sv = sv_newmortal(); SV *rp = ST(0); SV *sendh = perl_get_sv(Apache::__SendHeader, TRUE); +#if PERL_VERSION = 8 + PerlIO *fp = IoOFP(GvIOp(defoutgv)); +#endif if(items 2) do_join(sv, sv_no, MARK+1, SP); /* $sv = join '', @_[1..$#_] */ else sv_setsv(sv, ST(1)); +#if PERL_VERSION = 8 + if (PerlIO_isutf8(fp)) { + if (!SvUTF8(sv)) + sv_utf8_upgrade(sv = sv_mortalcopy(sv)); + } + else if (DO_UTF8(sv)) { + if (!sv_utf8_downgrade((sv = sv_mortalcopy(sv)), TRUE) +ckWARN_d(WARN_UTF8)) + { + Perl_warner(aTHX_ packWARN(WARN_UTF8), Wide character in print); + } + } +#endif PUSHMARK(sp); XPUSHs(rp); @@ -1176,6 +1192,20 @@ int sent = 0; SV *sv = SvROK(ST(i)) (SvTYPE(SvRV(ST(i))) == SVt_PV) ? (SV*)SvRV(ST(i)) : ST(i); +#if PERL_VERSION = 8 + PerlIO *fp = IoOFP(GvIOp(defoutgv)); + if (PerlIO_isutf8(fp)) { + if (!SvUTF8(sv)) + sv_utf8_upgrade(sv = sv_mortalcopy(sv)); + } + else if (DO_UTF8(sv)) { + if (!sv_utf8_downgrade((sv = sv_mortalcopy(sv)), TRUE) +ckWARN_d(WARN_UTF8)) + { + Perl_warner(aTHX_ packWARN(WARN_UTF8), Wide character in print); + } + } +#endif buffer = SvPV(sv, len); #ifdef APACHE_SSL while(len 0) {
Re: Undocumented behaviour in Apache-print()?
Stas Bekman wrote: Steve Hay wrote: It's only Perl 5.8 that has the special UTF-8 flag which the functions above all operate with respect to. If a Perl variable contains a sequence of bytes that make up a valid UTF-8 character, but the string is not flagged with Perl's special flag, then Perl's built-in print() doesn't do this automatic conversion anyway. Yes. Apps wanting to handle utf will need to 'require 5.008;' as in your example. IOW, print Content-type: text/plain\n\n; $a = \xC3\xBC; print $a; retrieved from a mod_cgi server produces (via od -b / od -c): 000 303 274 002 yup, because you need to add utf8::decode($a); before printing $a. Which your version does as well. (Indeed. I meant it as example of how Perl's (5.8's) print() doesn't do the conversion on strings that are not *flagged* as UTF-8, even when they make valid UTF-8.) Perl 5.6 and older don't have the UTF-8 flag and hence don't do any automatic conversion via print(). Therefore, mod_perl's print() should not have the difference from Perl's print() that exists in 5.8, so no change should be required. Sure enough, looking at the doio.c source file in Perl 5.6.1, the entire chunk of code that I half-inched above is not present. So you suggest that we copy this functionality from Perl. So if need to #ifdef it for 5.8.0. So I'll add #if PERL_VERSION = 8 ... #endif around the code that I've added. I have attempted to shoe-horn this into mod_perl's print() method (in src/modules/perl/Apache.xs). Here's the diff against mod_perl 1.28: [Unfortunately, I've had to comment-out the first part of that if block, because I got an unresolved external symbol error relating to the PerlIO_isutf8() function otherwise (which may be because that function isn't documented in the perlapio manpage).] --- Apache.xs.orig2003-06-06 12:31:10.0 +0100 +++ Apache.xs2003-07-15 12:20:42.0 +0100 @@ -1119,12 +1119,25 @@ SV *sv = sv_newmortal(); SV *rp = ST(0); SV *sendh = perl_get_sv(Apache::__SendHeader, TRUE); +/*PerlIO *fp = PerlIO_stdout();*/ if(items 2) do_join(sv, sv_no, MARK+1, SP); /* $sv = join '', @_[1..$#_] */ else sv_setsv(sv, ST(1)); +/*if (PerlIO_isutf8(fp)) { +if (!SvUTF8(sv)) +sv_utf8_upgrade(sv = sv_mortalcopy(sv)); +} +else*/ if (DO_UTF8(sv)) { +if (!sv_utf8_downgrade((sv = sv_mortalcopy(sv)), TRUE) + ckWARN_d(WARN_UTF8)) +{ +Perl_warner(aTHX_ packWARN(WARN_UTF8), Wide character in print); +} +} + PUSHMARK(sp); XPUSHs(rp); XPUSHs(sv); Besides the problem with PerlIO_isutf8(), mod_perl 1.x doesn't use perlio, hence you have this problem. adding: #include perlio.h should resolve it I think. No. The error was unresolved external symbol, which means that the compiler is happy (it evidently has pulled in perlio.h, or something else that declares PerlIO_isutf8() as extern ...), but that the linker couldn't find the definition of that function. (Check: If I change PerlIO_isutf8 to PerlIO_isutf (deliberate typo) then I get a different error - undefined; assuming extern returning int - because now no declaration has been supplied.) Listing the symbols exported from perl58.lib shows that PerlIO_isutf8 is *not* one of them. So where's the definition supposed to come from? I'll ask about this on the perlxs mailing list, I think. there are other problems that spring to my mind straight away with this: - is getting the PerlIO * for STDOUT to right thing to be doing anyway? PerlIO *fp = IoOFP(GvIOp(defoutgv)) Seems to work OK for me. What's defoutgv? - if items 2, do we need to handle the UTF8-ness of each of those items individually before we join them? I'm not sure, how perl handles this? Struggling as best as I can to read pp_print() in Perl's pp_hot.c, it looks like Perl calls do_print() (which contains the UTF-8 handling that I've stolen) for each item in the list that is passed to it. Considering this more, I think that it probably isn't an issue: if you have two variables in Perl, one of which is flagged UTF-8 and the other of which isn't, then when you concatenate them, the whole is upgraded to flagged UTF-8 anyway. However, it has occurred to me that I've missed out adding the UTF-8 handling to half of mod_perl's print() method! The method is split into two halves: if (!mod_perl_sent_header(r, 0)) { ... } else { ... } and I've only handled the first half! The first half joins all of the items together and then calls send_cgi_header(). That outputs everything down to the first blank line (i.e. all the headers), then sets the sent headers flag and recurses on $r-print(). Next time around, we'll enter the second half, which simply calls write_client(). If we've already been through the first half then the UTF-8 conversion will have been applied already
Re: Undocumented behaviour in Apache-print()?
Hi Stas, Stas Bekman wrote: Steve Hay wrote: Hi, I've just spent quite a while tracking down a problem with a web page generated by a mod_perl program in which 8-bit ISO-8859-1 characters were not being shown properly. The software runs via Apache::Registry, and works fine under mod_cgi. It turns out that the problem is due to a difference in behaviour between Perl's built-in print() function in Perl 5.8.0+ and the Apache-print() method that mod_perl overrides it with. I've consulted the documentation on the mod_perl website, and could find no mention of the difference. If my conclusions below are correct then this information may well be worth adding. [the rest of the very detailed analysis has been snipped] 5.8.0 is a pretty new perl version, which provides the new functionality, and it seems that hardly anybody has been using the UTF stuff with mod_perl. 5.8.0 is actually a couple of days short of being one year old (happy birthday!), which is increasingly not that new any more. 5.8.1 should be out soon too. As for hardly anybody using UTF8 stuff with mod_perl... I didn't think that I was until I realised that most XML parsers (certainly the two that I most uses -- XML::LibXML and XML::DOM) return all their data in Perl's internal UTF-8 format! Then the penny dropped that I was actually using it rather a lot :-) So I suppose you are the first one to hit the problem. Certainly we need to update mod_perl to handle this correctly. Would you be interested to try to make Apache-print() do the right thing? Hmm. We really need somebody who understands the internals of Perl and mod_perl better than me, but here's a first stab at it: The Perl source code contains a pp_print() function in pp_hot.c which I presume is basically CORE::print(). It makes use of a do_print() function. I think that function comes from doio.c, although it's actually called Perl_do_print() there. That function does some stuff with the UTF-8 flag, which I guess is the sort of thing that we're after. Here's a chunk of Perl_do_print() from Perl 5.8.0: if (PerlIO_isutf8(fp)) { if (!SvUTF8(sv)) sv_utf8_upgrade(sv = sv_mortalcopy(sv)); } else if (DO_UTF8(sv)) { if (!sv_utf8_downgrade((sv = sv_mortalcopy(sv)), TRUE) ckWARN_d(WARN_UTF8)) { Perl_warner(aTHX_ packWARN(WARN_UTF8), Wide character in print); } } I think what this does is look to see if the fp (a PerlIO *) has the :utf8 encoding layer. If so, then it upgrades the sv to UTF8 (which is always possible). If not, then it looks to see if the bytes pragma is enabled. If not, then it downgrades the sv from UTF8 (which is not always possible -- if that fails and the UTF8 warnings category is enabled then it outputs the good ol' Wide character in print warning). I have attempted to shoe-horn this into mod_perl's print() method (in src/modules/perl/Apache.xs). Here's the diff against mod_perl 1.28: [Unfortunately, I've had to comment-out the first part of that if block, because I got an unresolved external symbol error relating to the PerlIO_isutf8() function otherwise (which may be because that function isn't documented in the perlapio manpage).] --- Apache.xs.orig2003-06-06 12:31:10.0 +0100 +++ Apache.xs2003-07-15 12:20:42.0 +0100 @@ -1119,12 +1119,25 @@ SV *sv = sv_newmortal(); SV *rp = ST(0); SV *sendh = perl_get_sv(Apache::__SendHeader, TRUE); +/*PerlIO *fp = PerlIO_stdout();*/ if(items 2) do_join(sv, sv_no, MARK+1, SP); /* $sv = join '', @_[1..$#_] */ else sv_setsv(sv, ST(1)); +/*if (PerlIO_isutf8(fp)) { +if (!SvUTF8(sv)) +sv_utf8_upgrade(sv = sv_mortalcopy(sv)); +} +else*/ if (DO_UTF8(sv)) { +if (!sv_utf8_downgrade((sv = sv_mortalcopy(sv)), TRUE) + ckWARN_d(WARN_UTF8)) +{ +Perl_warner(aTHX_ packWARN(WARN_UTF8), Wide character in print); +} +} + PUSHMARK(sp); XPUSHs(rp); XPUSHs(sv); Besides the problem with PerlIO_isutf8(), there are other problems that spring to my mind straight away with this: - is getting the PerlIO * for STDOUT to right thing to be doing anyway? - if items 2, do we need to handle the UTF8-ness of each of those items individually before we join them? - we need to code this in such a way as to remain backwards compatible with older Perls. Anyway, it's a start. If not, we should log it in the STATUS file and hopefully someone will have the time and inclination to solve it. Hopefully the above stab at it will encourage somebody to have a serious look. In any case a simple test that reproduces the problem will be needed. This test program reproduces the problem: use 5.008; use Encode; print Content-type: text/plain\n\n, decode('iso-8859-1', 'ü'); Use LWP's get program to get that from an Apache/mod_cgi setup, run it through UNIX's od -c (get http://localhost/cgi-bin/test.pl | od
Re: Undocumented behaviour in Apache-print()?
Stas Bekman wrote: I have attempted to shoe-horn this into mod_perl's print() method (in src/modules/perl/Apache.xs). Here's the diff against mod_perl 1.28: [Unfortunately, I've had to comment-out the first part of that if block, because I got an unresolved external symbol error relating to the PerlIO_isutf8() function otherwise (which may be because that function isn't documented in the perlapio manpage).] --- Apache.xs.orig2003-06-06 12:31:10.0 +0100 +++ Apache.xs2003-07-15 12:20:42.0 +0100 @@ -1119,12 +1119,25 @@ SV *sv = sv_newmortal(); SV *rp = ST(0); SV *sendh = perl_get_sv(Apache::__SendHeader, TRUE); +/*PerlIO *fp = PerlIO_stdout();*/ if(items 2) do_join(sv, sv_no, MARK+1, SP); /* $sv = join '', @_[1..$#_] */ else sv_setsv(sv, ST(1)); +/*if (PerlIO_isutf8(fp)) { +if (!SvUTF8(sv)) +sv_utf8_upgrade(sv = sv_mortalcopy(sv)); +} +else*/ if (DO_UTF8(sv)) { +if (!sv_utf8_downgrade((sv = sv_mortalcopy(sv)), TRUE) + ckWARN_d(WARN_UTF8)) +{ +Perl_warner(aTHX_ packWARN(WARN_UTF8), Wide character in print); +} +} + PUSHMARK(sp); XPUSHs(rp); XPUSHs(sv); Besides the problem with PerlIO_isutf8(), there are other problems that spring to my mind straight away with this: - is getting the PerlIO * for STDOUT to right thing to be doing anyway? - if items 2, do we need to handle the UTF8-ness of each of those items individually before we join them? - we need to code this in such a way as to remain backwards compatible with older Perls. looks like this is the main question. Do we handle utf8 only for perl 5.8? It's only Perl 5.8 that has the special UTF-8 flag which the functions above all operate with respect to. If a Perl variable contains a sequence of bytes that make up a valid UTF-8 character, but the string is not flagged with Perl's special flag, then Perl's built-in print() doesn't do this automatic conversion anyway. IOW, print Content-type: text/plain\n\n; $a = \xC3\xBC; print $a; retrieved from a mod_cgi server produces (via od -b / od -c): 000 303 274 002 Perl 5.6 and older don't have the UTF-8 flag and hence don't do any automatic conversion via print(). Therefore, mod_perl's print() should not have the difference from Perl's print() that exists in 5.8, so no change should be required. Sure enough, looking at the doio.c source file in Perl 5.6.1, the entire chunk of code that I half-inched above is not present. Steve
Undocumented behaviour in Apache-print()?
Hi, I've just spent quite a while tracking down a problem with a web page generated by a mod_perl program in which 8-bit ISO-8859-1 characters were not being shown properly. The software runs via Apache::Registry, and works fine under mod_cgi. It turns out that the problem is due to a difference in behaviour between Perl's built-in print() function in Perl 5.8.0+ and the Apache-print() method that mod_perl overrides it with. I've consulted the documentation on the mod_perl website, and could find no mention of the difference. If my conclusions below are correct then this information may well be worth adding. Under Perl 5.8.0, if a string stored in Perl's internal UTF-8 format is passed to print() then by default it will be converted to the machine's native 8-bit character set on output to STDOUT. In my case, this is exactly as if I had called binmode(STDOUT, ':encoding(iso-8859-1)') before the print(). (If any characters in the UTF-8 string are not representable in ISO-8859-1 then a Wide character in print() warning will be emitted, and the bytes that make up that UTF-8 character will be output.) However, mod_perl's Apache-print() method does not perform this automatic conversion. It simply prints the bytes that make up each UTF-8 character (i.e. it outputs the UTF-8 string as UTF-8), exactly as if you had called binmode(STDOUT, ':utf8') before Apache-print(). (No Wide character in print() warnings are produced for charcaters with code points 0xFF either.) The test program below illustrates this difference: use 5.008; use strict; use warnings; use Encode; my $cset = 'ISO-8859-1'; #my $cset = 'UTF-8'; print Content-type: text/html; charset=$cset\n\n; print EOT; html head meta http-equiv=Content-type content=text/html; charset=$cset /head body EOT # $str is stored in Perl's internal UTF-8 format. my $str = Encode::decode('iso-8859-1', 'Zurück'); print p$str/p\n; print EOT; /body /html EOT Running under mod_cgi (using Perl's built-in print() function) the UTF-8 encoded data in $str is converted to ISO-8859-1 on-the-fly by the print(), and the end-user will see the intended output when $cset is ISO-8859-1. (Changing $cset to UTF-8 causes the ü to be replaced with ? in my web browser because the ü which is output is not a valid UTF-8 character (which the output is labelled as).) Running under mod_perl (with Perl's built-in print() function now overridden by the Apache-print() method) the UTF-8 encoded data in $str is NOT converted to ISO-8859-1 on-the-fly as it is printed, and the end-user will see the two bytes that make up the UTF-8 representation of ü when $cset is ISO-8859-1. Changing $cset to UTF-8 in this case fixes it, because the output stream in this case happens to be valid UTF-8 all the way through. There are two solutions to this: 1. To use $cset = 'ISO-8859-1': Explicitly convert the UTF-8 data in $str to ISO-8859-1 yourself before sending it to print(), rather than relying on print() to do that for you. This is, in general, not possible (not all characters in the UTF-8 string may be representable in ISO-8859-1), but for HTML output we can arrange for Encode::encode to convert any non-representable charcaters to their HTML character references: $str = Encode::encode('iso-8859-1', $str, Encode::FB_HTMLCREF); 2. To use $cset = 'UTF-8': Output UTF-8 directly, ensuring that *all* outgoing data is UTF-8 by adding an appropriate layer on STDOUT: binmode STDOUT, ':utf8'; The second method here is generally to be preferred, but in the old software that I was experiencing problems with, I was not able to add the utf8 layer to STDOUT reliably (the data was being output from a multitude of print() statements scattered in various places), so I stuck with the first method. I believed that it should work without the explicit encoding to ISO-8859-1 because I was unaware that mod_perl's print() override removed Perl's implicit encoding behaviour. Actually, the explicit encoding above is better anyway because it also handles characters that can't be encoded to ISO-8859-1, but nevertheless I think the difference in mod_perl's print() is still worth mentioning in the documentation somewhere. Cheers, Steve
Re: [ANNOUNCE] mod_perl-1.28
Hi Randy, Randy Kobes wrote: On Thu, 3 Jul 2003, Steve Hay wrote: Philippe M. Chiasson wrote: The URL http://perl.apache.org/dist/mod_perl-1.28.tar.gz has entered CPAN I still get the same test failures that I reported before when RC2 was announced: modules/request...FAILED tests 3-8 Failed 6/10 tests, 40.00% okay Setup: Windows XP, Perl 5.8.0, Apache 1.3.27, Apache-Test 1.03, libapreq-1.2 (built/installed *after* mod_perl 1.28). I used to have All tests successful under mp-1.27. This may be a problem with libapreq - the mod_perl t/modules/request.t tests, among other things, the sizes involved with file uploads. The error log you posted earlier reported a difference in these sizes for three (text) files, with a binary (gif) file apparently OK (interestingly, with a patch I posted earlier to allow Win32 ActivePerl 8xx to be used with mod_perl 1 (with LARGE_FILES support), I get a failure with the gif file, but not the text files). Anyway, could you see if the following helps (applied to the libapreq sources)? For me, this allows all the mod_perl t/modules/request tests to pass. Yes, this fixes it for me. All the mod_perl 1.28 tests now pass (and all the libapreq 1.2 tests still pass as well). Thanks! Steve Index: Request/Request.xs === RCS file: /home/cvs/httpd-apreq/Request/Request.xs,v retrieving revision 1.36 diff -u -r1.36 Request.xs --- Request/Request.xs 25 Jun 2003 07:59:37 - 1.36 +++ Request/Request.xs 4 Jul 2003 05:32:59 - @@ -533,7 +533,7 @@ if (fd 0) XSRETURN_UNDEF; -if ( !(RETVAL = PerlIO_fdopen(fd, r)) ) +if ( !(RETVAL = PerlIO_fdopen(fd, rb)) ) XSRETURN_UNDEF; #else if ( ( RETVAL = PerlIO_importFILE(fp,0) ) == NULL ) @@ -558,7 +558,7 @@ PerlIO *fp; fd = PerlLIO_dup(fd); - if (!(fp = PerlIO_fdopen(fd, r))) { +if (!(fp = PerlIO_fdopen(fd, rb))) { PerlLIO_close(fd); croak(fdopen failed!); } The first r - rb change (which affects the mod_perl tests) is only relevant for Perl 5.7, which is why this problem didn't arise on Win32 with Perl-5.6. Also, I think this r - rb doesn't have any effect on Unix, but I haven't tested this.
Re: [ANNOUNCE] mod_perl-1.28
Hi Philippe, Philippe M. Chiasson wrote: The URL http://perl.apache.org/dist/mod_perl-1.28.tar.gz has entered CPAN I still get the same test failures that I reported before when RC2 was announced: modules/request...FAILED tests 3-8 Failed 6/10 tests, 40.00% okay Setup: Windows XP, Perl 5.8.0, Apache 1.3.27, Apache-Test 1.03, libapreq-1.2 (built/installed *after* mod_perl 1.28). I used to have All tests successful under mp-1.27. (I note that Apache::Reload didn't make it in either; I thought the plan was to put a backport of the version from mp2 into it?) Steve
Re: [mp1] 1.28 release candidate #2
Hi Randy, Randy Kobes wrote: On Tue, 24 Jun 2003, Steve Hay wrote: Philippe M. Chiasson wrote: On Tue, 2003-06-24 at 23:00, Steve Hay wrote: Philippe M. Chiasson wrote: Now bringing you the second mod_perl 1.28 release candidate. [snip] Windows XP, Apache 1.3.27, Perl 5.8.0: Failed Test Stat Wstat Total Fail Failed List of Failed --- modules/request.t 106 60.00% 3-8 Is it possible that you have an older version of Apache::Request lying around that was not recompiled against this new mod_perl ? (hapenned to me more than once) I did initially have libapreq-1.1 compiled against mp-1.27. I've now tried 1.2 compiled against the new mod_perl, and I still get the same result. (I have Apache-Test 1.03 in place, if that's at all relevant.) Did the libapreq-1.2 tests pass? Yes -- all successful. Also, what's your 'perl -V'? mod_perl 1 with ActivePerl 8xx (based on perl-5.8) doesn't build, due to the addition of LARGE_FILES support, so you must have disabled that. Yes, you're right - I've built Perl myself using ActivePerl 806 sources, and I've disabled USE_LARGE_FILES (and also USE_MULTI, USE_ITHREADS and USE_IMP_SYS, and I've enabled PERL_MALLOC and PERL_DEBUGGING_MSTATS). Here's my perl -V: Summary of my perl5 (revision 5 version 8 subversion 0) configuration: Platform: osname=MSWin32, osvers=4.0, archname=MSWin32-x86-perlio uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=define d_sfio=undef uselargefiles=undef usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=y, bincompat5005=undef Compiler: cc='cl', ccflags ='-nologo -Gf -W3 -MD -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DPERL_DEBUGGING_MSTATS -DUSE_PERLIO -DPERL_MSVCRT_READFIX', optimize='-MD -DNDEBUG -O1', cppflags='-DWIN32' ccversion='', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4 alignbytes=8, prototype=define Linker and Libraries: ld='link', ldflags ='-nologo -nodefaultlib -release -libpath:C:\perl5\lib\CORE -machine:x86' libpth=C:\PROGRA~1\MICROS~2\VC98\lib C:\openssl\lib libs=libeay32.lib oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib perllibs=libeay32.lib oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib gnulibc_version='undef' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -release -libpath:C:\perl5\lib\CORE -machine:x86' Characteristics of this binary (from libperl): Compile-time options: Built under MSWin32 Compiled at May 1 2003 14:48:19 @INC: C:/perl5/lib C:/perl5/site/lib .
Re: [mp1] 1.28 release candidate #2
Philippe M. Chiasson wrote: Now bringing you the second mod_perl 1.28 release candidate. [snip] Please give this release a spin and report back any problems or failed tests to: [EMAIL PROTECTED] as soon as possible. The more platforms configurations, the merrier! Windows XP, Apache 1.3.27, Perl 5.8.0: Failed Test Stat Wstat Total Fail Failed List of Failed --- modules/request.t 106 60.00% 3-8 Philippe: Is the Apache::Reload stuff not going to make it into 1.28? I think it would be well worth waiting a little longer for 1.28 if that could make it in. Steve
Re: [mp1] 1.28 release candidate #2
Philippe M. Chiasson wrote: On Tue, 2003-06-24 at 23:00, Steve Hay wrote: Philippe M. Chiasson wrote: Now bringing you the second mod_perl 1.28 release candidate. [snip] Please give this release a spin and report back any problems or failed tests to: [EMAIL PROTECTED] as soon as possible. The more platforms configurations, the merrier! Windows XP, Apache 1.3.27, Perl 5.8.0: Failed Test Stat Wstat Total Fail Failed List of Failed --- modules/request.t 106 60.00% 3-8 Is it possible that you have an older version of Apache::Request lying around that was not recompiled against this new mod_perl ? (hapenned to me more than once) I did initially have libapreq-1.1 compiled against mp-1.27. I've now tried 1.2 compiled against the new mod_perl, and I still get the same result. (I have Apache-Test 1.03 in place, if that's at all relevant.) What's in the error_log? Loads of stuff -- I've attached it (gzipped). Philippe: Is the Apache::Reload stuff not going to make it into 1.28? I think it would be well worth waiting a little longer for 1.28 if that could make it in. Well, maybe, maybe not. In any case, I am planning to go at a mp 1.29 release fairly soon after 1.28 hits the decks. There are still quite a few itty-gritty bugs I want to hammer out of mod_perl 1, but that are yet a bit too touchy to roll up in a release without letting the CVS user some time to see it work/break for them. If you feel like submitting a back-port of Apache::Reload (with or without my new namespace deletion code), that has a few decents tests for it and works with perl 5.5.3 up to bleadperl, I would be happy to slip it into mp 1.28 with a version of 1.0_0 or similar to make sure CPAN won't be fooled into installing it for now. Just noticed there is Apache::Reload 0.07 on CPAN, so it would be safe. The last patch that I submitted (http://marc.theaimsgroup.com/?l=apache-modperl-devm=105595499417788w=2) almost fits the bill -- just remove the if (MOD_PERL2) stuff at the top for a mp1-only version. However, that uses the B module, which is only available from 5.005_03 up. That's all that you're asking for above, but when I previously pointed out that the current mp1 Makefile.PL specifies 5.003_97 up (in general, different on Win32/cygwin), you said that you didn't want to have to up the minimum requirement to 5.005_03. I also currently have no idea how to write tests for Apache modules and I'm unlikely to learn in the next couple of days, so unless you're happy with a 5.005_03 requirement for Apache::Reload and either don't mind having no tests or else can write some yourself then it looks like I'll have to wait until 1.29. Steve I guess for now the simplest thing would be to _strictly_ backwards port Apache::Reload with no mp2 specific code in there, just so it can be shipped in 1.28, then in the 1.29-dev cycle, I can worry about getting it either on CPAN or synced between both mp1 and mp2, as per the ongoign discussion with you and Stas on the matter. So, if you feel you can whip up a complete patch within the next few days, go for it. Otherwise, I'll delay this for inclusion in 1.29 (and remember, I would target that one quite soon after 1.28) Gozer out. Steve mod_perl_error_log.gz Description: GNU Zip compressed data
RE: Building mod-perl 2 for cygwin
Unfortunately, I get the same (as far as I can see) result. Here's my latest perl -V ... [perl-5.8.0]$ perl -V Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration: Platform: osname=cygwin, osvers=1.3.19(0.7132), archname=cygwin-thread-multi-64int uname='cygwin_nt-5.1 au-stb-mobile 1.3.19(0.7132) 2003-01-23 21:31 i686 unkn own unknown cygwin ' config_args='-Duse64bitint -Doptimize=-O2 -Dman3ext=3pm -Dusemultiplicity -D usethreads -Duselargefiles' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemultiplicity=de fine useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=define use64bitall=undef uselongdouble=undef usemymalloc=y, bincompat5005=undef Compiler: cc='gcc', ccflags ='-DPERL_USE_SAFE_PUTENV -fno-strict-aliasing', optimize='-O2', cppflags='-DPERL_USE_SAFE_PUTENV -fno-strict-aliasing' ccversion='', gccversion='3.2 20020927 (prerelease)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lsee ksize=4 alignbytes=8, prototype=define Linker and Libraries: ld='ld2', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /usr/lib /lib libs=-lgdbm -ldb -lcrypt -lutil perllibs=-lcrypt -lutil libc=/usr/lib/libc.a, so=dll, useshrplib=true, libperl=libperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags=' -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY USE_ITHREADS USE_64_BIT_INT USE_LARGE_FILES PERL_IMPLICIT_CONTEXT Built under cygwin Compiled at Feb 19 2003 20:16:49 %ENV: CYGWIN= @INC: /cygdrive/d/perldev /usr/local/lib/perl5/5.8.0/cygwin-thread-multi-64int /usr/local/lib/perl5/5.8.0 /usr/local/lib/perl5/site_perl/5.8.0/cygwin-thread-multi-64int /usr/local/lib/perl5/site_perl/5.8.0 /usr/local/lib/perl5/site_perl . -Original Message- From: Stas Bekman [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 19 February 2003 10:07 AM To: Steve Baldwin Cc: [EMAIL PROTECTED] Subject: Re: Building mod-perl 2 for cygwin Steve Baldwin wrote: OK, I've rebuilt my perl using the following options ... ./Configure -de -Duse64bitint -Doptimize=-O2 -Dman3ext=3pm (to try to keep as similar as possible to packaged perl, but without the threads stuff). I also tried with simply ./Configure -des With exactly the same result. and if you build with -Dusethreads?
RE: Building mod-perl 2 for cygwin
Thanks very much for your reply Stas. Pardon my ignorance, but are you saying I need to rebuild Perl with different options. The version of Perl I'm using is the packaged one I installed with the cygwin install utility. If this is the case, could you please a little more information as to the arguments you recommend to build a version of Perl that works fine 'standalone', as well as embedded (which I presume is the case with mod-perl) if that is possible. Steve -Original Message- From: Stas Bekman [mailto:[EMAIL PROTECTED]] Sent: Monday, 17 February 2003 4:03 PM Cc: Steve Baldwin; [EMAIL PROTECTED] Subject: Re: Building mod-perl 2 for cygwin We can take two approaches, patch all the places in the code where perl context is set explicitly to use #ifdef MULTIPLICITY, rather than #ifdef USE_THREADS. Or we can refuse to build mod_perl if MULTIPLICITY is enabled without the threads. Of course the first solution is more favorable for users. I've played a bit with various options and it seems that it's going to be a big trouble to support MULTIPLICITY without USE_THREADS. My suggestion for now is to either rebuild with -Uusemultiplicity or -Dusethreads (less preferred if you don't need threads, but need speed). README.cygwin says: =item * C-Dusemultiplicity Multiplicity is required when embedding Perl in a C program and using more than one interpreter instance. This works with the Cygwin port. Though I can't see that this is a required option. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Building mod-perl 2 for cygwin
I've got Apache2 installed and as far as I can tell, it is functional. I'm trying to build mod-perl from source (as I couldn't find any binaries for cygwin). When I initially ran the command : perl Makefile.PL MP_AP_PREFIX=/usr/local/apache2 I got errors telling me it couldn't find cygdb-3.1.dll, which I eventually tracked down to Apache::TextConfig::open_cmd. I commented out the line : local @ENV{ qw(PATH IFS CDPATH ENV BASH_ENV) }; and the errors went away (it was clearing $ENV{PATH} which I think was causing the error). However, when I run 'make', I get the following ... [mod_perl-1.99_08]$ make cd src/modules/perl make -f Makefile.modperl make[1]: Entering directory `/cygdrive/d/Downloads/mod_perl-1.99_08/src/modules/perl' gcc -I/cygdrive/d/Downloads/mod_perl-1.99_08/src/modules/perl -I/cygdrive/d/Downloads/mod_perl-1.99_08/xs -I/usr/local/apache2/include -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -I/usr/lib/perl5/5.8.0/cygwin-multi-64int/CORE -DMOD_PERL -O2 \ -c mod_perl.c mv mod_perl.o mod_perl.lo mod_perl.c: In function `modperl_shutdown': mod_perl.c:10: `my_perl' undeclared (first use in this function) mod_perl.c:10: (Each undeclared identifier is reported only once mod_perl.c:10: for each function it appears in.) mod_perl.c: In function `modperl_hook_post_config': mod_perl.c:498: `my_perl' undeclared (first use in this function) mod_perl.c: In function `modperl_response_handler_cgi': mod_perl.c:771: `my_perl' undeclared (first use in this function) make[1]: *** [mod_perl.lo] Error 1 make[1]: Leaving directory `/cygdrive/d/Downloads/mod_perl-1.99_08/src/modules/perl' make: *** [modperl_lib] Error 2 Here's my perl -V ... [mod_perl-1.99_08]$ perl -V Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration: Platform: osname=cygwin, osvers=1.3.12(0.5432), archname=cygwin-multi-64int uname='cygwin_nt-5.0 kmbestst 1.3.12(0.5432) 2002-07-06 02:16 i686 unknown ' config_args='-de -Dmksymlinks -Dusemultiplicity -Duse64bitint -Doptimize=-O2 -Dman3ext=3pm' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=defi ne useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=define use64bitall=undef uselongdouble=undef usemymalloc=y, bincompat5005=undef Compiler: cc='gcc', ccflags ='-DPERL_USE_SAFE_PUTENV -fno-strict-aliasing', optimize='-O2', cppflags='-DPERL_USE_SAFE_PUTENV -fno-strict-aliasing' ccversion='', gccversion='3.1.1 20020718 (prerelease)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lsee ksize=4 alignbytes=8, prototype=define Linker and Libraries: ld='ld2', ldflags =' -s -L/usr/local/lib' libpth=/usr/local/lib /usr/lib /lib libs=-lgdbm -lcrypt -lutil perllibs=-lcrypt -lutil libc=/usr/lib/libc.a, so=dll, useshrplib=true, libperl=libperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' -s' cccdlflags=' ', lddlflags=' -s -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY USE_64_BIT_INT USE_LARGE_FILES PERL_IMPLICI T_CONTEXT Built under cygwin Compiled at Jul 24 2002 18:47:09 %ENV: CYGWIN= @INC: /cygdrive/d/perldev /usr/lib/perl5/5.8.0/cygwin-multi-64int /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/cygwin-multi-64int /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl . Thanks for any help Steve
Re: [mp2]make test fails
On Tue, 21 Jan 2003 16:05:05 +1100 Stas Bekman [EMAIL PROTECTED] wrote: Steve Glaus wrote: On Mon, 20 Jan 2003 11:29:01 -0500 [EMAIL PROTECTED] wrote: Hi, I'm trying to build mod_perl2 with threads enabled. I recompiled apache with the worker mpm, built mod_perl which seemd to build fine.. however, when I go to 'make test' it gives me the following error: Cannot load /root/cvs/modperl-2.0/src/modules/perl/mod_perl.so into server: /root/cvs/modperl-2.0/src/modules/perl/mod_perl.so: undefined symbol: Perl_Ipatchlevel_ptr!!! what's the output of: nm /root/cvs/modperl-2.0/src/modules/perl/mod_perl.so should be something like: U Perl_Ipatchlevel_ptr which is an unresolved symbol, which gets resolved when libperl.so is loaded. To find out which perl library you have linked against, do: ldd modules/mod_perl.so |grep perl libperl.so = /home/stas/perl/blead-ithread/lib/5.9.0/i686-linux-thread-multi/CORE/libperl.so (0x4002e000) Now you can check whether the symbol is there. in my case: nm /home/stas/perl/blead-ithread/lib/5.9.0/i686-linux-thread-multi/CORE/libperl.so |grep Perl_Ipatch 0011fa41 T Perl_Ipatchlevel_ptr Chances are that you are linking against the wrong perl library, which will explain the resolving problem. Ok, I know we're probably going of topic here, but I'll ask anyways.. I did what you said...the symbol wasn't there in lipperl.so. So. I rebuilt my perl, rebuilt the library, rebuilt my perl again.. I only have one perl library on my system.. It still fails. This is a pretty new version of the perl library, so is it possible that I need an older one? (libperl-5.8.0). I'm at a bit of a loss as to where to go from here. Thx. Steve
Re: [mp2]make test fails
On Mon, 20 Jan 2003 11:29:01 -0500 [EMAIL PROTECTED] wrote: Hi, I'm trying to build mod_perl2 with threads enabled. I recompiled apache with the worker mpm, built mod_perl which seemd to build fine.. however, when I go to 'make test' it gives me the following error: Cannot load /root/cvs/modperl-2.0/src/modules/perl/mod_perl.so into server: /root/cvs/modperl-2.0/src/modules/perl/mod_perl.so: undefined symbol: Perl_Ipatchlevel_ptr!!! I got the exact same error when I used the prefork model... any thoughts?
Re: [mp2]make test fails
On Mon, 20 Jan 2003 11:29:01 -0500 [EMAIL PROTECTED] wrote: Hi, I'm trying to build mod_perl2 with threads enabled. I recompiled apache with the worker mpm, built mod_perl which seemd to build fine.. however, when I go to 'make test' it gives me the following error: Cannot load /root/cvs/modperl-2.0/src/modules/perl/mod_perl.so into server: /root/cvs/modperl-2.0/src/modules/perl/mod_perl.so: undefined symbol: Perl_Ipatchlevel_ptr!!! Does anyone know if it's something I'm doing wrong, or if this is just a temporary thing(I got the source for both apache and mod_perl from cvs) I don't really need the threads, so I'm going to try to build it with the prefork mpm. I just thought someone would like to know.. Thx. I got the exact same error when I compiled against the prefork model.. Any thoughts?
Re: mp2.0 Apache::Request
In the documentation of nodperl-2.0, I cannot find any references to libapreq and $r-param. correct me if I'm wrong anyone,but I don't think Apache::Request has been ported to modperl2 yet.. for now I'm using cgi
Re: modperl : how resolve conflict funtion name in different package
Ouimet, Pierre wrote: hi! I have that (by exemple ) : package pack1.pm sub get_data { # ... } package pack2.pm sub get_data { # same name, but doing other thing } I don't use export and I have conflict with this 2 package in log file (because it detect same function) In modperl I can't have same function ? That's impossible ! I can't beleive that! Is it possible to allow it ? In apache config or... !? Tanks a lot in advance! :) bye Finder It sounds like you're not actually using the package statement: pack1.pm should have a line at the beginning of the file saying 'package pack1;' and pack2.pm should have a line saying 'package pack2;' I'm only guessing what the problem is here, as you don't state exactly what the error message is. Steve -- Steve Piner Web Applications Developer Marketview Limited http://www.marketview.co.nz
Re: An URL is not Invoking the Anticipated Perl Module [mp2]
To: Stas Bekman [or anyone else]; For the purpose of clarifying the issue, are you saying there is contention between the two handlers which are declared within the httpd.conf, as it has been setup in this case? That is, since a handler has been declared within by the directory section [/var/www/perl] and another for the location [/CurrDate], the two handlers are contenting against the one other? Therefore, in this case, although Location /CurrDate has been defined, the default handler Directory /var/www/perl is overriding the CurrDate name space[!?] Would someone please clarify. From studying this further, I noticed I forgot to prefix the Location /CurrDate section with a PerlModule directive. Consequently, the following line has been added to the perl.conf file. PerModule: MyApache::CurrDate However, now, with this addition, when starting the Apache the following exception is genereated: httpd failed. The error was: Starting httpd: [Fri Jan 10 12:11:15 2003] [error] Can't locate MyApache/CurrDate.pm in @INC (@INC contains: /var/www/perl /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/Apache2 /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .) at (eval 4) line 3. You'll notice from this message, the path does include '/var/www/perl' and the perl module which is being called is within the '/var/www/perl/MyApache/' directory. (For good measure it was also placed within '/var/www/perl' without a resolution to the run time exception.) Incidentally, the format of the configuration file which is being used in this case has been adapted from the article Introducting mod_perl Handlers. I've also been using Getting Your Feet Wet with mod_perl. These resources can be respectfully found at http://perl.apache.org/docs/2.0/user/handlers/intro.html#What_are_Handlers_ and http://perl.apache.org/docs/2.0/user/intro/start_fast.html#Handler_Modules I found these to be very helpful for a newcomer. This later article was especially beneficial for it connected several fregmented thoughts together [at least in my own learning curve] into good concise working document. In my case, I found it helpful to get a perl script working [as a first measure] and then proceed to the use of a response handler. However, I did run across a problem with how the perl script name space was defined. The first example [in the article Getting Your Feet Wet] would not work when I used the syntax PerlResponseHandler Modperl::Registry nor PerlResponseHandler Modperl::Registry::handler. Consequently, I changed the format to PerlHandler ModPerl::Registry::handler and then my test script was able to run. Consequently, at this stage, a few questions remain. 1) Since, at least in this situation, I had to adapt the handler from being PerlResponseHandler to PerlHandler in order to get the perl scripting to work, does that also mean the same adaptation will be necessary in order to yield a result from a reponse handler for the CurrDate.pm module? 2) Once again, how do I instruct Apache to properly locate the CurrDate.pm file? [Stas, you may have already given me the answer to this latter question but more clarity is still needed.] 3) When I include the provision of the line PerModule: MyApache::CurrDate within the perl.conf file, Apache throws an exception and failed to start. Does this line need to be included, or something similiar to it, in order to Apache to locate the perl module? [Remember again, in this situation, a startup.pl script has been delcared in order to provide a library to search for perl modules.] The reason I'm asking this question is because the Introducing mod_perl Handlers article uses this convention while the Getting Your Feet Wet with mod_perl omitts this line. The environment is RH 8.0, Apache 2.0.40, mod_perl 1.99_05-dev, and Perl 5.8.0. [For those who are interested, the original post includes a complete copy of perf.conf and CurrDate.pm.] I have been piecing together various web resources but remain uncertain how to procede. Further help is appreciated. Stas, you have already replied to this once, and to another setup problem for which I was having. I am grateful. Thank you. Steve D wrote: The problem: Apache is generating File does not exist within its error.log and the message Object not found (The requested URL was not found. Error number 404.) while attempting to call a perl module from a brower. [...] Location /CurrDate SetHandler per-script PerlResponseHandler MyApache::CurrDate /Location s/per-script/perl-script/ SetHandler can't verify at parsing time whether a handler really exists, it's really a string. So in your case the default handler was handling that Location. See: http://httpd.apache.org/docs-2.0/mod/core.html
An URL is not Invoking the Anticipated Perl Module
The problem: Apache is generating “File does not exist” within its error.log and the message “Object not found” (The requested URL was not found. Error number 404.) while attempting to call a perl module from a brower. Since I am new with mod_perl, and somewhat with familiar perl, I must confess the following problem has baffled me while someone else may quickly see what is being done wrong. Appreciation is expressed in advance to anyone who can tell me what the problem might be or recommends a remedy. Below you’ll see the path settings found in the various configurations files. I have followed the string of recommendations found in the on-line documentation (from perl.apache.org, etc.) and but have also made minor adjustments relevant to this particular server’s configuration. I understand that I am providing some information (not much) which is not relevant to the immediate problem but can assist to give an overview the operating environment as a whole. Here are the details: Given: 1) The file httpd.conf contains the lines: ServerRoot "/etc/httpd" Include conf.d/*.conf (The presence of this include statement is before the invocation of the various LoadModules found in most httpd.conf files. Hence, the perl environment is set early in the Apache initialization process.) 2) and the file /etc/httpd/conf.d/perl.conf contains the lines: LoadModule perl_module modules/mod_perl.so PerlRequire "/var/www/perl/startup.pl" Alias /perl/ /var/www/perl/ Directory /var/www/perl SetHandler perl-script PerlHandler ModPerl::Registry::handler PerlOptions +ParseHeaders Options +ExecCGI /Directory Location /CurrDate SetHandler per-script PerlResponseHandler MyApache::CurrDate /Location 3) and the file /etc/httpd/perl/startup.pl contains the line: use lib qw(/var/www/perl); 4) and the file /etc/httpd/perl/MyApache/CurrDate.pm contains the line: package MyApache::CurrDate; then why does /var/httpd/error.log report: [error] [client 192.168.0.100] File does not exist: /var/www/html/CurrDate So, in otherwords, why is does the URL //192.168.0.100/CurrDate 'not' invoke CurrDate.pm from the anticipated directory of /var/httpd/perl/MyApache? Notice the Apache error log indicates that it is trying to access a file under the directory /var/www/html/ rather than /var/www/perl/. This is done even though the perl.conf file includes the Location directive which should redirect program control to the respective perl module. And, the startup script spec’s the parent directory where perl modules can be found. Incidentally, the intent of MyApache/CurrDate.pm is to test the existing mod_perl environment for its ability to run handlers. (Better said, it is to test my ability and the present set up. The system is being initialized for the first time on this system. Another version of CurrDate.pm, in the form of a script, was executable from a browser. So, Apache and Perl are likely set up correctly.) Security of the files shouldn't be a problem. The permissions of all respective files have been set to assure they ought to be both readable and executable from a browser. Now when the browser is pointed to a different address, i.e. //192.168.0.100/perl/CurrDate, then partial progress 'maybe' occurring for an Apache exception indicates: [error] 13440: ModPerl::Registry: /var/www/perl/CurrDate.pm not found or unable to stat So it appears, with this later URL address, access to modperl is being accomplished (!?). Granted, yet another problem may exists; namely, the one generated by the ModPerl Registry method. Hence, I may have two problems to resolve rather than just the one. An article (it is entitled “Getting Your Feet Wet with mod_perl”) declares a handler with the syntax “PerlResponseHandler ModPerl::Registry” where I have used a different syntax. It was “PerlHandler ModPerl::Registry::handler” for the former would not work on this system. The later was able to successfully run a script. This change was made to the directory /var/www/perl and not to the location called by /CurrDate name space. This may not have relevance to the problem at hand. I understand Apache directives have a precedence. However, I have sequenced the order of the directories in various ways without a resolution or apparent different effect. Any suggestions? Thank you for your assistance. #!/usr/bin/perl # # FileID: /perl/MyApache/currDate.pm # Edition: 1600.08012003 # Editor: Steve Davis # Install.: Powder Springs, GA # Purpose: To display the current date # package MyApache::CurrDate; use strict; use warnings; use Apache::RequestRec (); use Apache::RequestIO (); use Apache::Const -compile = qw(OK); sub handler { my ($SEC,$MIN,$HOUR,$MDAY,$MON,$YEAR,$WDAY,$YDAY,$ISDST) = localtime(time); my $CURR_MONTH = (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec) [$MON + 1]; my
[mp2] input filter
**Hi again. I just noticed my last post regarding this was html formatted, so I'm going to try again. Sorry about that everybody! ** I'm having some trouble configuring an input filter.. I'm using Apache 2.0.43, mod_perl 1.99_08-dev and perl 5.8.0. In httpd.conf, I just did this inside a VirtualHost PerlInputFilterHandler myApache::Filters::filter_in My code looks something like this: package myApache::Filters; #here I loaded different modules etc.. sub filter_in : FilterConnectionHandler{ my ($filter, $bb, $mode, $block, $readbytes) = @_ my $rv =$filter-next-get_brigade($bb, $mode, $block, $readbytes); return $rv unless $rv = APR::SUCCESS; print STDERR INPUT FILTER\n; my $c = $filter-c return Apache::OK; } This is pretty much just taken from the mod_perl filter documenation, so I'm pretty sure the code is OK. My problem is this: From the time I hit refresh in my browser to the time the content appears takes a very long time. The request completes eventually, it just takes forever. As soon as I take the filter handler out of httpd.conf it works perfectly Is this a configuration issue? Anyone have any ideas as to why this happens? Thanks a lot Steve P.S Thanks for bearing with me through my posting debacles
Re: input filter
- Original Message - From: Steves To: [EMAIL PROTECTED] Sent: Monday, January 06, 2003 7:10 PM Subject: input filter *Sorry if this has gotten sent twice* Hello, I'm having some trouble configuring an input filter.. I'm using Apache 2.0.43, mod_perl 1.99_08-dev and perl 5.8.0. In httpd.conf, I just did this inside a VirtualHost PerlInputFilterHandler myApache::Filters::filter_out My code looks something like this: package myApache::Filters; #here I loaded different modules etc.. sub filter_in : FilterConnectionHandler{ my ($filter, $bb, $mode, $block, $readbytes) = @_ my $rv =$filter-next-get_brigade($bb, $mode, $block, $readbytes); return $rv unless $rv = APR::SUCCESS; print STDERR INPUT FILTER\n; my $c = $filter-c } This is pretty much just taken from the mod_perl filter documenation, so I'm pretty sure the code is OK. My problem is, first and most obviously, the text INPUT FILTER gets printed to STDERR twice per connection. I'm not sure wether this is normal or not.. Secondly, from the time I hit refresh in my browser to the time the content appears takes approximately one minute.. the request completes eventually, it just takes a very long time. As soon as I take the filter handler out of httpd.conf it works perfectly Anyone know if this is a configuration issue or what? Thanks a lot for any insights Steve SORRY! The httpd.con configuration was a typo! It's really - PerlInputFilterHandler myApache::Filters::filter_in it IS configured correctly in my conf file, sorry about the confusion Steve
Re: perl's system() w/ apache under win2k
Terra Info wrote: 2) a probable answer anyhow- [...] Check to see if the user you run apache under is allowed to interact with the desktop. It should be in the services CPL applet under the entry for that service. Check that and restart the service. A related problem that I stumbled upon recently with a mod_perl program on WinNT is that the Win32::Shortcut module (used to create Windows shortcuts, a bit (but not much) like Unix links) doesn't work unless the Apache service is allowed to Interact with the Desktop. - Steve
RE: mod_perl make failed: cannot find -lapr
. [FAILED] I have to comment out the invocation of mod_perl in order to the web server to work. A request for more help: To continue with the football analogy which I started with, after mod_perl was finally compiled, I thought I was headed for a touchdown. Maybe, we have headed few yards toward the goal line. But a little more help is needed to head further towards making a score. I'll start a new thread for the sake this new problem. Concluding comment: For obvious reasons, I think Stan's comment about modify folks that the last edition of mod_perl requires the respective compatible edition of apache is an excellent idea. This will avoid a lot of headaches. The sooner this comment is added to the mod_perl web page, the better. Steve Your help will be very much appreciated to resolve the following issue. When attempting to make mod_perl.so, the make script 'almost' makes a touchdown but fails before getting to the finishing line. Now it is time get some help from a coach. Hopefully, with a little help, a touchdown will soon follow. Below, I present was appears to be the problem, but someone else will have to direct me to the next set of steps. I've spend an extensive amount of time trying to resolve this myself and it needs another set of eyes. The news groups were reviewed (repeatedly) for assistance, on-line docs, and what available books I could find. The environment is RH 8.0, Apache 2.0.43, Perl 5.8.0, mod_perl 1.99_07. As best as I can tell, Apache, Perl, and mod_perl have been compiled using the recommended configuration options listed in either Redhat's instructions or mod_perl's on-line docs. Get care has been taken to try to dot every one and cross every 't' to my ability. This problem 'may' have to do with an issue of a change of naming conventions which were adapted by the apr apache group. Confer with Stas Bekman's post on Nov 26, 2002 with a title of Problems compiling mod_perl 1.99_07 in RH 8.0. He provides a cvs patch; but, unfortunately, I'm not familiar with using that-as least-as of yet. (Look's like I might have learn this package real soon.) Are they any intentions to update the mod_perl-1.99_07.tar.gz? If my conclusion is correct, then currently, and according to the on-line instructions, the present tar.gz edition is not compatible to the latest edition of apache. (2.0.43). So, 'maybe' the cause of my make failure. It appears as if, only the cvs repository may be valid for compiling. If my analysis is correct, and a new edition of the respective non-cvs files be acquired, then can non-CVS incremental files be obtained somehow? I confess my ignorance and lack of familiarity with these packages so I could be off. Thank you. Steve The environment is described below. Apache has been configured with --prefix=/etc/httpd --with-mpm=prefork. Perl has been configured with -des -Dusethreads -Doptimize='-g' -Dusedevel. The perl Makefile.PL was flagged with MP_AP_PREFIX=/etc/httpd MP_INST_APACHE2=1 MP_APXS=/etc/httpd/bin. (I also, attempted to configure the mod_perl makefile with the MP_APXS which generated the same error message.) The details follow below. Here is excerpt from the screen dump from the make output. make[1] : Leaving directory `/usr/src/mod_perl/mod_perl-1.99_07/WrapXS' make[1] : Entering directory `/usr/src/mod_perl/mod_perl-1.99_07/docs/api/mod_perl-2.0' make[1] : Leaving directory `/usr/src/mod_perl/mod_perl-1.99_07/docs/api/mod_perl-2.0' make[1] : Entering directory `/usr/src/mod_perl/mod_perl-1.99_07/xs' make[2] : Entering directory `/usr/src/mod_perl/mod_perl-1.99_07/xs/APR' make[3] : Entering directory `/usr/src/mod_perl/mod_perl-1.99_07/xs/APR/APR' rm -f ../../../blib/arch/Apache2/auto/APR/APR.so LD_RUN_PATH=/usr/lib cc -shared -L/usr/local/lib APR.o -o ../../../blib/arch/Apache2-lapr -laprutil /usr/bin/ld : cannot find -lapr collect2 : ld returned 1 exit status make[3] : *** [../../../blib/arch/Apache2/auto/APR/APR.so] Error 1 make[3] : Leaving directory `/usr/src/mod_perl/mod_perl-1.99_07/xs/APR/APR' make[2] : *** [subdirs] Error 2 make[2] : Leaving directory `/usr/src/mod_perl/mod_perl-1.99_07/xs/APR' make[1] : *** [subdirs] Error 2 make[1]: Leaving directory `/usr/src/mod_perl/mod_perl-1.99_07/xs' m Here is a list of the files within /etc/httpd/lib. -rw-r--r-- 1 root root 6996 Dec 30 21:04 apr.exp -rw-r--r-- 1 root root 3481 Dec 30 21:04 aprutil.exp -rwxr-xr-x 1 root root 21354 Dec 30 21:01 apxs -rw-r--r-- 1 root root 2685082 Dec 30 21:03 libapr-0.a -rw-r--r-- 1 root root 628 Dec 30 21:03 libapr-0.la lrwxrwxrwx 1 root root 17 Dec 30 01:42 libapr-0.so - libapr-0.so.0.9.2 lrwxrwxrwx 1 root root 17 Dec 30 01:42 libapr-0.so.0 - libapr-0.so.0.9.2 -rwxr-xr-x 1 root root 1282063 Dec 30 01:42 libapr-0.so.0.9.2
mod_perl.c Not Compatible with Apache
Upon successfully compiling mod_perl 2.0, and modifying httpd.conf so that it becomes invoked at the start of Apache 2.0.43, the following error message is gernerated. It is httpd failed. The error was: Starting httpd: httpd: module mod_perl.c is not compatible with this version of Apache. Please contact the vendor for the correct version. [FAILED] If you would like you, may refer to the previous thread named mod_perl make failed: cannot find -lapr for a history of the root of this problem-particularly the last post directly before this article. This also shows the detail environment and configuration for the server in question. Else, I would be glad more details to this post. In brief, let me say, the system consists of RH 8.0, apache 2.0.43, and current CVS edition of mod_perl 2.0. It has a date stamp of 1/1/03. This is one problem which I don't know how to proceed with. Is this message saying the code in mod_perl's mod_perl.c is using an edition of 'C' code that is incompatible with Apache 2.0? Is the development environment for which mod_perl 2.0 is being developed, by its creators, using a 'C' compiler that is different than what is found on RH 8.0? Does any one have an idea of how I might go about solving this problem? Any advance given would be appreciated. Steve D
RE: mod_perl.c Not Compatible with Apache
Randy, All of what I've done, in the form of compiling software, has been done on the same computer and with the same release of the RH. So, there is nothing for which I'm doing to distinctly change which compiler is being used between the compilations of the packages. As best as I can recall, the answer is 'yes' to the last three questions you asked. 1) Everything compiles successfully. 2) The edition of mod_perl was obtained from cvs.apache.org while the Apache was from the distribution source repository. 3) The various release numbers for the packages where the most current; hence, 2.0.43 of Apache and 2.0 for mod_perl. Maybe there is some difference between the distribution and CVS versions of Apache. Perhaps, the next step will be to match packages via obtaining CVS editions from both packages and see what happens then. This shouldn't take to long. I'll give it a shot and provide an update. Let me also add, I'm grateful for your help. Thank you. Steve D The following comments were provided from Randy Kobes: I think in general the problem mod_perl.c is not compatible with this version of Apache. means that mod_perl was compiled against a different set of Apache sources than that used to build the server trying to load the mod_perl module (assuming that the same compiler is being used in building Perl, Apache, and mod_perl). Just to clarify what came from where - are you using a modperl-2.0 cvs snapshot from http://cvs.apache.org/snapshots/modperl-2.0/? - are you running Apache 2.0.43, compiled from the sources httpd-2.0.43.tar.gz from http://httpd.apache.org/dist/httpd/? If so, does modperl-2.0 compile against these apache 2.0 sources successfully? -- best regards, randy
RE: mod_perl.c Not Compatible with Apache
Randy, You 'maybe' on to something here. Let me report to you what I found. In order to be as careful and consistent as possible, I've actually started to keep a log of my activities. It records which commands which I've been used to compile the packages. So I can saw with certainty the following. Here are the parameters which I used to compile both Apache and mod_perl. To configure Apache: ./configure --prefix=/etc/httpd --with-mpm=prefork To configure mod_perl: perl Makefile.PL MP_AP_PREFIX=/etc/httpd MP_APXS=/etc/httpd/bin/apxs MP_INST_APACHE2=1 MP_DEBUG=1 Also, when I examine /etc/httpd/bin/httpd (the executable), /etc/httpd/lib/libarp*, and /etc/module/mod_perl.so, all the theses files have a creation date that's current (today's date). Plus, /etc/httpd/httpd.conf points to the current file locations. According to the RH 8.0 docs regarding Apache 2.X, they suggest modifying httpd.conf to incorporate the use of an include statement which invokes /etc/conf.d/perl.conf. This latter file points to /etc/httpd/module/mod_perl.3.0. I've mapped the files and dates. There doesn't appear to be any conflict here. However, for good measure, I just completed a search of the /etc/* and /usr/* directories for the presence of the httpd executable. And there are two of them on the system. To be expected, the /etc/httpd/bin/httpd executable is present. However, these is also an existence of a httpd executable under /usr/sbin. When I changed the name of /etc/sbin/httpd to /etc/sbin/httpd-bu (backup). The httpd web server wouldn't start any longer (I toggled this off and on via the service utilility [start - system settings - service]). /etc/sbin/httpd has a footprint of 384.7K where as /etc/httpd/bin/httpd is a 2meg file. I don't know whether /etc/sbin/httpd is being used to merely start /etc/httpd/bin/httpd or not. If you can advise further it would be helpful. This is the first time which I had to gain the merits (and subsequent challenges) of dealing with the open source world. Bringing mod_perl on-line has been a bitter-sweet experience. On the up side, it is certainly sweet to gain help from others for which I am exceedingly grateful for. In this regard, the help being provided is making this a better experience. To your credit, I not accustom to this type of aid when dealing with the proprietary world. That is, I am not familiar with receiving the same degree of cooperation, support, and camaraderie. Therefore, let me continue to express my gratitude. It means a lot to me. Thank you. Steve Steve D -Original Message- From: Randy Kobes [mailto:[EMAIL PROTECTED]] Sent: Friday, January 03, 2003 5:19 PM To: Steve Davis Cc: [EMAIL PROTECTED] Subject: RE: mod_perl.c Not Compatible with Apache On Fri, 3 Jan 2003, Steve Davis wrote: Randy, All of what I've done, in the form of compiling software, has been done on the same computer and with the same release of the RH. So, there is nothing for which I'm doing to distinctly change which compiler is being used between the compilations of the packages. As best as I can recall, the answer is 'yes' to the last three questions you asked. 1) Everything compiles successfully. 2) The edition of mod_perl was obtained from cvs.apache.org while the Apache was from the distribution source repository. 3) The various release numbers for the packages where the most current; hence, 2.0.43 of Apache and 2.0 for mod_perl. Maybe there is some difference between the distribution and CVS versions of Apache. Perhaps, the next step will be to match packages via obtaining CVS editions from both packages and see what happens then. This shouldn't take to long. I'll give it a shot and provide an update. This is strange ... I just tried, on a RedHat 7.1 system, the cvs modperl-2.0 sources compiled against Server version: Apache/2.0.43 built using stock httpd-2.0.43 sources, and it went fine. You shouldn't have to use the cvs apache sources. mod_perl was built as perl Makefile.PL MP_AP_PREFIX=/usr/local/httpd MP_INST_APACHE2=1 where the httpd binary is installed under /usr/local/httpd/bin. One thought ... Some Linux distributions come with their own Apache server, which may be in a different location than the Apache 2.0.43 you built and installed. Are you sure that the mod_perl you built is being used with your Apache-2.0.43 specified under MP_AP_PREFIX? -- best regards, randy
mod_perl make failed: cannot find -lapr
Your help will be very much appreciated to resolve the following issue. When attempting to make mod_perl.so, the make script 'almost' makes a touchdown but fails before getting to the finishing line. Now it is time get some help from a coach. Hopefully, with a little help, a touchdown will soon follow. Below, I present was appears to be the problem, but someone else will have to direct me to the next set of steps. I've spend an extensive amount of time trying to resolve this myself and it needs another set of eyes. The news groups were reviewed (repeatedly) for assistance, on-line docs, and what available books I could find. The environment is RH 8.0, Apache 2.0.43, Perl 5.8.0, mod_perl 1.99_07. As best as I can tell, Apache, Perl, and mod_perl have been compiled using the recommended configuration options listed in either Redhat's instructions or mod_perl's on-line docs. Get care has been taken to try to dot every one and cross every 't' to my ability. This problem 'may' have to do with an issue of a change of naming conventions which were adapted by the apr apache group. Confer with Stas Bekman's post on Nov 26, 2002 with a title of Problems compiling mod_perl 1.99_07 in RH 8.0. He provides a cvs patch; but, unfortunately, I'm not familiar with using that-as least-as of yet. (Look's like I might have learn this package real soon.) Are they any intentions to update the mod_perl-1.99_07.tar.gz? If my conclusion is correct, then currently, and according to the on-line instructions, the present tar.gz edition is not compatible to the latest edition of apache. (2.0.43). So, 'maybe' the cause of my make failure. It appears as if, only the cvs repository maybe a valid for compiling. If my analysis is correct, and a new edition of the respective non-cvs files be acquired somehow. I confuse my ignorance and lack of familiarity with these packages so I could be off. Thank you. Steve The environment is described below. Apache has been configured with --prefix=/etc/httpd --with-mpm=prefork. Perl has been configured with -des -Dusethreads -Doptimize='-g' -Dusedevel. The perl Makefile.PL was flagged with MP_AP_PREFIX=/etc/httpd MP_INST_APACHE2=1 MP_APXS=/etc/httpd/bin. (I also, attempted to configure the mod_perl makefile with the MP_APXS which generated the same error message.) The details follow below. Here is excerpt from the screen dump from the make output. make[1] : Leaving directory `/usr/src/mod_perl/mod_perl-1.99_07/WrapXS' make[1] : Entering directory `/usr/src/mod_perl/mod_perl-1.99_07/docs/api/mod_perl-2.0' make[1] : Leaving directory `/usr/src/mod_perl/mod_perl-1.99_07/docs/api/mod_perl-2.0' make[1] : Entering directory `/usr/src/mod_perl/mod_perl-1.99_07/xs' make[2] : Entering directory `/usr/src/mod_perl/mod_perl-1.99_07/xs/APR' make[3] : Entering directory `/usr/src/mod_perl/mod_perl-1.99_07/xs/APR/APR' rm -f ../../../blib/arch/Apache2/auto/APR/APR.so LD_RUN_PATH=/usr/lib cc -shared -L/usr/local/lib APR.o -o ../../../blib/arch/Apache2-lapr -laprutil /usr/bin/ld : cannot find -lapr collect2 : ld returned 1 exit status make[3] : *** [../../../blib/arch/Apache2/auto/APR/APR.so] Error 1 make[3] : Leaving directory `/usr/src/mod_perl/mod_perl-1.99_07/xs/APR/APR' make[2] : *** [subdirs] Error 2 make[2] : Leaving directory `/usr/src/mod_perl/mod_perl-1.99_07/xs/APR' make[1] : *** [subdirs] Error 2 make[1]: Leaving directory `/usr/src/mod_perl/mod_perl-1.99_07/xs' m Here is a list of the files within /etc/httpd/lib. -rw-r--r-- 1 root root 6996 Dec 30 21:04 apr.exp -rw-r--r-- 1 root root 3481 Dec 30 21:04 aprutil.exp -rwxr-xr-x 1 root root 21354 Dec 30 21:01 apxs -rw-r--r-- 1 root root 2685082 Dec 30 21:03 libapr-0.a -rw-r--r-- 1 root root 628 Dec 30 21:03 libapr-0.la lrwxrwxrwx 1 root root 17 Dec 30 01:42 libapr-0.so - libapr-0.so.0.9.2 lrwxrwxrwx 1 root root 17 Dec 30 01:42 libapr-0.so.0 - libapr-0.so.0.9.2 -rwxr-xr-x 1 root root 1282063 Dec 30 01:42 libapr-0.so.0.9.2 -rw-r--r-- 1 root root 1425080 Dec 30 21:04 libaprutil-0.a -rw-r--r-- 1 root root 640 Dec 30 21:04 libaprutil-0.la lrwxrwxrwx 1 root root 21 Dec 30 01:42 libaprutil-0.so - libaprutil-0.so.0.9.2 lrwxrwxrwx 1 root root 21 Dec 30 01:42 libaprutil-0.so.0 - libaprutil-0.so.0.9.2 -rwxr-xr-x 1 root root 765330 Dec 30 01:42 libaprutil-0.so.0.9.2 In case the following can be of any value, here is further info. from the perl REPORT program. (In this case that would be, /usr/src/mod_perl/mod_perl-1.99_07/t.) . Problem Description: [DESCRIBE THE PROBLEM HERE] 2. Used Components and their Configuration: *** using /usr/src/mod_perl/mod_perl-1.99_07/t/../lib/Apache/BuildConfig.pm *** Makefile.PL options: MP_APXS = /etc/httpd
Relative path problem
I installed the Win32 mod_perl 1.0 in Windows XP Professional just to see how it works. This distribution contains Perl 5.6.1 and Apache_1.3.27, together with mod_perl-1.27. In my index.pl, I call another perl file using a reletive path, like ../lib/work.pm. But I found this file cannot be found. Could someone tell me what is going on or give me some directions? _ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
Re: Problem compiling mod_perl 1.27 on Windows
Randy Kobes wrote: On Mon, 16 Dec 2002, Steve Hay wrote: Is there some other way, for Win32, to achieve what the PERL_USELARGEFILES=0 hack tried to do? This seems hard to do without recompiling either the standard Apache sources (to enable large_files support) or else the standard ActivePerl 8xx sources (to disable large_files support). Sounds like recompiling Perl from the ActivePerl 804 sources with large_files support disabled is my best bet. Am I correct in thinking that all I need to do to achieve this is change uselargefiles='define' back to uselargefiles='undef' in win32/config.vc, or is there anything else that I need to fiddle with too? - Steve
Problem compiling mod_perl 1.27 on Windows
Hi, I'm having trouble compiling mod_perl 1.27 (with Apache 1.3.27 / Perl 5.8.0) on Windows (XP SP1 with MS VC++ 6.0 SP5). It builds fine with Perl 5.8.0 standard sources, but I'm just trying to upgrade my Perl to the slightly patched sources that ActivePerl Build 804 uses. I've built Perl from these new sources with the same build options that I used before for the standard source build (no threading, and Perl's malloc). (The output of Perl -V is at the bottom of this mail.) I run the following commands to build mod_perl: perl Makefile.PL APACHE_SRC=C:/apache INSTALL_DLL=C:/apache/modules EAPI nmake The first command runs fine, but the second has the following error: Apache.xs(1963) : error C2115: '=' : incompatible types The line referred to by this error is: statcache = r-finfo; I've no idea why this should be causing a problem with the new Perl. If I switch the Perl that I'm building against back to the standard 5.8.0 (by simply re-naming directories) and then re-run the nmake command above then mod_perl compiles and links with no errors. Can anyone shed any light on this? - Steve = Summary of my perl5 (revision 5 version 8 subversion 0) configuration: Platform: osname=MSWin32, osvers=4.0, archname=MSWin32-x86-perlio uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=y, bincompat5005=undef Compiler: cc='cl', ccflags ='-nologo -Gf -W3 -MD -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DUSE_PERLIO -DPERL_MSVCRT_READFIX', optimize='-MD -DNDEBUG -O1', cppflags='-DWIN32' ccversion='', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='link', ldflags ='-nologo -nodefaultlib -release -libpath:C:\perl5\lib\CORE -machine:x86' libpth=C:\PROGRA~1\MICROS~2\VC98\lib C:\openssl\lib libs=libeay32.lib oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib perllibs=libeay32.lib oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib gnulibc_version='undef' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -release -libpath:C:\perl5\lib\CORE -machine:x86' Characteristics of this binary (from libperl): Compile-time options: USE_LARGE_FILES Built under MSWin32 Compiled at Dec 13 2002 08:42:43 @INC: C:/perl5/lib C:/perl5/site/lib .
Re: Problem compiling mod_perl 1.27 on Windows
Randy Kobes wrote: On Mon, 16 Dec 2002, Steve Hay wrote: I'm having trouble compiling mod_perl 1.27 (with Apache 1.3.27 / Perl 5.8.0) on Windows (XP SP1 with MS VC++ 6.0 SP5). It builds fine with Perl 5.8.0 standard sources, but I'm just trying to upgrade my Perl to the slightly patched sources that ActivePerl Build 804 uses. I've built Perl from these new sources with the same build options that I used before for the standard source build (no threading, and Perl's malloc). (The output of Perl -V is at the bottom of this mail.) [ .. ] Characteristics of this binary (from libperl): Compile-time options: USE_LARGE_FILES I've found the same thing - I believe it's because of the USE_LARGE_FILES support that ActivePerl 8xx has enabled, and this runs into a conflict with the standard Win32 apache-1 which doesn't have such support (in the above, statcache is from the Perl side, and r-finfo is from Apache). This is still being looked into ... One possibility is to recompile Apache with large_file support, but this is non-trivial. And since the bulk of Win32 development on Apache is going into Apache-2, it may be hard to get an Apache developer to look at this. Looking at mod_perl (1.27)'s Makefile.PL I see that there is a uselargefiles_check() routine that originally warned about conflicts, but now (as of 1.27, according to the Changes file) automatically sets PERL_USELARGEFILES=0 to try to avert disaster. But the only difference that this seems to make is to stop Perl's $Config{ccflags} from being appended to PERL_EXTRA_CFLAGS. However, my Perl (804)'s $Config{ccflags} doesn't mention anything to do with large_files, so it's hardly surprising that disaster is not averted (if this is indeed the problem). Is there some other way, for Win32, to achieve what the PERL_USELARGEFILES=0 hack tried to do? I also see that the warning that was originally output by uselargefiles_check() suggested re-building Apache with large_files support by simply specifying a couple of extra defines. I take it from what you're saying that it isn't quite as trivial as that on Win32? By the way, mod_perl-2 (for use with Apache2) compiles fine with the ActivePerl sources. I've been reluctant to use mod_perl 2 for anything more than testing purposes yet because its current version number (1.99_07) doesn't fill me with confidence that it's sufficiently stable. The mod_perl setup that I'm trying to build is destined for a production environment, so I'd rather stick to more tried and tested things for now. I would be interested to hear how stable people think mod_perl 2 currently is on Win32. - Steve
Re: mp2: Pb using HTML::Entities
gilles wrote: I write in my handler something like : use HTML::Entities; ... $r-content_type('text/html;charset=iso-8859-1') my $txt=Long life to the curren; decode_entities($txt) $r-print ($txt); return Apache::OK; I get in my navigator : Long life to the . (where . is a symbol different from euro symbol). If the character you're getting is a circle with 4 'spokes' extending from it to the top left, top right, bottom left and bottom right, then it's working - however, that's the universal currency symbol. For the euro, use euro; or #8364; Steve -- Steve Piner Web Applications Developer Marketview Limited http://www.marketview.co.nz
Re: FW: mod_perl / PerlAuthenHandler question
It sounds like mod_perl is installed and running OK. Quoting from http://httpd.apache.org/docs/mod/core.html#limit: In the general case, access control directives should not be placed within a limit section. Do you need the limit section? Can you run without it? Steve Mitchel, Jennifer (Jem) wrote: [...] I am running Apache 1.3.22 and mod_perl 1.21 on a Sun Solaris 2.6 machine. I'm sure Apache and mod_perl are running as I can successfully grab that out of $ENV{SERVER_SOFTWARE}. I'm using perl 5.005_03. I am trying use a .htaccess file to allow NT Authenitcation on a directory. However, I am getting a server error Syntax error on line 6 of /web/content/askLucent/password-reset/.htaccess: Invalid command 'PerlAuthenHandler', perhaps mis-spelled or defined by a module not included in the server configuration Here are the contents of my .htaccess file Limit GET POST AuthName NT Domain\Login and Password AuthType Basic #PerlSetVar NT_Controllers 'na02il0015dc00:na02il0015dc01' PerlSetVar NT_Controllers 'na02il0015dc04:na02il0015dc01:NA02IL0015DC02' PerlAuthenHandler Apache::AuthenN2 require valid-user /Limit I did build mod_perl with EVERYTHING=1 and did a make install and stopped restarted Apache. Printing out the SERVER_SOFTWARE environment variable it shows 'Apache/1.3.22 (Unix) mod_perl/1.21'. What else can I do to see if mod_perl works? Jem -Original Message- From: Steve Piner [mailto:stevep;marketview.co.nz] Sent: Monday, October 28, 2002 3:30 PM To: Mitchel, Jennifer (Jem) Subject: Re: mod_perl / PerlAuthenHandler question Mitchel, Jennifer (Jem) wrote: Steve, I read your reply to a POST: http://mathforum.org/epigone/modperl/flygrexspir/3D447423.895BFCB5;marketview.co.nz. I am seeing the same error I did build my mod_perl with EVERYTHING=1. Any other ideas on what I'd be missing? Jem No idea as yet. What operating system are you building on? What is the command line you are using? Does mod_perl work OK other than the authentication and authorisation? Also, do you mind if we also send replies to the mod_perl list? I don't know everything, and someone is more likely to spot any errors that I might make. Steve -- Steve Piner Web Applications Developer Marketview Limited http://www.marketview.co.nz -- Steve Piner Web Applications Developer Marketview Limited http://www.marketview.co.nz
Re: [OT] migrating from Apache to iPlanet; any mod_perl counterpart?
On Wed, Oct 09, 2002 at 02:43:18PM -0700, Paul wrote: I know there are servlets, but I was led to believe that I would almost be able to drop my mod_perl modules into the iPlanet server, as if it has some equivelent functionality. If so, I can't find any evidence of it, and I'm rather skeptical. The company is making us migrate (some baloney about being legally vulnerable because we're using open source), and I've got to convert a nice, simple, efficient Apache/mod_perl/MySQL solution to iPlanet/LDAP. Am I looking at a complete redesign here? If they won't let you use open-source tools, then the answer is definitely yes. (Perl is open-source.) And migrating from a relational database to LDAP might not be as obvious as... oh well. Anyway, if you can't get them to listen to reason, there's an NSAPI module on CPAN: http://search.cpan.org/author/BSUGARS/nsapi_perl-0.24/ But it's dated 1998, and iplanet is multi-threaded. And of course, the module is open-source as well. -- Steve
Java and Perl integration
Hi, This may not be the most proper place to ask. I am just curious if there is a way to call Java (or servlet) from Perl code or such an integration project under way? Steve Lihn -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it. ==
Re: mod_perl PerlAccessHandler/PerlAuthenHandler question
How is your mod_perl configured? Based on the error message you're getting, it appears that you may not have compiled in support for authentication or access control. If you built it yourself, you may need to add PERL_AUTHEN=1 and PERL_ACCESS=1 to the 'perl Makefile.PL' command line when building mod_perl. Unless you have reason not to, I'd recommend that you compile it with EVERYTHING=1. Steve Piner Harry Zhu wrote: I'm a verteran CGIer but a new mod-perl user. I have got the mod-perl running fine for the content handling. But when I try to step in to other stages like Authentication, and have trouble in setting PerlAccessHandler PerlAuthenHandler etc. If I put ###== Location /mpl/hello SetHandler perl-script PerlHandler Apache::Hello /Location ###== in the perl.conf file, it's ok. I got the expected from the browser. But when I changed above to ###== PerlModule Apache::AuthAnon Location /mpl/hello AuthName Anonymous AuthType Basic PerlAuthenHandler Apache::AuthAnon require valid-user PerlSetVar Anonymous anonymous|anybody SetHandler perl-script PerlHandler Apache::Hello /Location ###== and try to restart the server, I got Syntax error on line 9 of /usr/local/apache/conf/perl.conf: Invalid command 'PerlAuthenHandler', perhaps mis-spelled or defined by a module not included in the server configuration When I set up .htaccess in a directory test under DocumentRoot, ###== PerlAccessHandler Apache::GateKeeper PerlSetVar Gate closed ###== and try to access this directory, the server gives the Internal Error: /usr/local/apache/htdocs/test/.htaccess: Invalid command 'PerlAccessHandler', perhaps mis-spelled or defined by a module not included in the server configuration I can add use Apache::GateKeeper (); in the startup.pl and start the server without problem, so the module itself should be in the proper path for tyhe server to load. Any help on this will be apprieciated. Harry GreatLodge.com -- Steve Piner Web Applications Developer Marketview Limited http://www.marketview.co.nz
Re: Using Constants from seperate file
What does 'Constants.lib' look like? Does it have a 'package' statement? Does it use Exporter? If it's a package then unless you've got some magic in 'Constants.lib', that BEGIN block will not pull the constants into the current package - the 'import' call is missing. (See perldoc -f use) If it isn't a package, then it will only get pulled into the first package that 'require's it. In this case you probably want to be using 'do file' rather than 'require', however it would probably be better to convert the file into a proper package. What's so terrible about loading the constants file at startup? Steve Piner allan juul wrote: hi i wish to use use constants defined in a seperate file. my problem is, that sometimes it works sometimes it doesn't. when failing, the error_log says Bareword is not allowed so i guess it sometimes never loads my constants file at all. this is my basic approach: Package Foo:Bar; use strict; BEGIN { require Constants.lib; } sub handler { my $r = shift; ... my $sql = SQL_SELECT; # pull in constant value } is this a stupid approach, and if so what would be a more correct solution? (i would prefer _not_ to have the constant file loaded once and for all in a startup.pl). any suggestions appriciated thanks ./allan -- Steve Piner Web Applications Developer Marketview Limited http://www.marketview.co.nz
Re: New mod_perl site and oddness with IE
Stas Bekman wrote: Jim Helm wrote: Has anyone else had problems with this particular page under IE (6.0.2600 under XP) being extremly slow to update when paging up/down? It works fine under Mozilla, and it's not a memory or cpu issue (checked with task manager already). And when I say slow, I mean a simple down cursor causes the visible portion of the page to get painted in 4 noticble steps/chunks. An older version I tracked down with Google (http://www.apache.jp/perl/guide/performance.html) which is also 300K+ doesn't have the same problem - just to show that it's not purely the raw size of the page that is the problem. Just a little feedback for the new site (which is great, btw). If it's just me with the problem, I'll go find a rock to hide under. :) Is the size of the page causes the trouble? I don't have IE to try so hopefully someone will help us out here. What happens if you shorten the content of the page? My guess is that IE simply cannot cope with a long page and the current complex stylesheet (because as say it works fine with the same page and a simpler stylesheet, which includes no layout instructions). Suggestions on how to fix that are welcome. IE 5.50.4807.2300 (SP2) on Win98SE I had different problems - the first time I went to the page, IE crashed my machine, so I had to reboot. After I'd rebooted I went back to the page. I got the extremely slow scrolling, but, more significantly, I got the second half of the page overlaid on top of the first half. I grabbed a copy of the page with Opera's 'save with images' option (strangely enough doing it with IE, and viewing the result didn't get the same display) and verified that the bug occurred with my local copy. I then had a bit of a fiddle with the stylesheet, and discovered that taking out the 'position: relative's seemed to stop the overlay, improving IEs performance markedly without affecting the page layout in any of the browsers I have installed (Netscape 4.79, Mozilla 2002053012, Opera 6.04) (There was no reason *why* taking out the 'position: relative's should work - it just struck me as the first thing that wasn't necessary in the style sheet. Possibly irritating an IE bug just a little too much) Hope this helps, Steve -- Steve Piner Web Applications Developer Marketview Limited http://www.marketview.co.nz
Re: New mod_perl site and oddness with IE
allan juul wrote: Quoting Jim Helm [EMAIL PROTECTED]: Has anyone else had problems with this particular page under IE (6.0.2600 under XP) being extremly slow to update when paging up/down? It works fine under Mozilla, and it's not a memory or cpu issue (checked with task manager already). And when I say slow, I mean a simple down cursor causes the visible portion of the page to get painted in 4 noticble steps/chunks. --Jim please check if the problem exists on this url: http://www.bullitt.suite.dk/clean3/dst_html/docs/1.0/guide/performance.html if you have other browser software, please check and see if anything else is broken there as well. thanks a lot! /allan Looks good to me with on Win98SE * IE 5.50.4807.2300 (SP2) * Netscape 4.79 * Mozilla 2002053012 * Opera 6.04 -- Steve Piner Web Applications Developer Marketview Limited http://www.marketview.co.nz
Re: New mod_perl site and oddness with IE
Allan Juul wrote: before the mails comes tumbling in ... please check this url [tested on winXP/IE6.0] as already send to the docs list and original poster http://www.bullitt.suite.dk/clean3/dst_html/docs/1.0/guide/performance.html thanks ./allan (There was no reason *why* taking out the 'position: relative's should work - it just struck me as the first thing that wasn't necessary in the style sheet. Possibly irritating an IE bug just a little too much) not sure which rule of position you were talking about. the above url specify no position for the rightbox div div.rightbox had a 'position: relative' specified in ../../../style.css. It also specified a top and left of 0, so essentially the rule was saying 'lay out this box according to normal flow, then offset it from its original position by 0px' i.e. don't move it. It seemed superfluous, so I removed it. Doing so appeared to fix the problem with no discernible side effects. As for why it isn't affecting other pages, I have no idea. It's probably, as Stas suggests, a size thing. Is that the biggest page on the site? Steve -- Steve Piner Web Applications Developer Marketview Limited http://www.marketview.co.nz
Anti caching and auto refresh problem
I'm setting the following headers with mod_perl and there seems to be a bug in the way netscape 4.7 handles them. The page is being auto refreshed by Netscape if the document in cache is compared to document on network preference is set to every time. I've tried IE and I don't seem to have the problem, but haven't had a chance to test on any other platforms. I've tried removing the Expires header, but that didn't make a difference. I've searched the archives and bug databases but nothing has turned up. Here is an example header: HTTP/1.1 200 OK Date: Wed, 12 Jun 2002 15:28:59 GMT Server: Apache/1.3.22 (Unix) mod_perl/1.26 Pragma: no-cache Cache-Control: no-cache Connection: close Content-Type: image/gif Expires: Wed, 12 Jun 2002 15:28:59 GMT I know it might be a bit off topic but I was wondering if anyone else has run into this problem? Thanks, Steve
Apache Error Log
Hey people.. Wondering if someone could help me with this... I recently started using modperl2/apache2. Everything seems to work ok except for Apache's error logging. I don't seem to get my apache stderr untill I shutdown/restart the server. Thenit prints out the whole thing in one big batch. I read somewhere that modperl possibly takes over the logging handler for apache but I tried a PerlOptions -Log in the conf file and that doesn't seem to help. I posted my configuration along with this.. i don't really know what I'm doing when it comes to modperl2 so any help is appreciated.. thanks VirtualHost ErrorLog /home/webroot/sites/logs/www-error.log Alias /cgi-bin/ /home/webroot/sites/www/perl/ Alias perl/ /perl/ PerlModule Apache::Reload PerlModule ModPerl::Registry PerlSwitches -w PerlSwitches -T PerlOptions -Log Location /perl PerlOptions -ParseHeaders SetHandler perl-script PerlResponseHandler ModPerl::Registry Options ExecCGI allow from all /Location PerlRequire /home/webroot/sites/conf/perl_conf/startup.pl /VirtualHost
Fw: Apache Error Log
- Original Message - From: steve To: [EMAIL PROTECTED] Sent: Sunday, June 09, 2002 7:42 AM Subject: Apache Error Log Hey people.. Wondering if someone could help me with this... I recently started using modperl2/apache2. Everything seems to work ok except for Apache's error logging. I don't seem to get my apache stderr untill I shutdown/restart the server. Thenit prints out the whole thing in one big batch. I read somewhere that modperl possibly takes over the logging handler for apache but I tried a PerlOptions -Log in the conf file and that doesn't seem to help. I posted my configuration along with this.. i don't really know what I'm doing when it comes to modperl2 so any help is appreciated.. thanks VirtualHost ErrorLog /home/webroot/sites/logs/www-error.log Alias /cgi-bin/ /home/webroot/sites/www/perl/ Alias perl/ /perl/ PerlModule Apache::Reload PerlModule ModPerl::Registry PerlSwitches -w PerlSwitches -T PerlOptions -Log Location /perl PerlOptions -ParseHeaders SetHandler perl-script PerlResponseHandler ModPerl::Registry Options ExecCGI allow from all /Location PerlRequire /home/webroot/sites/conf/perl_conf/startup.pl /VirtualHost
Apache Error Log
Hey people.. Wondering if someone could help me with this... I recently started using modperl2/apache2. Everything seems to work ok except for Apache's error logging. I don't seem to get my apache stderr untill I shutdown/restart the server. Thenit prints out the whole thing in one big batch. I read somewhere that modperl possibly takes over the logging handler for apache but I tried a PerlOptions -Log in the conf file and that doesn't seem to help. I posted my configuration along with this.. i don't really know what I'm doing when it comes to modperl2 so any help is appreciated.. thanks VirtualHost ErrorLog /home/webroot/sites/logs/www-error.log Alias /cgi-bin/ /home/webroot/sites/www/perl/ Alias perl/ /perl/ PerlModule Apache::Reload PerlModule ModPerl::Registry PerlSwitches -w PerlSwitches -T PerlOptions -Log Location /perl PerlOptions -ParseHeaders SetHandler perl-script PerlResponseHandler ModPerl::Registry Options ExecCGI allow from all /Location PerlRequire /home/webroot/sites/conf/perl_conf/startup.pl /VirtualHost
GD::Graph probs
GD(help) I have been fiddling with this my perl GD:Graph prog and just can't get it to work, get the following error can anyone help??? I have managed to successfully plot a graph previously what am I doing wrong? --- Illegal division by zero at /home/zzchesh/perl/lib/site_perl/5.6.1/GD/Graph/axestype.pm line 1176, INFILE line 858. --- Here is a stdout of my array of array which the GD::Graph uses as its data sets. =-- Welsh emigrants' letters Benllech Congregational Chapel Minute Books Papers of Owen Lewis, Arthog World War II Newspapers Hugh Derfel Hughes Papers 6 5 4 4 4 HERE IS MY PROGRAM :- #!/home/zzchesh/perl/bin/perl -w # Reads in stats from all html tables in the Hub_Stat directory, produces a graph on the top ten searches on the Hub #use strict; #use GD::Graph::Data; use GD::Graph::bars; #use GD::Graph::pie; #use GD::Graph::lines; #use GD::Graph::points; # #use GD::Text; # for $file (*02.html){ open (INFILE, /home/zzchesh/WWW/docs/Hub_Stats/$file) or die there is no file $! ; while ($line = INFILE){ #chomp $line; if ($line =~ /td headers=header2(.*?)\/td/i){ # Record name $name = $1; chomp $name; $name .= \n; #push (@title, $name); } if ($line =~ /td headers=header3(.*?)\/td/i){ # Search frequency $num = $1; chomp $num; $num .= \n; #push (@searches, $num); } $hash{$name} = $num; } } foreach $name(sort { $hash{$b} = $hash{$a} } keys (%hash)){ #compares if ($count 5){ #print The Key is $name and the value is: $hash{$name}\n; push @title, $name; push @searches, $hash{$name}; #print $hash{$name}; #print $name; $count ++; } } push @graph_data, [ @searches]; push @graph_data, [ @title]; $graph = GD::Graph::bars-new(750, 400); $graph-set ( x_labels_vertical = 1); $graph-set( x_label = 'TITLE', y_label = 'NO. of SEARCHES', title = 'TOP TEN RECORDS FOR MARCH 2002', bar_spacing = 20, bar_width = 20, # y_min_value = 0, # y_max_value = 15 ) or warn $graph-error; print ##TITLE @title#\n; print ## SEARCHES @searches\n; #print @title\n; #print @searches\n; #print $name\n; #$graph-wanted(1,2,3,4,5,6,7,8,9,10) or die $data-error; $graph-plot(\@graph_data) or die $graph-error; open (GRAPH, Topsearches.jpg) || die Cannot open Topsearches.jpg: $!\n; print GRAPH $graph-gd-jpeg(200); print @searches\n; print @title\n; #print $num; $count =0; close (INFILE); Steve Tattersall Archives Hub Programmer MIMAS Manchester Computing Oxford Road Manchester M13 9PL Tel: 0161 275 6054 [EMAIL PROTECTED]
RE: schedule server possible?
What I am thinking is that if we can use Apache 2 to do it. That is, to make Apache's function beyond a request/response model. If this API is not there, I am proposing, if possible, 1. Add an Apache API to call sub init; when starting a thread. 2. Within sub init, it calls an Apache API to disable this thread from receiving request, so that it can be used solely for scheduling purpose. Any thumb up or down on this? Steve Lihn FIS Database Support, Merck Co., Inc. Tel: (908) 423 - 4441 -Original Message- From: Garnet R. Chaney [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 30, 2002 12:46 PM To: Lihn, Steve; [EMAIL PROTECTED] Subject: RE: schedule server possible? Steve, How about another process on the same machine that periodically accesses http://localhost/administration/schedule_tick.pl - Garnet Family Friendly Search - http://www.find11.com BidSearch - See how much others are bidding on keywords - http://bidsearch.find11.com -Original Message- From: Lihn, Steve [mailto:[EMAIL PROTECTED]] Sent: Monday, April 29, 2002 11:57 AM To: '[EMAIL PROTECTED]' Subject: schedule server possible? Hi, The Apache 2 Connection handler opens up the possibility of using it for all kinds of protocol servers. However, I have a wild question: Is it possible to use Apache mod_perl for a schedule server? I.e., a server that is self existent. For example, I can use Apache 2 for Telnet, FTP, SMTP, or even Telephony Server. But I will need a thread that processes the backend stuff, such as maintaining the database and message queue (more like a cron). Is this configuration possible? Steve Lihn FIS Database Support, Merck Co., Inc. Tel: (908) 423 - 4441 -- -- -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it. == == == -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it. ==
Re: Cheap and unique
David Jacobs wrote: I'm converting a few CGI scripts that used the PID as a cyclical unique number (in concert with TIMESTAMP - so it was TIMESTAMP.PID). Our goal is to find a replacement function that is extremely cheap (cheaper than say, random(100)) and will never repeat. Any ideas? Has anyone else faced this problem? tia David I'm just curious - what's wrong with the function you're already using? Steve -- Steve Piner Web Applications Developer Marketview Limited http://www.marketview.co.nz
Re: [Fwd: Re: Cheap and unique]
David Jacobs wrote: I'm just curious - what's wrong with the function you're already using? Steve Mod_Perl hangs on to it's PID, so it's no longer unique. (I _believe_) But the timestamp will make it unique - as long as you're not serving several requests per second. If you are, you could use a counter as well as, or in place of, the timestamp. All I'm saying is that CGI by itself doesn't guarantee a unique PID - your CGI's original author probably knew that, and incorporated the timestamp to guarantee uniqueness. mod_unique_id looks like a good solution, pending performance. Yeah, agreed. Thanks for your help so far, everyone! David -- Steve Piner Web Applications Developer Marketview Limited http://www.marketview.co.nz
RE: schedule server possible?
You can do this now. We rely on cron to kick off the job, but all the business logic is in Apache/mod_perl. How do you use cron to do scheduling, yet calls Apache/mod_perl to do the processing? Consider cron does not exist in Win32, maybe an all-Apache solution will be simpler and more elegant!? --Steve -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it. ==
schedule server possible?
Hi, The Apache 2 Connection handler opens up the possibility of using it for all kinds of protocol servers. However, I have a wild question: Is it possible to use Apache mod_perl for a schedule server? I.e., a server that is self existent. For example, I can use Apache 2 for Telnet, FTP, SMTP, or even Telephony Server. But I will need a thread that processes the backend stuff, such as maintaining the database and message queue (more like a cron). Is this configuration possible? Steve Lihn FIS Database Support, Merck Co., Inc. Tel: (908) 423 - 4441 -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it. ==
Apache::OK error
Hi, I am testing the Apache::Echo connection handler for Apache2 and mod_perl 2. But encounter the following error: [Thu Apr 25 15:32:15 2002] [error] failed to resolve handler `Apache::Echo' [Thu Apr 25 15:32:15 2002] [error] Bareword Apache::OK not allowed while strict subs in use at C:\Apache2/blib/lib/Apache2/Apache/Echo.pm line 25. Compilation failed in require at (eval 2) line 3. What do I miss? --Steve -- package Apache::Echo; use strict; use Apache::Connection (); use APR::Socket (); use constant BUFF_LEN = 1024; sub handler { my Apache::Connection $c = shift; my APR::Socket $socket = $c-client_socket; my $buff; for (;;) { my($rlen, $wlen); my $rlen = BUFF_LEN; $socket-recv($buff, $rlen); last if $rlen = 0; $wlen = $rlen; $socket-send($buff, $wlen); last if $wlen != $rlen; } return Apache::OK; } 1; __END__ Steve Lihn FIS Database Support, Merck Co., Inc. Tel: (908) 423 - 4441 -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it. ==
RE: Apache::Echo does not work
This combination allows Apache2 to compile. use Apache::Const qw/:common/; return OK; But when I telnet to that port. I do not get anything. Error log does not show anything as LogLevel is set to debug. Can someone take a close look what is wrong in Apache::Echo? Steve Lihn FIS Database Support, Merck Co., Inc. Tel: (908) 423 - 4441 -Original Message- From: Per Einar Ellefsen [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 4:32 PM To: Mod-perl list Subject: Re: Apache::OK error At 22:04 25.04.2002, Per Einar Ellefsen wrote: At 21:39 25.04.2002, Lihn, Steve wrote: Hi, I am testing the Apache::Echo connection handler for Apache2 and mod_perl 2. But encounter the following error: [Thu Apr 25 15:32:15 2002] [error] failed to resolve handler `Apache::Echo' [Thu Apr 25 15:32:15 2002] [error] Bareword Apache::OK not allowed while strict subs in use at C:\Apache2/blib/lib/Apache2/Apache/Echo.pm line 25. Compilation failed in require at (eval 2) line 3. What do I miss? Try adding use Apache::Const qw/:common/; at the top and replace return Apache::OK with return OK; Seems like the docs say Apache::OK everywhere, but I don't know if this is supposed to work or not. Or actually, looking at the files in t/, it's probably better to do: use Apache::Const -compile = 'OK'; And leave the Apache::OK line as is. -- Per Einar Ellefsen [EMAIL PROTECTED] -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it. ==
RE: Apache::Echo does not work
Can someone take a close look what is wrong in Apache::Echo? Sorry about this! It is working. In the docs, the input is echoed twice. I only saw it once on my screen so I thought it is not working. Later I put some debug code into the module. It indicates it receives the input. Maybe telnet on win32 behaves slightly different! Thanks for the help. Steve Lihn FIS Database Support, Merck Co., Inc. Tel: (908) 423 - 4441 -Original Message- From: Lihn, Steve [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 5:10 PM To: 'Per Einar Ellefsen'; Mod-perl list Subject: RE: Apache::Echo does not work This combination allows Apache2 to compile. use Apache::Const qw/:common/; return OK; But when I telnet to that port. I do not get anything. Error log does not show anything as LogLevel is set to debug. Can someone take a close look what is wrong in Apache::Echo? Steve Lihn FIS Database Support, Merck Co., Inc. Tel: (908) 423 - 4441 -Original Message- From: Per Einar Ellefsen [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 4:32 PM To: Mod-perl list Subject: Re: Apache::OK error At 22:04 25.04.2002, Per Einar Ellefsen wrote: At 21:39 25.04.2002, Lihn, Steve wrote: Hi, I am testing the Apache::Echo connection handler for Apache2 and mod_perl 2. But encounter the following error: [Thu Apr 25 15:32:15 2002] [error] failed to resolve handler `Apache::Echo' [Thu Apr 25 15:32:15 2002] [error] Bareword Apache::OK not allowed while strict subs in use at C:\Apache2/blib/lib/Apache2/Apache/Echo.pm line 25. Compilation failed in require at (eval 2) line 3. What do I miss? Try adding use Apache::Const qw/:common/; at the top and replace return Apache::OK with return OK; Seems like the docs say Apache::OK everywhere, but I don't know if this is supposed to work or not. Or actually, looking at the files in t/, it's probably better to do: use Apache::Const -compile = 'OK'; And leave the Apache::OK line as is. -- Per Einar Ellefsen [EMAIL PROTECTED] -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it. == -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it. == -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it. ==
Re: [ANNOUNCE] The New mod_perl logo - results now in...
Mark Fowler wrote: On Fri, 15 Mar 2002, Jonathan M. Hollin wrote: However, I request your comments on this idea: should we have just one button (helping to develop a distinct identity for mod_perl) or should we have several (for choice)? It's up to you... I think that we need one theme of buttons, to ensure consistent branding. As per my comments when I voted stated, I'd love to see some buttons/logos based on the winning logo. In particular: - A square button that's just made up of the square cog logo - A square button that's just made up of a grey m and a blue p - A small rectangle version of the words modperl without the cog ...you get the idea, variations around a central design Also, we could do with both a monochrome and a black and white version of the logo (for print.) Is the logo available in a vector file format so that we can easily make scaled copies of it? Or are we restricted to the pixel banners that currently exist? Later. Mark. -- s'' Mark Fowler London.pm Bath.pm http://www.twoshortplanks.com/ [EMAIL PROTECTED] ';use Term'Cap;$t=Tgetent Term'Cap{};print$t-Tputs(cl);for$w(split/ +/ ){for(0..30){$|=print$t-Tgoto(cm,$_,$y). $w;select$k,$k,$k,.03}$y+=2} I definitely agree with this. I'd like to see some more colour variations (maybe just background colours even) to allow it to fit into a site's design better. Jonathan asked whether we should have just one button, or several. I'd say just one theme, with several variations as mentioned above. Others have suggested several buttons and I'm assuming they mean with differing themes. I'm against that, as the point of a logo is to reinforce the branding of mod_perl. Of course, if people don't want to use this theme, they won't. That's fine. That's no worse than the current situation. Finally, I think the mod_perl/modperl/ModPerl/Mod_perl thing is a non-issue. We all know what is being talked about, right? It's nowhere near as bad as the .gif hard 'G' or soft 'G' or the vi V.I. versus 'vie' problems. Steve -- Steve Piner Web Applications Developer Marketview Limited http://www.marketview.co.nz
Re: [OT] RE: Installing Perl::Magick
Jonathan M. Hollin [EMAIL PROTECTED] wrote: I appreciate that. This is part of a mod_perl project, however I forgot to include [OT] in the subject line. The only reason I post here is that the quality of help, and accuracy of reply that I have experienced in the past is exactly what I need to get over my initial Linux confusion. However, if anyone knows of a _good_ Linux list... isp-linux? See http://isp-lists.isp-planet.com/isp-linux/ for mailing list subscription. The ImageMagick mailing list, magick-users is also problably a good resource for your problem. mailto:[EMAIL PROTECTED]?subject=subscribe Both lists are what I consider medium volume. You may also want to check for a list related to your Linux distro. A good place to find archives of hundreds of mailing lists which have a nice search interface is http://marc.theaimsgroup.com/. HTH, -- Steve Werby President, Befriend Internet Services LLC http://www.befriend.com/
Re: Question...
Do you need to expire the cookie when you leave the page? How about the following. When they login, you send down a cookie. when they go to that page, you check the cookie they sent, but send out a new value for that cookie, invalidating it. So when they leave that page they send back your invalid cookie. When they go back to the page, they'll send the invalid cookie, and you can then prompt them to log in or whatever. You'll get the invalid cookie sent back for images on that page, but that usually isn't a problem. Steve Piner Ryan Parr wrote: I think I'm missing something... If you set a session cookie (i.e. one with no expiry time) then the cookie will be deleted immediately upon browser close, forcing the user to login again if they've closed their browser instance. If you don't use cookies and allow basic auth then the exact same behavior is called, forcing the user to re-login only if they've closed that browser instance. Is there someway to expire cookies on page leave, or is this the smartass thing you were referring to? :) -- Ryan Parr - Original Message - From: Jon Robison [EMAIL PROTECTED] To: Ron Beck [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, February 12, 2002 12:28 PM Subject: Re: Question... Cookies! /me is in smartass mode today. --Jon Ron Beck wrote: Hello all, I need to know how to clear the $ENV variables. For example, I use a .htaccess file for specific directories which requires the user to enter userID and password. When they exit the page, I want them to have to re-enter userID and passwd if they enter the page again. Does anyone know how this is accomplished? TIA, Ron
Re: Single login/sign-on for different web apps?
Vsevolod Ilyushchenko wrote: Yes, but I still should be able to propely handle people who go to any of the protected sites first thing in the morning. I don't think I can get away with only exit-point authentication that you propose. If the entrance-point authentication works well, there should be no need for this additional level. (Please correct me if I am wrong. :) Do cookies get set if returned via an image? If so, once the user has logged in, you could return a page with invisible images on it, where each image is from each site that the user needs to be authenticated to. Each image is unimportant. The important bit is that an authentication cookie is set for each domain the image is returned from. This leaves one tricky point as far as I can see: you need to securely identify which image request comes from each user. The obvious/easy way would be to put some sort of unique identifier in the path or query string, but this may not be secure enough for your purposes. Oh yeah, it'd break if they didn't have images on. :-( Steve -- Steve Piner Web Applications Developer Marketview Limited http://www.marketview.co.nz
Re: Apache::AuthCookie login faliure reason
I am having some trouble getting Apache::AuthCookie (version 3 which i believe is the latest version) to do what want: What i want is: * To be able to give the user a reson if login fails - eg reason: * No such username * Your password was incorrect Has anyone else come across the same requirement/issue, and how have you solved it? I banged my head up against this same wall for awhile until, by reading AuthCookie's source, I was able to figure out the key to making it all work. In authen_cred (stripped-down example below), you need to set a cookie with a value that your ticket-checking code will know is invalid when you are given invalid credentials. But, in the interest of security, you don't want to say things like no such username and incorrect password - that just gives extra information to someone trying to hack their way in. sub authen_cred ($$\@) { my $self = shift; my $r = shift; my ($user,$pass) = @_; if ( check_creds($user,$pass) ) { # user's credentials are good, so generate ticket, log session, etc return $user:$ticket; } else { # Modify this (and the code above) if you want more shades of # meaning here. return oops; } } Then, in authen_ses_key: sub authen_ses_key ($$$) { my $self = shift; my $r = shift; my($user,$ticket) = split(/:/,shift,2); my $retval; return undef unless $user $ticket; if ( # ticket is good... $retval = # something indicating ticket is good... } else { # ticket is bad, so tell the login program/form about it... $r-subprocess_env('LocalAuthFailure','mumble') if ...; } # I also detect an expired session and indicate it like this: $r-subprocess_env('LocalAuthFailure','expired') unless $retval; if ( $retval ) { my $auth_name = $r-auth_name; # etc... } } After all that, your login program/form just reads LocalAuthFailure and acts appropriately: my ($reason,$detail); if ( $r-prev ) { $reason = $r-prev-subprocess_env(AuthCookieReason); $detail = $r-prev-subprocess_env(LocalAuthFailure); } #... # Possibly set an error string: my $error; $error = Authentication error. Please try again. if $reason =~ /bad/; $error = Your session has expired. Please reauthenticate. if $reason =~ /bad/ $detail =~ /expire/; # Now interpolate $error into the HTML we send to the browser my $form = HERE; html head ... $error ... I hope that these code snippets are enough to get you started. ...Steve -- Steve van der Burg Information Services London Health Sciences Centre (519) 685-8300 ext 35559 [EMAIL PROTECTED]
Re: Installing modules
John Michael wrote: Where can I find information on how to install modules like: Apache::Request libapreq-0.33.tar.gz Apache::DBIApacheDBI-0.88.tar.gz Would I install these as regular perl modules or are they installed as apache modules? They are regular perl modules. They only run under mod_perl though. :-) If you can, use the CPAN shell to install modules, (see 'perldoc CPAN') Otherwise, download and extract the module then change into its directory. Read the README and INSTALL files. Then - assuming those files don't say differently - type perl Makefile.PL make make test And if you're happy with the results, su to root and type make install Hope this helps. Steve -- Steve Piner Web Applications Developer Marketview Limited http://www.marketview.co.nz
Re: Install problems
John Michael wrote: Checking if your kit is complete. Looks good Writing Makefile for libapreq mkdir blib/lib mkdir blib/lib/auto mkdir blib/lib/auto/libapreq mkdir blib/man3 cp libapreq.pod blib/lib/libapreq.pod cp lib/Apache/libapreq.pm blib/lib/Apache/libapreq.pm make[1]: Entering directory `/usr/local/etc/libapreq-0.33/c' gcc -c -I/usr/lib/perl5/site_perl/5.6.0/i386-linux/auto/Apache/include -I/us r/lib/ perl5/site_perl/5.6.0/i386-linux/auto/Apache/include/modules/perl -fno-stric t- aliasing -02 -march=i386 -mcpu=i386 -DVERSION=\0.10\ -DXS_VERSION=\0.10\ -fPIC -I/usr/lib/perl5/5.6.0/i386-linux/CORE apache_request.c In file included from apache_request.c:58: apache_request.h:5:19: httpd.h: No such file or directory apache_request.h:6:25: http_config.h: No such file or directory apache_request.h:7:23: http_core.h: No such file or directory apache_request.h:8:22: http_log.h: No such file or directory apache_request.h:9:23: http_main.h: No such file or directory apache_request.h:10:27: http_portocol.h: No such file or directory apache_request.h:11:25: util_script.h: No such file or directory make[1]: *** [apache_request.o] Error 1 make[1]: Leaving directory `/usr/local/etc/libapreq-0.33/c' make[1]: *** [subdirs] Error 2 I'm confused. It looks like you might not have the 'apache-devel' package installed. (You did say you were on RedHat, didn't you?) Try installing that. Steve -- Steve Piner Web Applications Developer Marketview Limited http://www.marketview.co.nz
RE: [OT] pdf creation
simran writes: I believe there is also a Content-disposition tag you can use to tell the browser what to name the file... As mentioned below in my original post, it doesn't work in all browsers. Steve
Re: Apache 1.3.22 and modperl 1.26.
Brad Dameron wrote: I installed mod perl and php 4 into along with apache 1.3.22. When I add the following: Directory /web/htdocs/freeside Files ~ (\.cgi) AddHandler perl-script .cgi PerlHandler HTML::Mason /Files Perl require /var/conf/apache/handler.pl; /Perl /Directory and then try to start apache I get this error: Syntax error on line 338 of /var/conf/apache/httpd.conf: Invalid command 'Perl', perhaps mis-spelled or defined by a module not include d in the server configuration [trimmed] It sounds to me that when you recompiled mod_perl, you forgot to add PERL_SECTIONS=1 on the command line. Steve -- Steve Piner Web Applications Developer Marketview Limited http://www.marketview.co.nz
Re: [OT] pdf creation
Does anyone have success/horror stories generating pdf files under mod_perl? Recommendations? I recently built a customer billing system system that generated PDF invoices using Latex + Template-Toolkit. See http://template-toolkit.org/docs/blue/Manual/Filters.html This was an backend system, but the files could easily be generated online by simply wrapping the template processor in a handler with the appropriate Content-Type: headers. Tip: Although the Content-Disposition: header is supposed to tell the browser the appropriate filename for the file, this doesn't actually work in most browsers. The solution is to extend the URL past the handler/script, e.g. : http://server/perl/pdfgen.pl/MYPDFFILE.pdf Apache will dispatch this to pdfgen.pl, but the browser will assume the default filename is MYPDFFILE.pdf. Hope this helps, Steve