Re: PerlRun problem: can't find method uri?
On Tuesday 30 April 2002 03:44 pm, you wrote: You better fix these errors, and keep 'use strict' in place. Then PerlRun should work without any problems in most cases. If after fixing those problems you still have problems, come back with your relevant questions again. It's a good idea to have your code running under 'use strict' no matter if you use mod_perl or not. This will save you a lot of grief in a long run. --- I agree with Stas that if you fix the problems with your script running under strict this will most likely go away. --- I see, thank you for the suggestion. There are so many error in the script, usually related with global variable. I change/add this in the script. global variable: use var qw($myvar $in); local variable: my $myvar; I still don't know how to change this variable: local($long, $lat, $level); [error] PerlRun: 'Global symbol $long requires explicit package name at /home/httpd/... It depends on your definition of easier. Easier==sloppier: better stay away from mod_perl. Easier==more flexible: go with mod_perl. As for the speed, I doubt you will find something *significantly* faster than mod_perl. Assuming that you learn how to get the most our of mod_perl. --- It will be much faster to fix your CGI scripts so they run under mod_perl than to re-write them in PHP or JSP. --- I see. Well, we will try to porting 1 big script to see the speed different. Any help would be great [p.s. please make sure you reply back to the list!] Ok :) Best Regards, Ricky
CGI::param,arg,content
Hello! :) I read in the mod_perl, that arg is more fast than CGI::param, but when I try to use it I can get form date only when use method GET. I try this: %param = $r-method eq 'post' ? $r-content : $r-args; But without a success. Please give me some advice. Thank you. __ Do You Yahoo!? Yahoo! Health - your guide to health and wellness http://health.yahoo.com
Re: CGI::param,arg,content
Not long ago, Konstantin Yotov proclaimed... I read in the mod_perl, that arg is more fast than CGI::param, but when I try to use it I can get form date only when use method GET. I try this: %param = $r-method eq 'post' ? $r-content : $r-args; But without a success. Please give me some advice. The $r-args method only works for GET requests. You need to use $r-content to grab the parameters passed in with the POST method. The Eagle book has a good example of a catch-all: my %params; my @args = ($r-args, $r-content); while(my($name, $value) = splice @args,0,2) { push @{$params{$name}}, $value; } The result is a hash (%params) of lists which contains all the name-value pair data. -=Fozz -- Doran L. Barton [EMAIL PROTECTED] - Chief Super Hero - Iodynamics LLC http://www.iodynamics.com/ - Linux solutions and dynamic websites Have many accidents here. -- Seen in a Tokyo traffic handbook
Re: Is ActivePerl required with a mod_perl-Apache installation
At 01:34 01.05.2002, Peter Rothermel wrote: Is there anyway to build mod_perl and Apache so that my target installation does not require ActivePerl on WinNT platforms. I'm currently doing my development on a WinNT that has ActivePerl installed and in my PATH. This is where I'm developing perl modules. When I move my installation over to a test WinNT machine without ActivePerl I get an error when Apache hits the LoadModule line for mod_perl.so. This is normal, because the mod_perl binary distribution for PPM is linked against ActivePerl. Of course, you need Perl and Apache installed for mod_perl to work. Another solution you might want to try is the self-extracting Perl-Apache-mod_perl archive. See Win32 mod_perl-1.xx at http://perl.apache.org/preview/modperl-docs/dst_html/download/binaries.html , then look at the documentation in the readmes directory that you get when you run the perl-win32-bin-x.x.exe self-extracing archive. This installation will provide you with precompiled Apache, Perl and mod_perl, which only need to be moved around slightly to work. -- Per Einar Ellefsen [EMAIL PROTECTED]
Re: PerlRun problem: can't find method uri?
At 08:51 01.05.2002, Ricky wrote: On Tuesday 30 April 2002 03:44 pm, you wrote: You better fix these errors, and keep 'use strict' in place. Then PerlRun should work without any problems in most cases. If after fixing those problems you still have problems, come back with your relevant questions again. It's a good idea to have your code running under 'use strict' no matter if you use mod_perl or not. This will save you a lot of grief in a long run. --- I agree with Stas that if you fix the problems with your script running under strict this will most likely go away. --- I see, thank you for the suggestion. There are so many error in the script, usually related with global variable. I change/add this in the script. global variable: use var qw($myvar $in); You still need to watch out for their use; even if they're declared as global and pass use strict doesn't mean they won't create the subtleties related to global variables in mod_perl. I strongly advise you to read the mod_perl Guide at http://perl.apache.org/preview/modperl-docs/dst_html/docs/1.0/guide/index.html and for your problems here the Perl Reference and CGI to mod_perl porting guidelines. local variable: my $myvar; I still don't know how to change this variable: local($long, $lat, $level); [error] PerlRun: 'Global symbol $long requires explicit package name at /home/httpd/... You should be able to declare them as my(), except if you're doing: { local $var = 'something'; subroutine(); } and then: sub subroutine { print $var; } In that case you should probably be moving to : { my $var = 'something'; subroutine($var); } sub subroutine { my $var = shift; print $var; } Which is generally better and will work the best, without surprises. Again, see the references I pointed you to above, they are really good. It depends on your definition of easier. Easier==sloppier: better stay away from mod_perl. Easier==more flexible: go with mod_perl. As for the speed, I doubt you will find something *significantly* faster than mod_perl. Assuming that you learn how to get the most our of mod_perl. --- It will be much faster to fix your CGI scripts so they run under mod_perl than to re-write them in PHP or JSP. --- I see. Well, we will try to porting 1 big script to see the speed different. Any help would be great If you want something, you have to pay for it with your time :) You won't get free speed without good coding. Anyway, we're ready to help out with any questions not answered in the Guide. -- Per Einar Ellefsen [EMAIL PROTECTED]
Re: CGI::param,arg,content
At 09:39 01.05.2002, Konstantin Yotov wrote: Hello! :) I read in the mod_perl, that arg is more fast than CGI::param, but when I try to use it I can get form date only when use method GET. I try this: %param = $r-method eq 'post' ? $r-content : $r-args; But without a success. Please give me some advice. That should be my %params = $r-method eq 'POST' ? $r-content : $r-args; (note the upper case). Anyway, you probably want to look into Apache::Request, which is a mod_perl replacement for CGI.pm (although without all the HTML generation features). -- Per Einar Ellefsen [EMAIL PROTECTED]
Re: Perl Callbacks not working
On Tue, 30 Apr 2002, Vitor wrote: use strict; use Mail::CClient qw(set_callback); set_callback (login= sub { return (login,password); } ) I don't see any reason why this shouldn't work. Acmemail (which runs fine under mod_perl) uses Mail::CClient with callbacks without problem. I think this is related with the cacching feature of mod_perl that need to be disabled for pages that uses these callbacks. What are you expecting to happen here? When Mail::CClient needs a login it will call the anonymous subroutine passed on login which will simply return the two values login and password. These need to be set to the login and password of your POP/IMAP/Whatever account. You could be getting things confused with closures here, it's reasonably easy to do. sub init { my $login,$password; set_callback (login= sub { return ($login,$password); } ) } Will not login no matter what you set $login or $password to be later as the anonymous subroutine will be bound to the particular $login and $password created in init. Hope this is helpful (and the problem isn't more serious) 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}
mod_perl 1.26 build under Cygwin fails
Hi, I have been trying to get mod_perl 1.26 to build on Cygwin. With no luck. Has anyone else been successful in this? Build options for mod_perl: perl Makefile.PL APACHE_SRC=../apache_1.3.24/src DO_HTTPD=1 USE_APACI=1 EVERYTHING=1 When running make, it fails in the apache_1.3.24/src/modules/perl/ directory (here is the output of re-running make only in that directory:) -- I-I../../os/cygwin -I../../include-DCYGWIN -DMOD_PERL -DUSE_HSREGEX -DNO_DL_NEEDED -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -I/usr/local/include `../../apaci` -c mod_perl.c I: not found make: [mod_perl.o] Error 127 (ignored) o perlxsi.c -std o: not found make: [perlxsi.c] Error 127 (ignored) I-I../../os/cygwin -I../../include-DCYGWIN -DMOD_PERL -DUSE_HSREGEX -DNO_DL_NEEDED -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -I/usr/local/include `../../apaci` -c perlxsi.c I: not found make: [perlxsi.o] Error 127 (ignored) I-I../../os/cygwin -I../../include-DCYGWIN -DMOD_PERL -DUSE_HSREGEX -DNO_DL_NEEDED -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -I/usr/local/include `../../apaci` -c perl_config.c I: not found make: [perl_config.o] Error 127 (ignored) I-I../../os/cygwin -I../../include-DCYGWIN -DMOD_PERL -DUSE_HSREGEX -DNO_DL_NEEDED -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -I/usr/local/include `../../apaci` -c perl_util.c I: not found make: [perl_util.o] Error 127 (ignored) I-I../../os/cygwin -I../../include-DCYGWIN -DMOD_PERL -DUSE_HSREGEX -DNO_DL_NEEDED -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -I/usr/local/include `../../apaci` -c perlio.c I: not found make: [perlio.o] Error 127 (ignored) I-I../../os/cygwin -I../../include-DCYGWIN -DMOD_PERL -DUSE_HSREGEX -DNO_DL_NEEDED -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -I/usr/local/include `../../apaci` -c mod_perl_opmask.c I: not found make: [mod_perl_opmask.o] Error 127 (ignored) rm -f libperl.a crv libperl.a mod_perl.o perlxsi.o perl_config.o perl_util.o perlio.o mod_perl_opmask.o crv: not found make: *** [libperl.a] Error 127 -- It seems weird to me that the Makefile is trying to call I... But I don't know more than that. A normal Apache build works fine, so that isn't the problem here. Actually, after having explored a little, I found out that the reason for this is that many make variablesa are undefined: all the PERL_ ones it seems. Running PERL_CC=gcc make actually gets me past the I: not found error, but then it complains about some Perl includes not being found (which is probably related to another variable missing; however there are so many that I won't start trying to add them all by hand). Does anyone know why these aren't included correctly? - Here is my version information: Apache 1.3.24 mod_perl 1.26 perl -V Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration: Platform: osname=cygwin, osvers=1.3.2(0.3932), archname=cygwin-multi uname='cygwin_nt-4.0 loreley 1.3.2(0.3932) 2001-05-20 23:28 i686 unknown ' config_args='-de -Dusemultiplicity' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=define useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef Compiler: cc='gcc', ccflags ='-DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -I/usr/local/include', optimize='-O2', cppflags='-DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -I/usr/local/include' ccversion='', gccversion='2.95.3-5 (cygwin special)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4 alignbytes=8, usemymalloc=y, prototype=define Linker and Libraries: ld='ld2', ldflags =' -s -L/usr/local/lib' libpth=/usr/local/lib /usr/lib /lib libs=-lgdbm -lcrypt perllibs=-lcrypt libc=/usr/lib/libc.a, so=dll, useshrplib=true, libperl=libperl5_6_1.a 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_LARGE_FILES PERL_IMPLICIT_CONTEXT Built under cygwin Compiled at Aug 22 2001 01:05:05 @INC: /usr/lib/perl5/5.6.1/cygwin-multi /usr/lib/perl5/5.6.1 /usr/lib/perl5/site_perl/5.6.1/cygwin-multi /usr/lib/perl5/site_perl/5.6.1 /usr/lib/perl5/site_perl . -- Per Einar Ellefsen [EMAIL PROTECTED]
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? I use $$.$r-uri().$connections.time where $connections is an incremental value defined before sub handler {...} and do $connections++ w/in the handler block (also realizing that you're porting CGI's and will have to get the uri elsewhere). For example: package foo; my $connections = 0; sub handler { my $r = shift ; ... ... ... my $unique_id = $$ . $r-uri() . $connections . time ; ... ... ... $connections++ ; } 1; Regards, Dave http://www.linkreminder.com
Re: [Fwd: Re: Cheap and unique]
* David Jacobs [EMAIL PROTECTED] [2002-04-30 18:31]: A global counter hanging around is a good solution, but not perfect if we deploy on multiple servers. That depends on what you initialize the global to; if you do something like the last octet of the ip of the vhost and increment it by the PID of the child each time you access it (rather than incrementing by 1), you'll get a pretty useful way of getting a useful global value. (darren) -- Your freedom to swing your fist ends at the tip of my nose. -- Larry Niven
Re: mod_perl 1.26 build under Cygwin fails
Per Einar Ellefsen wrote: I have been trying to get mod_perl 1.26 to build on Cygwin. With no luck. Has anyone else been successful in this? Build options for mod_perl: perl Makefile.PL APACHE_SRC=../apache_1.3.24/src DO_HTTPD=1 USE_APACI=1 EVERYTHING=1 Try to apply patch (attached) and then build using these options: perl Makefile.PL APACHE_SRC=../apache_1.3.24/src USE_APACI=1 EVERYTHING=1 PERL_EXTRA_CFLAGS=-DUSEIMPORTLIB DO_HTTPD=1 APACI_ARGS='--enable-rule=SHARED_CORE --enable-module=so' - Alexander Solovey mod_perl-1.26.patch Description: Binary data
Re: mod_perl 1.26 build under Cygwin fails
At 13:56 01.05.2002, Alexander Solovey wrote: Per Einar Ellefsen wrote: I have been trying to get mod_perl 1.26 to build on Cygwin. With no luck. Has anyone else been successful in this? Build options for mod_perl: perl Makefile.PL APACHE_SRC=../apache_1.3.24/src DO_HTTPD=1 USE_APACI=1 EVERYTHING=1 Try to apply patch (attached) and then build using these options: perl Makefile.PL APACHE_SRC=../apache_1.3.24/src USE_APACI=1 EVERYTHING=1 PERL_EXTRA_CFLAGS=-DUSEIMPORTLIB DO_HTTPD=1 APACI_ARGS='--enable-rule=SHARED_CORE --enable-module=so' Thanks a lot for that patch, atleast it fixed the initial problem. However, when mod_perl.config.sh is called, it reports Note (probably harmless): No library found for -lperl. Well, it is harmful :) I get tons of linking errors at compilation time (undefined references). How do I get it to find the perl library, if any? Or, how do I compile one if I have to? -- Per Einar Ellefsen [EMAIL PROTECTED]
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]
RES: Perl Callbacks not working
Mark, First, thanks for you reply. I know that Acmemail runs fine under mod_perl. I think the reason for this is that their script runs as an common CGI, and not as a cached bytecode. About you second suggestion, i just changed the values of login and password that i use. Best Regards, Vitor -Mensagem original- De: Mark Fowler [mailto:[EMAIL PROTECTED]]Em nome de Mark Fowler Enviada em: quarta-feira, 1 de maio de 2002 06:27 Para: Vitor Cc: [EMAIL PROTECTED] Assunto: Re: Perl Callbacks not working On Tue, 30 Apr 2002, Vitor wrote: use strict; use Mail::CClient qw(set_callback); set_callback (login= sub { return (login,password); } ) I don't see any reason why this shouldn't work. Acmemail (which runs fine under mod_perl) uses Mail::CClient with callbacks without problem. I think this is related with the cacching feature of mod_perl that need to be disabled for pages that uses these callbacks. What are you expecting to happen here? When Mail::CClient needs a login it will call the anonymous subroutine passed on login which will simply return the two values login and password. These need to be set to the login and password of your POP/IMAP/Whatever account. You could be getting things confused with closures here, it's reasonably easy to do. sub init { my $login,$password; set_callback (login= sub { return ($login,$password); } ) } Will not login no matter what you set $login or $password to be later as the anonymous subroutine will be bound to the particular $login and $password created in init. Hope this is helpful (and the problem isn't more serious) 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}
Fwd: mod_perl v1.99
Please send e-mail to the mod_perl list, not me :) Furthermore, there is an Apache::ASP list, which should be contacted for matters related to Apache::ASP. Date: Wed, 1 May 2002 15:15:24 GMT From: [EMAIL PROTECTED] To: Per Einar Ellefsen [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] User-Agent: XekMail Imap webMail Program II Sender: [EMAIL PROTECTED] Subject: mod_perl v1.99 I have Apache v2.0.35 for Windows 2000 up and running, and i would like to install ASP Apache v2.31 which needs mod_perl. My mod_perl is v1.99 and when i make the makefile.pl in Perl it gives me some errors: Unable to determine server version, aborting. Please specify mp_apxs or mp_ap_prefix. What is this ??? I suppose Apache::ASP doesn't work with mod_perl 2/Apache 2 yet, as these are still in beta. You should use Apache 1.3.24 and mod_perl 1.26 for now. Can anyone help me solving my problem with mod_perl ? Hope this is the right list. Thanks in advance. __ 5 de Maio, Dia da Mãe! Espreite as Sugestões do AEIOU: http://diadamae.aeiou.pt -- Per Einar Ellefsen [EMAIL PROTECTED]
Re: Memory explodes loading CSV into hash
Hi Stas, having a look at Apache::Status and playing around with your tips on http://www.apacheweek.com/features/mod_perl11 I found some interesting results and a compromising solution: In a module I load a CSV file as class data into different structures and compared the output of Apache::Status with top. Enclosed you'll find a test report. The code below 'building' shows, how the lines are put into the structures. The lines below 'perl-status' show the output of Apache::Status. The line below 'top' shows the output of top. Examples for the tested structures are: $buffer = '1\tr1v1\tr1v2\tr1v3\n2\tr2v1\tr2v2\tr2v3\n' ... @lines = ( '1\tr1v1\tr1v2\tr1v3', '2\tr2v1\tr2v2\tr2v3', ... ) %data = ( 1 = [ 1, 'r1v1' , 'r1v2' , 'r1v3' ], 2 = [ 2, 'r2v1' , 'r2v2' , 'r2v3' ], ... ) $pack = { 1 = [ 1, 'r1v1' , 'r1v2' , 'r1v3' ], 2 = [ 2, 'r2v1' , 'r2v2' , 'r2v3' ], ... } %index = ( 1 = '1\tr1v1\tr1v2\tr1v3', 2 = '2\tr2v1\tr2v2\tr2v3', ... ) One thing I realized using Devel::Peek is, that using a hash of array-ref, each item in the array has the full blown perl flags etc. That seems to be the reason for the 'memory explosion'. Another thing I found is, that Apache::Status seems not always report complete values. Therefore I recorded the sizes from top, too. Especially for the the hash of array-refs (%data) and the hash-ref of array-refs ($pack) perl-status reports only a part of the used memory size: for $pack only the pointer (16 bytes), for %data only the keys (?). As compromise I'll use the %index structure. It is small enough while providing a fast access. A further optimization will be to remove the redundant key-field from each line. Success: A reduction from 26 MB to 7 MB - what I estimated in my first mail. A last word from perldebguts.pod: || Perl is a profligate wastrel when it comes to memory use. There is a || saying that to estimate memory usage of Perl, assume a reasonable || algorithm for memory allocation, multiply that estimate by 10, and || while you still may miss the mark, at least you won't be quite so || astonished. This is not absolutely true, but may prvide a good grasp || of what happens. || || [...] || || Anecdotal estimates of source-to-compiled code bloat suggest an || eightfold increase. Perhaps my experiences could be added to the long row of anecdotes ;-)) Thank you all again for escorting me on this deep dive. Ernest -- * * VIRTUALITAS Inc. * * ** * * European Consultant Office * http://www.virtualitas.net * * Internationales Handelszentrum * contact:Ernest Lergon * * Friedrichstraße 95 *mailto:[EMAIL PROTECTED] * * 10117 Berlin / Germany * ums:+49180528132130266 * * PGP-Key http://www.virtualitas.net/Ernest_Lergon.asc TEST REPORT === CSV file: 14350 records CSV 2151045 bytes = 2101 Kbytes CSV_2 2136695 bytes = 2086 Kbytes (w/o CR) 1 all empty = building: none perl-status: *buffer{SCALAR} 25 bytes *lines{ARRAY} 56 bytes *data{HASH} 228 bytes *pack{SCALAR} 16 bytes *index{HASH} 228 bytes top: 12992 12M 12844 base 2 buffer == building: $buffer .= $_ . \n; perl-status: *buffer{SCALAR} 2151069 bytes = CSV + 24 bytes *lines{ARRAY} 56 bytes *data{HASH} 228 bytes *pack{SCALAR} 16 bytes *index{HASH} 228 bytes top: 17200 16M 17040 base + 4208 Kbytes = CSV + 2107 KBytes 3 lines = building: push @lines, $_; perl-status: *buffer{SCALAR} 25 bytes *lines{ARRAY}2519860 bytes = CSV_2 + 383165 bytes (approx. 27 * 14350 ) *data{HASH} 228 bytes *pack{SCALAR} 16 bytes *index{HASH} 228 bytes top: 18220 17M 18076 base + 5228 Kbytes = CSV_2 + 3142 Kbytes 4 data building: @record = split ( \t, $_ ); $key = 0 + $record[0]; $data{$key} = [ @record ]; perl-status: *buffer{SCALAR} 25 bytes *lines{ARRAY} 56 bytes *data{HASH} 723302 bytes = approx. 50 * 14350 ( key + ref ) (where is the data?) *pack{SCALAR} 16 bytes *index{HASH} 228 bytes top: 40488 38M 39208 base + 27566 Kbytes = CSV_2 + 25480 Kbytes
Re: mod_perl 1.26 build under Cygwin fails
Per Einar Ellefsen wrote: Try to apply patch (attached) and then build using these options: perl Makefile.PL APACHE_SRC=../apache_1.3.24/src USE_APACI=1 EVERYTHING=1 PERL_EXTRA_CFLAGS=-DUSEIMPORTLIB DO_HTTPD=1 APACI_ARGS='--enable-rule=SHARED_CORE --enable-module=so' Thanks a lot for that patch, atleast it fixed the initial problem. However, when mod_perl.config.sh is called, it reports Note (probably harmless): No library found for -lperl. Well, it is harmful :) I get tons of linking errors at compilation time (undefined references). How do I get it to find the perl library, if any? Or, how do I compile one if I have to? Oh, I forgot to tell you that one more step is required: cd /lib/perl5/5.6.1/cygwin-multi/CORE ln -s libperl5_6_1.a libperl.a mod_perl requires libperl.a to be present but cygwin doesn't provide it by default. So, here is a symbolic link and it works. - Alexander Solovey
Re: Memory explodes loading CSV into hash
Ernest Lergon wrote: having a look at Apache::Status and playing around with your tips on http://www.apacheweek.com/features/mod_perl11 I found some interesting results and a compromising solution: Glad to hear that Apache::Status was of help to you. Ideally when such a situation happens, and you must load all the data into the memory, which is at short, your best bet is to rewrite the datastorage layer in XS/C, and use a tie interface to make it transparent to your perl code. So you will still use the hash but the refs to arrays will be actually C arrays. Another thing I found is, that Apache::Status seems not always report complete values. Therefore I recorded the sizes from top, too. Were you running a single process? If you aren't Apache::Status could have shown you a different process. Also you can use GTop, if you have libgtop on your system, which gives you a perl interface to the proc's memory usage. See the guide for many examples. Success: A reduction from 26 MB to 7 MB - what I estimated in my first mail. :) __ 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: XML::LibXSLT / Apache / MOD_Perl Segfaults
The issue below could be corrected by *not* linking into the XML::LibXSLT module libexslt libraries. Even if you do not call any functions in the library, but still link in the libraries the apache process will not start. I guess I will go fire off a bug report to the libxslt guys. Thanks for your suggestions. On Tue, 30 Apr 2002, D. Hageman wrote: Yes, I have done that as well. On Tue, 30 Apr 2002, Clayton Cottingham wrote: Have you compiled apache with noexpat in the apache? -- Clayton Cottingham Air Games Wireless Inc. Suite 204, 309 W. Cordova St. Vancouver BC V6B 1E5 Canada Tel: +1.604.408.2228 Cel: +1.604.720.3510 Fax: +1.604.408.2649 Email: [EMAIL PROTECTED] Web: www.airg.com -Original Message- From: D. Hageman [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 30, 2002 2:56 PM To: Matt Sergeant Cc: D. Hageman; [EMAIL PROTECTED] Subject: Re: XML::LibXSLT / Apache / MOD_Perl Segfaults I should note then that it will also segfault if I don't attempt to preload it and just 'use' it in a module. The only difference is that the backtrace is significantly longer. :-) On Tue, 30 Apr 2002, Matt Sergeant wrote: D. Hageman wrote: I am having some issues utilizing XML::LibXSLT into a mod_perl application I am working on. The problem displays itself as a segfault on server startup. The setup I have is a standard RedHat 7.2 box with the following updated packages: apache 1.3.23 mod_perl 1.26 libxml2 2.4.21 libxslt 1.0.17 perl 5.6.1 The CPAN modules are all the latest as of today. The test is just a simple perl section with: Perl use XML::LibXSLT; /Perl It's probably something to do with the BOOT section in LibXSLT. Just don't load it that way - you're not winning much by trying to make it shared anyway (because it's mostly XS/C code, rather than perl code). Matt. -- //\\ || D. Hageman[EMAIL PROTECTED] || \\//
Re: Any known gotchas with sending cookies?
This works fine for the first access. Subsequently, I wipe out the backend database to see if a new session is correctly created. A new session is created as expected, but the problem is that the new cookie does not seem to stick to the browser. I've verified that this doesn't ... Is there any known gotchas for this type of thing? Or am I missing something? Could this be a redirection problem? One gotcha that I learned was that: my $method = ($is_redirection) ? 'err_headers_out' : 'headers_out'; $r-$method-add(Set-Cookie = $cookie-as_string); I don't know if this is similar to what I did, but here you go anyhow: sub hash_to_cookies { my ($r, $hashref) = @_; my $is_redirection = (@_) ? shift : undef; my $method = ($is_redirection) ? 'err_headers_out' : 'headers_out'; # From Apache::Cookie documentation: # $cookie-bake is same as $r-err_headers_out-add(Set-Cookie = $cookie-as_string); # Guide: You should use err_headers_out() and not headers_out() # when you want to send cookies in the REDIRECT response. my ($cookie); foreach my $key (keys %{$hashref}) { $cookie = Apache::Cookie-new( $r, -name = $key, -value = $hashref-{$key}, -path = '/'); $r-$method-add(Set-Cookie = $cookie-as_string); } } sub hash_to_cookies_OK {hash_to_cookies(@_);} sub hash_to_cookies_REDIRECT {hash_to_cookies(@_, 1);} -- Kari Nurmela, [EMAIL PROTECTED], (02) 333 8847 / (0400) 786 547
Modperl 2.0 with apache 2.0.35 on freebsd error
When I install modperl 2 on my freebsd machine and I start up the apache (well even just from the make test in the modperl directory) I get an error of: tail t/logs/error_log /usr/libexec/ld-elf.so.1: /home/source/modperl-2.0/blib/arch/Apache2/auto/ModPerl/Util/Util.so: Undefined symbol Perl_Tstack_sp_ptr any suggestions? --- Tanguy 'Ripper' de Courson - 0x7a69 Inc. myneid - fool 'o fools, gnome 'o gnomes http://www.gothcafe.com/ http://myneid.gothcafe.com/ One Part sk1LLz 2 parts Flavah!...yea i got the gravy -Digital Underground