Re: perl5.6 (was: Shared variables, inner subs and our)
Hi , Unicode is a way of pain . don't go this way . specialy in 5.7.0 were it is broken . 5.6.0 is well you know what . There is many other systems to hold multilingual apps , that not require any unicode . I use 5.7.0 in production (i386 , BSD 4.2) and it runs perfectly . Except unicode support. 5.6.0 has a lot of bugs (witch were fixed in 5.7.0) Best Cb - Original Message - From: "Jauder Ho" [EMAIL PROTECTED] To: "Bogomolnyi Constantin" [EMAIL PROTECTED] Sent: Monday, March 19, 2001 8:44 AM Subject: Re: perl5.6 (was: Shared variables, inner subs and "our") Hello there, could you detail a little more about your Unicode experience with perl? I am currently evaluating what the best verion of perl to use for a multilingual application. Thanks. --Jauder On Fri, 16 Mar 2001, Bogomolnyi Constantin wrote: Hi , You should probably try 5.7.0 witch is much more stable than 5.6.0 (you should not try unicode stuff , whitch is quite buggy) I use 5.7.0 on all my production servers without any problems . Best - Original Message - From: "Wim Kerkhoff" [EMAIL PROTECTED] To: "modperl" [EMAIL PROTECTED] Sent: Saturday, March 17, 2001 6:20 AM Subject: Re: perl5.6 (was: Shared variables, inner subs and "our") Stas Bekman wrote: our() and other perl5.6 new APIs are too early to be endorsed, as 5.6 is not yet considered as a stable version for mod_perl production sites, therefore the guide barely touches on it. Would you recommend the use of perl5.6 with mod_perl? What you are saying is making me queasy. I'm asking because I've been having bad luck with Apache::Session and some other modules in some mod_perl aware applications. Things aren't comming out the data source properly, things are hanging, things aren't locking/unlocking properly, etc. It could well be that the applications I'm working with aren't using Sessions, Tie::Cache, etc properly. I may downgrade to perl5.005 and give that a whirl... -- Regards, Wim Kerkhoff
Re: perl5.6 (was: Shared variables, inner subs and our)
Hi , You should probably try 5.7.0 witch is much more stable than 5.6.0 (you should not try unicode stuff , whitch is quite buggy) I use 5.7.0 on all my production servers without any problems . Best - Original Message - From: "Wim Kerkhoff" [EMAIL PROTECTED] To: "modperl" [EMAIL PROTECTED] Sent: Saturday, March 17, 2001 6:20 AM Subject: Re: perl5.6 (was: Shared variables, inner subs and "our") Stas Bekman wrote: our() and other perl5.6 new APIs are too early to be endorsed, as 5.6 is not yet considered as a stable version for mod_perl production sites, therefore the guide barely touches on it. Would you recommend the use of perl5.6 with mod_perl? What you are saying is making me queasy. I'm asking because I've been having bad luck with Apache::Session and some other modules in some mod_perl aware applications. Things aren't comming out the data source properly, things are hanging, things aren't locking/unlocking properly, etc. It could well be that the applications I'm working with aren't using Sessions, Tie::Cache, etc properly. I may downgrade to perl5.005 and give that a whirl... -- Regards, Wim Kerkhoff
Re: Changing REMOTE_ADDR passing to a request.
Hello , If I understand well what you want , you want to spoof the real IP adress of server A to make server B think that he is speaking to A' . Lets see the apache.pm pod : =item $c-remote_ip The dotted decimal representation of the remote client's IP address. This is set by the server when the connection record is created so is always defined. You can also set this value by providing an argument to it. This is helpful if your server is behind a squid accelerator proxy which adds a X-Forwarded-For header. 1)How this make you think that adding the X-Forwarded-For header will change the value of $c-remote_ip ? and this : =item $c-remote_addr A packed SOCKADDR_IN in the same format as returned by LSocket/pack_sockaddr_in, containing the port and address on the remote host that the server is connected to. This is set by the server when the connection record is created so it is always defined. 2) This mean that if the server B use $c-remote_addr method he will get the real ip that he is connected to , so no way to spoof it . (and if I understand well this method is used by apache to set $ENV) 3) In my way the only way to change the value of $c-remote_addr is to create an proxy server between : B--PROXYA and remove X-Forwarded-For at the proxy , so B will never know that he is speaking to A. Good luck ! Best CB - Original Message - From: "Alson Wong" [EMAIL PROTECTED] To: "barries" [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Sunday, November 12, 2000 2:09 PM Subject: Re: Changing REMOTE_ADDR passing to a request. hi, I have not use mod_proxy_add_forward before. I have download the source code and have a look at it. It seems like just passing "X-Forwarded-For" in a header of a request. I think this is same as my code here: use LWP::UserAgent; $ua = new LWP::UserAgent; my $reqq = HTTP::Request-new('GET','http://www.serverB.com/cgi-bin/ip.cgi'); $reqq-header('X-Forwarded-For'='1.2.3.4'); $reqq-header('Remote_Addr'='1.2.3.4'); # this line won't work. my $ress = $ua-request($reqq); print $ress-as_string; The $ENV{'REMOTE_ADDR'}of server B still return the real ip address of server A. So, how do I change the $ENV{'REMOTE_ADDR'}of server B to 1.2.3.4 without changing anything at server B ? If I am wrong with the mod_proxy_add_forward, please point it out. Because I have no idea how to implement the mod_proxy_add_forward in to mod_proxy of Apache. And no idea how to use it too. If you got some clue, please tell me how to start using that module, if it really works. Thanks. [EMAIL PROTECTED] - Original Message - From: barries [EMAIL PROTECTED] To: Alson Wong [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Sunday, November 12, 2000 11:34 AM Subject: Re: Changing REMOTE_ADDR passing to a request. On Sun, Nov 12, 2000 at 11:07:59AM +0800, Alson Wong wrote: So, how do I pass/set the environment variable of REMOTE_ADDR from server A ? So that I can control the env of remote_addr at the server B ? Well, you could do it several ways. The "normal" way is to set a header in the request that A sends to be, usually the same one that various caching proxy servers do, namely X-Forwarded-For. You won't be able to do that with LWP::Simple, have a look at the main LWP page for details on how to make more sophisticated requests. I'm assuming you've ruled out using Apache's mod_proxy, and therefore that you won't be wanting to use mod_proxy_add_forward. Then, in the B server, you can peel it out of the Apache request object manually as part of your script, or you can do it in an earlier handler phase and make a $r-remote_ip() call like the one you were making in the A server. To catch the header on the backend, you can have a look at the Guide: http://thingy.kcilink.com/modperlguide/scenario/Getting_the_Remote_Server_IP _in_.html my $r = shift; $r-connection-remote_ip('1.2.3.4'); it only works in server A, meaning, $ENV{'REMOTE_ADDR'} in Server A return 1.2.3.4, but $ENV {'REMOTE_ADDR'} in server B still return the Server A ip address. Right: nothing passes environment variables between the servers. You need to establish your own channel (the header mentioned above) for passing that value and tweak the B server to recover the value and stuff it in the environment variable. HTH, Barrie
Apache::Request CORE DUMPS
Hi , I have few very strange coredumps when using Apache::Request here my script : The *strange thing is that It only coredump when i put any param like www.me.com?param=value =coredump but www.me.com =works fine Any ideas ?? Thanks ! use strict;use Apache::Request;my $r=shift;my $cgi = Apache::Request-new($r);use lib "/usr/local/abc/perl/carpe";use Banner::Sql;use Banner::Html;use Banner::Config qw(valuor); my $sql = new Banner::Sql(valuor('db_name'),valuor('db_host'),valuor('db_login'),valuor('db_pwd'));$sql-DB_connect(); my $tbl_name=valuor('tbl_name');my $prog=valuor('stat_prog');eval{my $actor = $cgi-param("actor")||'';#le lien du serveur ou est stocke l'imageif($actor eq 'del_link'){afficher_liste;exit;}else{afficher_liste;exit;}};sub afficher_liste{my $html=new Banner::Html($cgi);my $start=$cgi-param('start')||'0';my $stop=$cgi-param('stop')||'25';my $limit = "LIMIT $start,$stop";my $c = $sql-sqlSelectMany('uid,lien,email',$tbl_name,1,$limit);my $nbr=$sql-getDBI('rows');my @loop_data = (); # initialize an array to hold your loopwhile(my $S = $c-fetchrow_hashref){my %row_data; $row_data{LIEN} = $S-{lien};$row_data{UID} = $S-{uid};$row_data{PROG} = $prog; push(@loop_data, \%row_data); } $c-finish;$sql-DB_disconnect;my $cnt=1;my $st;my $stp;my $nav =qq(a href="$prog"Page 1/a \n);my $j;for($j=25;$j$nbr;$j+=25){$cnt++;$st=$j;$stp=$j+25;$nav .=qq(a href="$prog?start=$startstop=$stop"Page $cnt/a \n);}$html-afficher_stat(\@loop_data,$nav);}
Re: using mod_perl with SSI-run perl scripts
Hello , mod_perl will never reduce your server load (in fact it will increase it ) and specialy SSI+Modperl will bring you realy huge httpd procs . I think that you should read http://perl.apache.org/guide/performance.html http://perl.apache.org/guide/scenario.html best Constantin - Original Message - From: "Mike Hodson" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, August 18, 2000 5:12 AM Subject: using mod_perl with SSI-run perl scripts Hello there. I am currently looking for a way to reduce the server load on a very popular website. I must admit, I am not a whiz with perl, nor was I the designer of our current system. The web content designer (I myself am a server administrator) is using a set of small perl scripts run thru the SSI !--exec CGI="/cgi-bin/banner.pl"-- method to change advertizing banners on different pages. I personally want to convert them into some sort of embperl or PHP code embedded into the pages, however the current number of pages that require these scripts number in the thousands, and I can't justify changing everything over if there is another option. I need to know if mod_perl can execute the perl scripts called by the exec cgi SSI command, and if so, instructions on how to make this work properly. Right now our server (p3-550mhz, 768 megs ram, freebsd 4.0) load average is steady around 5, and spikes to over 20 when people request the SSI enabled pages. Thanks in advance for any help on this subject. Regards, Mike Hodson
Re: Adding values to Session file
Hello , Your problem is an classic example of an incorrect implementation of tie function In fact the session acts like this : 1)You tie your hash (INDIRECTLY linket to the database) 2)You put your data in the hash but it still in memory because it is quite stupid and slow to put it directly in the database ( each time you acces the tied hash it doesn't make an SELECT from the database) So if you stop at this point you loose all your data in memory witch is normal So you need the step 3) 3) UNTIE you tied hash to ensure the syncronisation between your hash in memory and the database Under apache::registry there is an very usefull thing the register_cleanup method witch have an advantage it is executed after EACH request this is an equivalent to END block in plain cgi , this protect you against STOP ou RELOAD actions : Lets put it in shape: I suppose that you use Apache::Session module 1) eval {tie %session, 'Apache::Session::MySQL', $id, { DataSource = 'dbi:mysql:sessions',UserName = 'user',Password = 'password', LockDataSource = 'dbi:mysql:sessions', LockUserName = 'user', LockPassword = 'password'}}; #you can deal with exceptions at this point if you want #we have our hash tied 2) #lets put some data $session{data}='data'; 3) #syncronise the whole thing $r-register_cleanup( sub{ untie %session;#syncronise the session hash #put hereall close statements to your database handlers ( if you need that ) } ); - Original Message - From: Differentiated Software Solutions Pvt. Ltd To: [EMAIL PROTECTED] Sent: Friday, August 18, 2000 3:04 PM Subject: Adding values to Session file Hi, We have a site where we create a session file on login and tie some values. After a few page visits we want to add more values to the session file again using tie. We find that only the first set of values get added. Subsequent values do not get added to this file. Can somebody tell us what the problem is ?? Regards, Murali Differentiated Software Solutions Pvt. Ltd.176, Ground Floor, 6th Main,2nd Block, RT NagarBangalore - 560032Phone : 91 80 3431470www.diffs-india.com
RE: Printing under MOD_Perl
Did you think about http://perl.apache.org/guide/performance.html#Forking_and_Executing_Subproce ss I mean that if you detach an subproc witch deals with printings your main mod_perl server doesn't wait for the print Job complete . Best Constantin - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 16, 2000 12:40 PM Subject: Printing under MOD_Perl Hi all, I try to print to a local printer from an CGI script running under mod_perl. Using the open pipe function does not work. How can I manage ? (systemcall?). tnx in advance, mfs