Re: [Fwd: Re: Cheap and unique]
Hi, I'm just curious - what's wrong with the function you're already using? Mod_Perl hangs on to it's PID, so it's no longer unique. (I _believe_) TIMESTAMP . $$ . $GLOBAL++ might work just as well (as $global will persist).. Cheers, Alex -- Alex Krohn [EMAIL PROTECTED]
Re: memory leaking with closures
Hi, With this simple test script: print Content-type: text/html\n\n; my $var = 'x' x 50; our $var = 'x' x 50; my $sub = sub { my $sub2 = sub { $var; }; }; print Done\n; $var does not get freed, and the process grows each request. Has anyone seen this sort of behavior and have any ideas/workarounds (besides don't yes. this is the documented behavior for closures. the anonymous sub must have it's own copy of $var which happens to be 500k plus perl overhead on each invocation. I think the problem is that $var doesn't get freed even when $var and $sub and $sub2 have all gone out of scope. That's a perl bug for which I can fathom no workaround. If any of those variables are still in scope, then of course $var can't get freed. Yes, upon further investigation, this perl script: while (1) { { my $var = 'x' x 50; my $sub = sub { my $sub2 = sub { $var; } }; } # $var and $sub should be gone, but memory is never freed sleep 1; # Don't crash things =) } will grow forever as $var never seems to be freed even when everything should go out of scope, definately a perl bug, not a mod_perl one. =) Oddly, if you just do my $sub = sub { $var; }; it does not grow, definately something strange going on. Happens on perl 5.004_04, 5.005_03 and 5.6.1. Cheers, Alex
memory leaking with closures
Hi, With this simple test script: print Content-type: text/html\n\n; my $var = 'x' x 50; my $sub = sub { my $sub2 = sub { $var; }; }; print Done\n; $var does not get freed, and the process grows each request. Has anyone seen this sort of behavior and have any ideas/workarounds (besides don't do that). Cheers, Alex
[JOB] Contract XS Job
Hi, This isn't really a strictly mod_perl related job, but we need someone who really knows Perl and C well, and I know a lot of talented people listen here. ;) We have created a perl templating module. It's quite fast, however we would like to improve performance by recoding the guts of the parsing in C. We would want the interface to the module to remain the same. Same concept of what was done with HTML::Parser. This is a contract job, perfect for telecommuters. If you have experience with XS and feel this is something you'd have fun doing, please send me a quick email and I can send you the module for a quote. Cheers, Alex Gossamer Threads Inc. -- Alex KrohnEmail: [EMAIL PROTECTED] Internet Consultant Phone: (604) 687-5804 http://www.gossamer-threads.com Fax : (604) 687-5806
init handler possible?
Hi, I'm looking for the opposite of a cleanup handler that can be set during runtime under Apache::Registry. For example, in a script running under Apache::Registry, I want to be able to add only: use MyModule; and have some initilization code get registered to run on every subsequent request automatically? I haven't been able to figure out if this is possible, the only thing I can see is adding the subroutine call after the use manually. Any ideas? Cheers, Alex Gossamer Threads Inc. -- Alex KrohnEmail: [EMAIL PROTECTED] Internet Consultant Phone: (604) 687-5804 http://www.gossamer-threads.com Fax : (604) 687-5806 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
error in Apache::Util
Hi! I'm running mod_perl 1.23/apache 1.3.12/perl 5.005_03 on Mandrake 7. mod_perl seems to be up and running and things are working well. However, I add: Location /test SetHandler perl-script PerlHandler My::Test /Location and Test.pm looks like: sub handler { my $r = shift; $r-send_http_header("text/html"); use Apache::Util (); print Apache::Util::escape_html("code"); } When I go to /test I get internal server error, and this in the logs: [Fri Apr 28 12:59:57 2000] [error] Can't locate loadable object for module Apache::Util in @INC (@INC contains: /home/alex /usr/lib/perl5/5.00503/i386-linux /usr/lib/perl5/5.00503 /usr/lib/perl5/site_perl/5.005/i386-linux /usr/lib/perl5/site_perl/5.005 . /usr/local/apache_perl/ /usr/local/apache_perl/lib/perl) at /usr/lib/perl5/site_perl/5.005/i386-linux/mod_perl.pm line 65535 BEGIN failed--compilation aborted at /home/alex/My/Tester.pm line 8. [Fri Apr 28 12:59:57 2000] [error] Undefined subroutine My::Tester::handler called. which seems to be a problem loading Apache::Util. Any idea where to go from here to debug? Cheers, Alex
Apache::VMonitor not loading..
Hi! I'm trying to get Apache::VMonitor to load on a new mod_perl 1.23/Apache 1.3.12/perl 5.005_03 installation. mod_perl is up and running fine, however I can't get Apache::VMonitor working. If I add use Apache::VMonitor; to my startup file, I can't start httpd, I get: [root@alex apache_perl]# perlctl start [Wed Apr 26 16:13:45 2000] [error] Can't locate loadable object for module Apache::Util in @INC (@INC contains: /usr/lib/perl5/5.00503/i386-linux /usr/lib/perl5/5.00503 /usr/lib/perl5/site_perl/5.005/i386-linux /usr/lib/perl5/site_perl/5.005 . /usr/local/apache_perl/ /usr/local/apache_perl/lib/perl) at /usr/lib/perl5/site_perl/5.005/i386-linux/mod_perl.pm line 65535 BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.005/Apache/VMonitor.pm line 10. BEGIN failed--compilation aborted at /usr/local/apache_perl/startup.pl line 11. Syntax error on line 38 of /usr/local/apache_perl/conf/httpd.conf: Can't locate loadable object for module Apache::Util in @INC (@INC contains: /usr/lib/perl5/5.00503/i386-linux /usr/lib/perl5/5.00503 /usr/lib/perl5/site_perl/5.005/i386-linux /usr/lib/perl5/site_perl/5.005 . /usr/local/apache_perl/ /usr/local/apache_perl/lib/perl) at /usr/lib/perl5/site_perl/5.005/i386-linux/mod_perl.pm line 65535 BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.005/Apache/VMonitor.pm line 10. BEGIN failed--compilation aborted at /usr/local/apache_perl/startup.pl line 11. /usr/local/apache_perl/bin/perlctl start: httpd could not be started [root@alex apache_perl]# Apache::Util is installed, and everything else seems to work.. Any ideas where to look? Cheers, Alex
make problems on BSDI 4.01
Hi, I'm trying to build mod_perl with Apache 1.3.9 and mod_perl 1.21. I'm running into the exact same problem described in this thread: http://www.progressive-comp.com/Lists/?l=apache-modperlm=92818993410677w=2 Basically, make returns: /gen_test_char test_char.h ./gen_test_char: can't load library 'libperl.so' *** Error code 16 Stop. *** Error code 1 perl -V looks like: www1# perl -V Summary of my perl5 (5.0 patchlevel 4 subversion 2) configuration: Platform: osname=bsdos, osvers=4.0, archname=i386-bsdos uname='bsdos bsdi.com 4.0 :bsdos_distribution defined: ' hint=recommended, useposix=true, d_sigaction=define bincompat3=y useperlio=undef d_sfio=undef Compiler: cc='cc', optimize='-O2', gccversion=2.7.2.1 cppflags='-I/usr/local/include' ccflags ='-I/usr/local/include' stdchar='char', d_stdstdio=undef, usevfork=false voidflags=15, castflags=0, d_casti32=define, d_castneg=define intsize=4, alignbytes=4, usemymalloc=n, randbits=15 Linker and Libraries: ld='ld', ldflags =' -L/usr/X11/lib -L/usr/local/lib' libpth=/usr/local/lib /usr/shlib /shlib /usr/lib /usr/X11/lib libs=-ldl -lm -lc libc=/shlib/libc.so, so=so useshrplib=true, libperl=libperl.so Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic -Wl,-rpath,/usr/libdata/perl5/i386-bsdos/5.00402/CORE' cccdlflags='-fPIC', lddlflags='-shared -x -L/usr/X11/lib -L/usr/local/lib' Characteristics of this binary (from libperl): Built under bsdos Compiled at Jun 12 1998 11:06:09 @INC: /usr/libdata/perl5/i386-bsdos/5.00402 /usr/libdata/perl5 /usr/libdata/perl5/site_perl/i386-bsdos /usr/libdata/perl5/site_perl /usr/libdata/perl5/site_perl/i386-bsdos/include which is exactly like the original poster. Is there any workaround besides installing a new version of perl? Thanks for any help! Alex
Re: make problems on BSDI 4.01
Hi, Thanks for the response! Well, I really can't tell what your problem is; many people use apache 1.3.9 and mod_perl 1.21 with dynamic linking on BSDI 4.0.1. However, I must admit this whole area is a bit of a black art to me. Two questions: 1) Was libperl.so installed correctly when you made mod_perl 1.21? For us, that location is /usr/local/apache/libexec. I'm not able to make mod_perl. I unpacked mod_perl 1.21, apache_1.3.9 and ran: perl Makefile.PL \ APACHE_PREFIX=/usr/local/apache_perl \ APACHE_SRC=../apache_1.3.9/src \ DO_HTTPD=1 \ USE_APACI=1 \ EVERYTHING=1 \ APACI_ARGS='list of args' which completed ok. Running make then returned the error: /gen_test_char test_char.h ./gen_test_char: can't load library 'libperl.so' *** Error code 16 2) For debugging, did you try adding the normal perl dynamic library location to /etc/ld.so.config and do a ldconfig? Something like a line: /usr/libdata/perl5/i386-bsdos/5.00402/CORE I believe the error message you mentioned will be generated when any function in libperl.so or any function *referenced* by a function in libperl.so fails to load. I added this and it worked perfectly! Do I need to keep this in, or should I expect any suprises with mod_perl later? =) Thanks! Alex
CGI.pm not maintaing values..
Hi, I've read through the guide, and tried to search through the list, but CGI.pm is a pretty common keyword, ;). This script which I thought should work fine under mod_perl using Apache::Registry doesn't: #!/usr/local/bin/perl # use CGI; use strict; my $in = new CGI; print $in-header(); print "Init Value: ", $in-param('val'), "\n"; foobar(); sub foobar { print "Sub Value: ", $in-param('val'), "\n"; } # I then run a couple times from the web test.cgi?val=a, test.cgi?val=b, etc. When I hit 6, 7 times things start getting strange (i.e. all the children have loaded the script). I then get: Init Value: a Sub Value: b Or, calling $in-param in one part of the script won't give you the same value as another part. I'm using: Apache 1.3.6 mod_perl 1.19 CGI.pm 2.53 perl 5.005_02 However, if I do: #!/usr/local/bin/perl # use CGI; use strict; my $in = new CGI; print $in-header(); print "Init Value: ", $in-param('val'), "\n"; foobar($in); sub foobar { my $in = shift; print "Sub Value: ", $in-param('val'), "\n"; } # The script works normally. I'm not quite sure what's going on. =) Have I just missed something obvious? Cheers, Alex Gossamer Threads Inc. -- Alex KrohnEmail: [EMAIL PROTECTED] Internet Consultant Phone: (604) 687-5804 http://www.gossamer-threads.com Fax : (604) 926-9320
Re: CGI.pm not maintaing values..
On Fri, 05 Nov 1999 14:12:43 -0500 Eugene Miretskiy [EMAIL PROTECTED] wrote: Take a look at: http://perl.apache.org/guide/obvious.html#my_scoped_variable_in_nested_s Thanks, that was just the part I was looking for. Cheers, Alex Gossamer Threads Inc. -- Alex KrohnEmail: [EMAIL PROTECTED] Internet Consultant Phone: (604) 687-5804 http://www.gossamer-threads.com Fax : (604) 926-9320