Re: cgi-lib.pl
Hi there, Thanks everyone for the great information you have provided. I have taken everyones advice and installed CGI.pm with the cgi-lib compat mode on. I am still having an issue that is only associated with the mod_perl version of the web server? I have two variables at initial login $userid and $password that are populated via the cgi-lib readparse. Upon initial login the variable will contain the correct information. If i would hit refresh they double and keep going everytime i hit refresh? Ex: $user = joe | Refresh - $user=joejoe | Refresh - $user=joejoejoe I dont get it, i went thru my code and cleaned it up to make sure the vairable were emptied on every execution by placing: $userid = ; $password = ; before the data assignments. And still get the same effect? Anyone have a clue, is it CGI.pm or mod_perl, the same source does not do it on a non-mod_perl server. Thanks, john John == John Buwa [EMAIL PROTECTED] writes: John I have a huge system i wrote using the cgi-lib.pl as its core. I John attempted to integrate mod-perl with my system and all my John cgi-lib.pl which are used via a require in all scripts returns John errors. My dont work, if they do the act very strange and John unacceptable. John My question is how do i use cgi-lib.pl and mod-perl together? Is John anyone doing this? How can it be done. John Here is a common error in my log: John [Mon Jul 23 05:38:06 2001] [error] Undefined subroutine John Apache::ROOTwww_2emy_2ddomain_2ecom::cgi_2dbin::pads::welcome_2epl::ReadPar John se called at /driveb/usr/web/webroot/cgi-bin/pads/welcome.pl line 7. In addition to all the other things said in this thread, the reason you get this error is because cgi-lib.pl doesn't have package, so it exports to the current package. Unfortunately, if two Apache::Registry scripts both require it, then it gets defined in one package, but the require gets skipped in the other. Definitely you need something that understands import, such as CGI.pm's cgi-lib compatibility mode. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Help needed with compile
On Wednesday 25 July 2001 23:22, Bryan Coon wrote: Hi, I am trying to compile Apache with a bunch of modules and DSO. I cant find any documentation that covers all of this though. perl.apache.org/guide/ give lots of combination examples, but not all. I would like to build Apache 1.3.20 with mod_ssl, mod_perl, mod_php and DSO support, and for apache, --prefix=/apachessl. Can anyone give me either a site that has explicit instructions on how to do this? Or maybe an example? Here's what I'd extrapolate from the mod_perl installation guide: Make a working copy of plain apache (with a binary called httpd_ssl), vis: make --with-layout=MY_NEW --target=httpd_ssl --enable-module=rewrite --disable-module=userdir --enable-module=info --server-uid=foo --server-gid=bar *Note* I always add a '--show-layout' to the end, to ensure that things are installing where I want them to go! This requires you to edit the file config.layout: I added a section thus: - section of config.layout --- # My own standard layout # Based on GNU systems Layout KIZ_STD prefix:/usr/local exec_prefix: $prefix bindir:$exec_prefix/bin sbindir: $exec_prefix/sbin libexecdir:$exec_prefix/libexec mandir:$prefix/man sysconfdir:$prefix/httpd/conf datadir: $prefix/share iconsdir: $prefix/icons htdocsdir: $datadir/htdocs cgidir:$datadir/cgi-bin includedir:$prefix/include localstatedir: /var runtimedir:/var/run logfiledir:/var/local/http/log proxycachedir: /var/local/http/proxy+ /Layout - end of section You then need to make the mod_ssl mod_php stuff (with 'make', 'make test' 'make install') *note*, I've never done this, so I don't know if the test session uses a web server - if so, read the mod_perl bit first! Now make the mod_perl stuff, vis: perl Makefile.PL APACHE_SRC=../apache_1.3.20/src EVERYTHING=1 USE_APACI=1 DO_HTTPD=1 ALL_HOOKS=1 SSL_BASE='{place}' APACI_ARGS='--with-layout=MY_NEW --target=httpd_ssl --enable-module=rewrite --disable-module=userdir --enable-module=info --activate-module=src/modules/perl/libperl.a --activate-module=src/modules/phpx/libpnpx.a --server-uid=foo --server-gid=bar' (see http://www.php.net/manual/en/install.apache.php fot PHP install stuff.) To load mod_perl as a DSO, add '--module-shared=perl', so I guess that you may be able to do '--enable-shared=php' .-- again, I've never done it, so I don't know.. PS: Perl as a DSO (a) is not recommended, and (b) requires a version of perl that has been tinkered with - see the mod-perl installation guide. Hope this helps... -- --==**==-- Ian Stuart - EDINA, DataLibrary, University computing services. - A man depriving some village, somewhere, of a first-class idiot - http://lucas.ucs.ed.ac.uk/
cached value !!
hi, I have the following problem... a module/object that use a callback func..example : use Blah; my $obj = new Blah(...); ..later on ... my $firstcall = 1; sub checkSomething { if ($firstcall) {$firstcall = 0; return 0} code ... }; $$obj{checkCode} = \checkSomething; $obj-callSomemethod(); the problem is that during the invocations of the script the $firstcall sometimes stays 0, instead to be initialised to 1 on every invocation of the script any ideas how can I cure this Thanx alot in advance... = iVAN [EMAIL PROTECTED] =
Re: cached value !!
raptor wrote: hi, I have the following problem... a module/object that use a callback func..example : use Blah; my $obj = new Blah(...); ..later on ... my $firstcall = 1; sub checkSomething { if ($firstcall) {$firstcall = 0; return 0} code ... }; $$obj{checkCode} = \checkSomething; $obj-callSomemethod(); the problem is that during the invocations of the script the $firstcall sometimes stays 0, instead to be initialised to 1 on every invocation of the script any ideas how can I cure this Thanx alot in advance... = iVAN [EMAIL PROTECTED] = cf manual: http://perl.apache.org/guide/perl.html#my_Scoped_Variable_in_Nested_S -- My mother always used to tell me, The early bird gets the worm. The message seemed pretty clear to me: If you sleep late, you're a lot less likely to be killed by a bird. -- Elliott Downing
Re: cached value !!
thanx alot I also thought it has to be closure... but didn't done it in the right way... i.e. i was doing this way :) : { my $firstcall = 1; sub checkSomething { if ($firstcall) {$firstcall = 0; return 0} code ... }; } but it has to be anonymous ...:) raptor wrote: hi, I have the following problem... a module/object that use a callback func..example : use Blah; my $obj = new Blah(...); ..later on ... my $firstcall = 1; sub checkSomething { if ($firstcall) {$firstcall = 0; return 0} code ... }; $$obj{checkCode} = \checkSomething; $obj-callSomemethod(); the problem is that during the invocations of the script the $firstcall sometimes stays 0, instead to be initialised to 1 on every invocation of the script any ideas how can I cure this Thanx alot in advance... = iVAN [EMAIL PROTECTED] = cf manual: http://perl.apache.org/guide/perl.html#my_Scoped_Variable_in_Nested_S -- My mother always used to tell me, The early bird gets the worm. The message seemed pretty clear to me: If you sleep late, you're a lot less likely to be killed by a bird. -- Elliott Downing
Re: Mod_perl CGI.pm Cgi-lib
John, I suggest adding 'use strict' at the top of your script. That will help you track down 'variables that won't stay shared'. See the guide for more. http://perl.apache.org/guide/ http://thingy.kcilink.com/modperlguide/porting/An_Easy_Break_in.html hope this helps, Kenny At 03:03 AM 7/26/2001 -0500, John Buwa wrote: Hello, Some more info on the problem i described before: #!/usr/bin/perl -w use Fcntl ':flock'; # import LOCK_* constants use CGI::Apache qw(:standard); use CGI qw(:cgi-lib); require dbcfg.pl; use diagnostics; ReadParse(*input); if ($input{'new'} eq on) {add_account;} if ($input{'action'} eq something) {something;} if ($input{'action'} eq something2) {something2;} if ($input{'action'} eq something3) {something3;} snip alot of somethings else {show_menu;} sub show_menu { somecode here } sub something { some code here } sub something2 { somecode here } Now the first routing it hits is a login which grabs the userid and password as below: $user = ; $pass = ; $user = $input{'userid'}; $pass = $input{'password'}; then it validates the user and jumps to the show menu routine. From here alot of options are available if i am at the main menu and hit refresh all things are correct. But if i say click on the something2 option and goto the something2 routine all variables $user and $pass are correct. If i hit refresh it is still correct. Now if i hit the backbutton in my browser to go back to the main menu the $user and $pass vairable now gets doubled? So if your login WAS $user=$joe your information will now be $user=joejoe and NOW if you hit refresh it keeps adding $user=joejoejoejoe etc..same for the $pass and every other variable used. I hope this sheds some light on this problem as i am clueless at this point. The same code runs without these errors on a regular apache setup without mod perl it only occurs on a modperl server. Any inofmration is greatly greatly apreciated! Thanks, John Buwa
Re: Help required on compile
- Original Message - From: Randy Kobes [EMAIL PROTECTED] To: Murugan K [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, July 26, 2001 3:36 PM Subject: Re: Help required on compile On Wed, 25 Jul 2001, Murugan K wrote: Hai I am trying to build Mod-perl_1.26 on Windows NT. For that i installed perl5.6.1 and apache 1.3.19 on my windows machine ( C drive). After that (as per read me ) , i have to run the makefile.pl . But that is giving the following error. Perl makefile.pl Checking if your kit is complete... Looks good Unable to find a perl 5 (by these names: C:\Perl\5.6.1\bin\MSWin32-x86\perl.exe miniperl perl perl5 perl5.6.1, in these dirs: [ ... ] I tried posting this earlier. The problem can usually be overcome by including: 'PERL = $^X,' in the 'WriteMakefile()' section of 'Makefile.pl'. Give that a try. Cheers, Rob
Re: Help required on compile
Hai I added the'PERL = $^X,' command the in the makefile.pl . But it is not throwing any perl path error. it is creating the makefile. But when you try nmake , it is throwing the following error makefile(889)cannot have : and ::dependents for same targets. # # --- MakeMaker staticmake section: # --- MakeMaker makeaperl section --- MAP_TARGET= perl FULLPERL = c:\perl\5.6.1\bin\MSWin32-x86\perl.exe $(MAP_TARGET) :: static $(MAKE_APERL_FILE) $(MAKE) -f $(MAKE_APERL_FILE) $@ # Sisyphus [EMAIL PROTECTED] 07/26/01 05:42PM - Original Message - From: Randy Kobes [EMAIL PROTECTED] To: Murugan K [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, July 26, 2001 3:36 PM Subject: Re: Help required on compile On Wed, 25 Jul 2001, Murugan K wrote: Hai I am trying to build Mod-perl_1.26 on Windows NT. For that i installed perl5.6.1 and apache 1.3.19 on my windows machine ( C drive). After that (as per read me ) , i have to run the makefile.pl . But that is giving the following error. Perl makefile.pl Checking if your kit is complete... Looks good Unable to find a perl 5 (by these names: C:\Perl\5.6.1\bin\MSWin32-x86\perl.exe miniperl perl perl5 perl5.6.1, in these dirs: [ ... ] I tried posting this earlier. The problem can usually be overcome by including: 'PERL = $^X,' in the 'WriteMakefile()' section of 'Makefile.pl'. Give that a try. Cheers, Rob
Re: Help required on compile
- Original Message - From: Murugan K [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, July 26, 2001 10:34 PM Subject: Re: Help required on compile Hai I added the'PERL = $^X,' command the in the makefile.pl . But it is not throwing any perl path error. it is creating the makefile. - Yes - it creates the makefile, but the makefile that it creates contains errors. I doubt that you'll be able to build the module until you get rid of the 'Unable to find...' error. I've run across this problem a few times, and the remedy I posted has (until now) always worked. Still, if it's not working for you, then there must be some other cause. You *did* put it inside the 'WriteMakefile()' section ?). I did, at one stage, look a little more closely at this problem and came up with the following: 1) In 'MakeMaker.pm'at about line 192, change: HTMLLIBPODS HTMLSCRIPTPOD IMPORTS to HTMLLIBPODS HTMLSCRIPTPODS IMPORTS 2) In 'Manifest.pm'at about line 260, change: return cp if $Is_VMS; to return cp if $Is_VMS or ($^O eq 'MSWin32' and Win32::IsWin95()); I haven't verified to my satisfaction that these changes always fix the situation, but when I made those changes to a 'perl' that had the problem you describe, I found the problem went away, and I no longer had to amend the 'Makefile.pl' in the way already stated. I would expect that if you can't resolve the problem with the 'Makefile.pl' amendment, then making those changes won't help either. (Or you may find that those 'changes' are already in place.) But it's worth a try. Cheers, Rob
Apache::DBI
Does anyone know if Apache::DBI is included with mod_perl? if not could someone tell me where i could get it from?
Re: Apache::DBI
On Thu, 26 Jul 2001, Castellon, Francisco wrote: Date: Thu, 26 Jul 2001 07:48:14 -0600 From: Castellon, Francisco [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Apache::DBI Does anyone know if Apache::DBI is included with mod_perl? if not could someone tell me where i could get it from? http://cpan.org/ ky
Porting CGI scripts help needed
Hi, I have (happily) compiled and configured Apache with mod_perl, mod_ssl, mod_php and DSO. Whee! Now I am working on porting my scripts over... I have always used strict and perl -w, so for the most part, I think I can just pop my cgis in the /perl directory as Ive defined it in httpd.conf. However, I had to implement some trickery for my scripts a while ago via require/use and am having problems getting my scripts to work. Heres what I did: I had many scripts in one dir that shared many things; subroutines, global variables and modules. I wanted to clean things up, so I created a module called global.pm structured like this: --- use strict; ## Local parameters our $cgibin = http://path/cgi-bin;; our $htmldir = /apache/htdocs our $a = /some/path; our $b = /some/other/path; ## Common modules use CGI qw(:standard); use DBI; use Data::Table; ## Custom stuff require /path/to/custom/script1.pl; require /path/to/custom/script2.pl; 1; --- The custom stuff scripts all end in 1;, and are loaded with my custom subroutines. For example, I have one called cgi.pl, that contains all subs for cgi related tasks, i.e. checkUser(), which verifies a users cookie. Each cgi simply calls 'use global;' and then off we go. However, after moving all this stuff into /perl, none of the subs in the custom .pl files are found, I get a complaint: Undefined Subroutine Apache::ROOT::compar_2ecgi::checkUser called at . compare.cgi calls 'use global;' and then 'checkUser()'. What am I doing wrong with this? Any ideas? Thanks! Bryan
RE: Porting CGI scripts help needed
You might try adding use lib '/path/to/global.pm'; to you startup.pl. (Without the s of course) Good luck. --Joe Breeden -- Sent from my Outlook 2000 Wired Deskheld (www.microsoft.com) -Original Message- From: Bryan Coon [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 26, 2001 6:01 PM To: '[EMAIL PROTECTED]' Subject: Porting CGI scripts help needed Hi, I have (happily) compiled and configured Apache with mod_perl, mod_ssl, mod_php and DSO. Whee! Now I am working on porting my scripts over... I have always used strict and perl -w, so for the most part, I think I can just pop my cgis in the /perl directory as Ive defined it in httpd.conf. However, I had to implement some trickery for my scripts a while ago via require/use and am having problems getting my scripts to work. Heres what I did: I had many scripts in one dir that shared many things; subroutines, global variables and modules. I wanted to clean things up, so I created a module called global.pm structured like this: --- use strict; ## Local parameters our $cgibin = http://path/cgi-bin;; our $htmldir = /apache/htdocs our $a = /some/path; our $b = /some/other/path; ## Common modules use CGI qw(:standard); use DBI; use Data::Table; ## Custom stuff require /path/to/custom/script1.pl; require /path/to/custom/script2.pl; 1; --- The custom stuff scripts all end in 1;, and are loaded with my custom subroutines. For example, I have one called cgi.pl, that contains all subs for cgi related tasks, i.e. checkUser(), which verifies a users cookie. Each cgi simply calls 'use global;' and then off we go. However, after moving all this stuff into /perl, none of the subs in the custom .pl files are found, I get a complaint: Undefined Subroutine Apache::ROOT::compar_2ecgi::checkUser called at . compare.cgi calls 'use global;' and then 'checkUser()'. What am I doing wrong with this? Any ideas? Thanks! Bryan
note on wombat
for those of you who were at the presentation this morning and wanted more info on wombat - here are the urls: http://libservlet.sourceforge.net http://wombat.sourceforge.net i'm working really hard on getting everything pulled together so you can download and run the thing. the actual distributions aren't available yet (the links on the wombat front page are dead), but they should be by the end of the weekend (once i get back from the conference and have some time to clean up some things). i'll post a msg to the modperl and wombat lists when it's all ready. oh and, thanks again for showing up and having patience :) i just can't seem to get my shit together for these presentations.. and half an hour REALLY isn't enough time to give a good overview.
UNSUBSCRIBE?????????????
I have tried and tried and tried to get unsubscribed from this list and it does not seem to happen. Anybody have any clues about how to do this?
Re: file upload memory leak
Jack Cushman wrote: I am having a problem with very large file uploads (eg 100 MB). While the files load, the apache process stays at about 12000 K (the ps VSZ size). When the file finishes uploading, the thread suddenly jumps to over 20. My guess is that something is loading the whole file into ram, but I'm not sure what. I am running CGI.pm version 2.56, mod_perl version 1.25, and Apache version 1.3.19. Try the latest version of libapreq. perl -MCPAN -e 'install Apache::Request' should do it.
Re: UNSUBSCRIBE?????????????
turn on your mail headers. everything you need to know is in there. if you are not getting properly unsubscribed, perhaps your email address in the netscape preferences is not the same one as you subscribed as. you should be able to discern the correct e-mail address from the Return-Path header. OTR Comm wrote: I have tried and tried and tried to get unsubscribed from this list and it does not seem to happen. Anybody have any clues about how to do this? -- ___cliff [EMAIL PROTECTED]http://www.genwax.com/
Re: note on wombat
brian moseley wrote: for those of you who were at the presentation this morning and wanted more info on wombat - here are the urls: http://libservlet.sourceforge.net http://wombat.sourceforge.net Unfortunately I wasn't at the preso, but I've looked at the slides you've got up on your site. But... I don't get it :-( Where does this fit--it's all very new to me? Is it another templating engine? ;-) Is it a session manager? Is it solving some other problem that I haven't come across yet? In the preso you mention an IMAP layer. What is this, and how would it work? Would it provide an IMAP server, or is it an interface to an existing IMAP server? Sorry for the dumb questions--from the web site it all sounds intriguing, but it's gone straight over my head!
RE: Porting CGI scripts help needed
Heres what I did: I had many scripts in one dir that shared many things; subroutines, global variables and modules. I wanted to clean things up, so I created a module called global.pm structured like this: snip The custom stuff scripts all end in 1;, and are loaded with my custom subroutines. For example, I have one called cgi.pl, that contains all subs for cgi related tasks, i.e. checkUser(), which verifies a users cookie. Each cgi simply calls 'use global;' and then off we go. However, after moving all this stuff into /perl, none of the subs in the custom .pl files are found, I get a complaint: Undefined Subroutine Apache::ROOT::compar_2ecgi::checkUser called at . compare.cgi calls 'use global;' and then 'checkUser()'. global.pm isn't exporting the symbol names it's defining. if you were to refer to global::checkUser() in one of your scripts, and it worked, then mebbe an EXPORT() list for global.pm is in order so that the function names get defined in the package (Apache::ROOT::compar_2ecgi, made up by apache on the spot) that is accessing them. HTH! L8r, Rob
Problem with arrayrefs in PSections
I've come across an oddity in configuring Apache through Perl sections. If I have a local as follows, my %access = ( Order = 'deny,allow', Deny = 'from all', Allow = [['from', '1.2.3.0/24'], ['from', '192.168.1.0/24']], ); then set up locations (or directorys) as follows %Location = ( '/server-status' = { SetHandler = 'server-status', %access, }, '/server-info' = { SetHandler = 'server-info', %access, }, ); Then only one of the locations will let me access it. http://servername/server-status will let me in, http://servername/server-info won't. The problem seems to be with the shared reference: changing the 'Allow' line above to Allow = 'from all' works - though without the desired restriction of course, as does changing the code above to the following. %Location = ( '/server-status' = { SetHandler = 'server-status', %access, Allow = [['from', '1.2.3.0/24'], ['from', '192.168.1.0/24']], }, '/server-info' = { SetHandler = 'server-info', %access, Allow = [['from', '1.2.3.0/24'], ['from', '192.168.1.0/24']], }, ); Is this a bug, a stupid-user problem, or something else? I'm using Apache/1.3.20, mod_perl/1.25 and 1.26, and Perl v5.6.1 Steve -- Steve Piner Web Applications Developer Marketview Limited http://www.marketview.co.nz