Expect And Apache
Hello there, I am wondering how to stop Expect writting to stdout its error message? Does any one have any ideas? I appreciate all your comments. -r
mod_perl And Redirection
Hello there, My apologies if you already have received this email, but I keep getting a message that the mail was not sent. We have just upgraded to : Apache/1.3.27 Ben-SSL/1.48 (Unix) PHP/4.2.3 mod_perl/1.27 configured Running perl 5.6.1. I am getting 302 error message on my redirects. This comes as a complete surprise since the same piece of code works just fine on: Apache/1.3.14 Ben-SSL/1.42 (Unix) PHP/4.0.3pl1 mod_perl/1.24_01 configured Here is my code: $r-headers_in-unset(Content-length); $r-header_out(Location = $uri); $r-status(REDIRECT); $r-send_http_header; return REDIRECT; I am not sure where to begin debugging. I first wanted to check w/ you guys to see if there are any quick fixes. I appreciate any feed back. -r
Expect and Apache
Hello there, I am wondering how to stop Expect writting to stdout its error message? Does any one have any ideas? I appreciate all your comments. -r
IPC::Open3
Hi there, I am having trouble making open3 work with perl, v5.6.1 built for i386-linux. I am running Apache/1.3.27 Ben-SSL/1.48 (Unix) PHP/4.2.3 mod_perl/1.27. My problem is that I can't write to STDIN. Does any one know of any solution to this problem? Has any one encountered the same issue? Any suggestions and help is greatly appreciated. -r
Apache::DBI and db proxies
Folks, is there any benefit in using Apache::DBI when all db calls ought to go through db proxies? Thanks in advance -r
PerlAccessHandler
Folks, My PerlAccessHandler is being executed twice per each request. Is this a normal behavior for an access handler? Here is my .conf entry Location /myHandler SetHandler perl-script # run is a wrapper for my handler # all common methods which many of my handlers # use are stored in the super class of myHandler # in which run is a part of. # Also wraps myHandler in a try {} catch { ... # block. PerlHandler myHandler-run PerlAccessHandler myAccess . . . /Location The access handler's job is to check for cookies and last login time. There are no fancy codes there... However, on every request, the handler is invoked twice. Can someone make a suggestion as to why this is happening? Thanks in advance -r
Died
Folks, I get the strangest object when I tried to print my object to log file: Died. Has anyone seen this before. This is ofcourse my container object that I use in mod_perl to save the request's response. Thanks in advance. -r
Setting Cookies
Hello folks, Yesterday I posted a question about PerlTransHandler and received a lot of responses. Thanks to all of you who replied. However, my problem persists. I try to be more precise in explaining the problem today. My login module sets a few cookies that expire 24 hrs after they are set. Upon each request the validity of the cookies is checked, and in case of an expired cookie, the user is redirected to the login page to resubmit username/password again. A request with a fully qualified URL, example: http://myserver.mydomain.com/someLocation, has no problem continuing. The cookies are set. However, in case the URL has the .domain.com stripped, the login page is regenerated indefinitely. The cookies never get set. There were a few suggestions, such as using mod_rewrite, however that is out of the question because mod_rewrite was not built with our http server. My PerlTransHandler does not seem to be able to distinguish myserver.domain.com/someLocation request with myserver/someLocation. I appreciate any suggestions on this. -r
PerlTransHandler problem
Hello folks, I am trying to implement a simple PerlTransHandler to change: http://myserver/ to http://myserver.rhythm.com/ And here is my code: package MIS::GENERAL::FixURL; use Apache::Constants qw(DECLINED); use strict; sub handler { my $r = shift; my $uri = $r-uri; return DECLINED if ($uri =~ m/^.+\.rhythm\.com$/) $uri=~ s/^(.+)/$1\.rhythm\.com/; $r-uri($uri); return DECLINED; } 1; Here is my https.conf entry: PerlTransHandler MIS::GENERAL::FixURL And here is my error when I type: s7.rhythm.com Invalid URI in request GET / HTTP/1.0 But I get no error with: http://s7/ Can some one tell me what am I doing wrong? Thanks in advance -r
Re: PerlTransHandler problem
I am realy trying to make sure that all requests for http://myserver/ are treated as http://myserver.rhythm.com/ so that my other applications that depend on reading cookies down the request chain could actually do so... -r Randal L. Schwartz wrote: Rasoul == Rasoul Hajikhani [EMAIL PROTECTED] writes: Rasoul I am trying to implement a simple PerlTransHandler to change: Rasoul http://myserver/ Rasoul to Rasoul http://myserver.rhythm.com/ Both of those are / as far as as $r-uri is concerned. What are you *really* trying to do? -- 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: PerlTransHandler problem
A funny thing is happening with my PerlTransHandler... It is not being called at all... :( I have added warn messages but they never appear in the error log. I am at a loss and hoping that some one may have an answer... -r Lyle Brooks wrote: Quoting Rasoul Hajikhani ([EMAIL PROTECTED]): Hello folks, I am trying to implement a simple PerlTransHandler to change: http://myserver/ to http://myserver.rhythm.com/ And here is my code: package MIS::GENERAL::FixURL; use Apache::Constants qw(DECLINED); use strict; sub handler { my $r = shift; my $uri = $r-uri; return DECLINED if ($uri =~ m/^.+\.rhythm\.com$/) IIRC, the $r-uri method is normally not going yield the hostname or scheme (unless this is a proxy request). So for a request to http://www.rhythm.com/test/myfile.html $r-uri is going to return only /test/myfile.html You may want to do some logging to verify. Add use Apache::Log (); then inside your handler... my $log = $r-server-log; $log-debug(Processing request . $r-uri); Hope that helps. $uri=~ s/^(.+)/$1\.rhythm\.com/; $r-uri($uri); return DECLINED; } 1; Here is my https.conf entry: PerlTransHandler MIS::GENERAL::FixURL And here is my error when I type: s7.rhythm.com Invalid URI in request GET / HTTP/1.0 But I get no error with: http://s7/ Can some one tell me what am I doing wrong? Thanks in advance -r
Re: separating C from V in MVC
I really enjoyed this topic... I hope you guys are planning on actually documenting your ideas. I would love to read and learn more about this topic. -r
pnotes notes and subprocess_env
Folks, I don't seem to be able to make pnotes, notes or subprocess_env work. I am trying to pass a value from a handler to another, and from what I have read in the Eagle, and cook book, the request ought to be the main one in order for the pnotes, ... to work. So Here is the snippet of my code: . . . $r-pnotes(STICKY = hello world); $r-custom_response(FORBIDDEN, /secureDB/Login); return FORBIDDEN; . . . package secureDB::Login; sub handler { my $r = shift; $r = ($r-is_main ? $r : $r-main); my $object = undef; my $notes = $r-pnotes(STICKY); warn notes = $notes\n; #$object-{query}= $r-args || $r-content; #$object-{path} = $r-uri(); #$object-{FILE} = secureLogin.html; #getUserInfo($object,$uid); makeTemplate($object,$r); return OK; } 1; Noe I have tried subprocess_env, notes, and pnotes, but none seem to work. I have to warn you that I can not use Apache::Request-instance() because of my Apache version. I appreciate all the help. Thanks in advance -r
mod_perl Cook Book
Folks, I got my mp cb last night and it looks like a good read. Thanks to all of you who responded and recommended the book. -r
OT: Status Page
Folks, please excuse this off topic thread, but I thought since a lot of you work in creating a informative user experience, some of you may be able to help me. I am trying to create a status page, the kind that shows a horizental status bar that looks to work in real time and changes as events happen behind the scenes. EToys had it when confirming a cc sale, or expedia has one during the search. Can some one direct me as where would I find info in creating one of those pages. are those applets? Again, accept my sincere, humble, unreserved, and advance appology. Thanks in advance -r
Apache::File
Folks, The Apache::File man pages indicate that ($name,$fh) = Apache::File-tmpfile; returns a fh ready to write to. So far so good. In case of wanting to read from it, here is what I do: # Is this necessary? $fh-close() or die Could not close $name: $!\n; $opfh-open($name); local $/= undef; $output = $opfh; warn $output\n; $opfh-close() or die Could not close $name: $!\n; But $output is empty on each request. Is there an error somewhere that I am not seeing? I appreciate all comments.responses. Thanks in advance -r
Apache::File correction
Folks, The Apache::File man pages indicate that ($name,$fh) = Apache::File-tmpfile; returns a fh ready to write to. So far so good. In case of wanting to read from it, here is what I do: # Is this necessary? $fh-close() or die Could not close $name: $!\n; $fh-open($name); local $/= undef; $output = $fh; warn $output\n; $fh-close() or die Could not close $name: $!\n; But $output is empty on each request. Is there an error somewhere that I am not seeing? I appreciate all comments.responses. Thanks in advance -r
Re: Apache::File correction
Robert Landrum wrote: At 1:44 PM -0700 4/10/02, Rasoul Hajikhani wrote: Folks, The Apache::File man pages indicate that ($name,$fh) = Apache::File-tmpfile; returns a fh ready to write to. So far so good. In case of wanting to read from it, here is what I do: # Is this necessary? $fh-close() or die Could not close $name: $!\n; $fh-open($name); local $/= undef; $output = $fh; warn $output\n; $fh-close() or die Could not close $name: $!\n; To me it appears that you have not written anything to your tmp file... Which would explain the empty $output. gpg writes to that file. Usually temp file creators open in read/write mode. So if you say something like ($name,$fh) = Apache::File-tmpfile; print $fh Hello World; seek($fh,0,0); my $line = $fh; print $line; It should print Hello World; Rob -- When I used a Mac, they laughed because I had no command prompt. When I used Linux, they laughed because I had no GUI.
mod_perl Cook Book
Hello folks, Has anyone purchased the mod_perl cook book from this list? If so, what do you think of it? Is it a good buy? Appreciate feed back. Thanks in advance -r
Open3
Folks, I have asked this question before, and received answers that have helped me in quest. However, my problem persists. So I would like to direct this question to those who have used gpg, and open3. I am having trouble writing to stdin when an apache thread calls open3. However, the same code written as a test script runs fine. I am using the --passphrase-fd 0 option which would instruct gpg to expect the passphrase from stdin rather than keyboard. As I mentioned above, the problem arises when an apache thread tries to execute my code. I know that under perl 5.6 it is necessary to untie STDIN,... (thanks Don Hayward), but I am using perl 5.005_03 built for irix ( Apache/1.3.12 Ben-SSL/1.39 (Unix) mod_perl/1.22). What is happening that I am missing? Thanks in advance -r
Open3
Hello folks, I am writing a web based interface to gpg and am using IPC::Open3 and IO::Select to manage STDIN, STDOUT and STDERR handles. But, I can not get stdin to work properly. Here is my code: $gpgCommand = gpg --homedir $home --no-default-keyring --secret-keyring rasoul.asc --decrypt $encryptedFile; print $gpgCommand\n; $pid= open3(*FIN,*FOUT,*FERR,$gpgCommand); $SIG{CHLD} = sub { print REAPER: status $? on $pid\n if waitpid($pid,0) 0 }; $selector = IO::Select-new(); $selector-add(*FOUT,*FERR); while (handles = $selector-handles) { foreach my $fh (handles) { if (fileno($fh) == fileno(FERR)) { print STDERR: , scalar FERR } elsif (fileno($fh) == fileno(FOUT)) { out= FOUT; } elsif ((fileno($fh) == fileno(FIN)) { print FIN $passPhrase\n; } $selector-remove($fh) if eof($fh); } } $pf-close; close FERR; close FIN; close FOUT; I am using perl 5.053 and Apache/1.3.14 Ben-SSL/1.42 (Unix) PHP/4.0.3pl1 mod_perl/1.24_01. Can anyone see what am I doing wrong? Thanks in advance -r
IPC::Open3 Corrected code version
Hello folks, I am writing a web based interface to gpg and am using IPC::Open3 and IO::Select to manage STDIN, STDOUT and STDERR handles. But, I can not get stdin to work properly. Here is my code: $gpgCommand = gpg --homedir $home --no-default-keyring --secret-keyring rasoul.asc --decrypt $encryptedFile; print $gpgCommand\n; $pid= open3(*FIN,*FOUT,*FERR,$gpgCommand); $SIG{CHLD} = sub { print REAPER: status $? on $pid\n if waitpid($pid,0) 0 }; $selector = IO::Select-new(); $selector-add(*FIN,*FOUT,*FERR); while (handles = $selector-handles) { foreach my $fh (handles) { if (fileno($fh) == fileno(FERR)) { print STDERR: , scalar FERR } elsif (fileno($fh) == fileno(FOUT)) { out= FOUT; } elsif ((fileno($fh) == fileno(FIN)) { print FIN $passPhrase\n; } $selector-remove($fh) if eof($fh); } } $pf-close; close FERR; close FIN; close FOUT; I am using perl 5.053 and Apache/1.3.14 Ben-SSL/1.42 (Unix) PHP/4.0.3pl1 mod_perl/1.24_01. Can anyone see what am I doing wrong? Thanks in advance -r
Re: Open3
Elizabeth Mattijsen wrote: At 01:44 PM 4/3/02 -0800, Rasoul Hajikhani wrote: Hello folks, I am writing a web based interface to gpg and am using IPC::Open3 and IO::Select to manage STDIN, STDOUT and STDERR handles. But, I can not get stdin to work properly. Here is my code: I am using perl 5.053 and Apache/1.3.14 Ben-SSL/1.42 (Unix) PHP/4.0.3pl1 mod_perl/1.24_01. Can anyone see what am I doing wrong? Make sure your IPC::Open3 is up-to-date. If it is the version that came with Perl 5.053, it probably has a bug in it. I remember having to patch it waaay back (like 5 years ago) to get it to work properly... Elizabeth Mattijsen My IPC::Open3 is OK. My problem is with IO::Select. Does anyone know whether IO::Select has any bugs? I have read the man pages and looked through the Perl Cook Book for a code snipet that would use IO::Select to write to STDIN. The one that is in the book does not work for me. So any comments/suggestions? Thanks in advance -r
open3 and mod_perl
Hello folks, I am writing a web interface for the GPGP module that would allow users to create a new public and private key and adds them to the corporate key ring. I will be useing IPC::Open3 and IO::Select to control stdin and stdout of GPGP. Are there any issues that I should be aware w/ these packages under mod_perl? Any suggestions and comments would be greatly welcomed. Thanks in advance -r
Document Caching
Hello People, Need your advise on how to cache a template under mod_perl... Any ideas? Thanks in advance -r
Re: Document Caching
Robert Landrum wrote: At 12:28 PM -0800 3/6/02, Rasoul Hajikhani wrote: Hello People, Need your advise on how to cache a template under mod_perl... Any ideas? Thanks in advance -r #startup.pl open(FILE,/path/to/tmpl); $MY::TEMPLATE .= while(FILE); close(FILE); Provided that you never change $MY::TEMPLATE, this should work fine. -- When I used a Mac, they laughed because I had no command prompt. When I used Linux, they laughed because I had no GUI. Thanks... But I use Template Toolkit to generate a dynamic file. How would the above code work in that situation?! -r
Formatted Printing
Hello folks, I have just writen an online ordering system for our company using mod_perl. The user must also be able to print the form, preserving the format. Since we use netscape (4.5) for Irix 6.5, I can't use the print button of the browser, the format is not preserved. Any one know of any modules/suggestions on this? Thanks in advance -r
IPC::ShareLite
Folks, I have created a data structure and used IPC::ShareLite to save it in the main memeory. Can someone tell me how to look at it and destroy it. Thanks -r
can not set param
Folks, The apache::Request docs indicate that param can be used to set the query string. However, it fails when I do something like this: my $r = Apache::Request-new(shift); ... my $host= $r-hostname; my $uri = $r-uri; my $params = $r-parsed_uri-query; # does not seem to work!? my $scheme = $r-parsed_uri-scheme || 'https'; $r-param('previous_uri' = $scheme://$host$uri); $r-param('q_string' = $params) if ($params); $r-header_out(Location = http://$host/login;); $r-status(REDIRECT); $r-send_http_header; return OK; Can someone tell me why this is failing? I can not get previous_uri or q_string in my login module. Also, $r-parsed_uri-scheme does not return anything back. Thanks in advance. -r
Re: can not set param
Geoffrey Young wrote: Rasoul Hajikhani wrote: Folks, The apache::Request docs indicate that param can be used to set the query string. However, it fails when I do something like this: my $r = Apache::Request-new(shift); ... my $host= $r-hostname; my $uri = $r-uri; my $params = $r-parsed_uri-query; # does not seem to work!? my $scheme = $r-parsed_uri-scheme || 'https'; $r-param('previous_uri' = $scheme://$host$uri); $r-param('q_string' = $params) if ($params); $r-header_out(Location = http://$host/login;); $r-status(REDIRECT); $r-send_http_header; return OK; Can someone tell me why this is failing? I can not get previous_uri or q_string in my login module. the way you are thinking about it is fundamentally wrong - $r is the _current_ request object, so setting $r-param sets query string arguments for the current request only. you need to look into the Apache::URI module, which can be used to create unless ($c-{userId} $c-{user}) { my $p_uri = $r-parsed_uri; my $string = previous_uri= . $r-uri . ($r-args() ? ? . $r-args() : undef); $p_uri-query($string); return FORBIDDEN; } This still fails to resolve the problem. Unless ofcourse I am not using the right method. -r properly formed URI strings. Also, $r-parsed_uri-scheme does not return anything back. it won't - to create a self-referential URI use Apache::URI-parse($r) HTH --Geoff
mod_perl installation
Folks, I get this message when running Makefile.pm: Your Perl is configured to link against libgdbm, but libgdbm.so was not found. You might need to install Perl from source I have checked the /usr/lib directory for libgdbm.so and it is not there. Here is the result of perl -V | grep libs: libs=-lgdbm -lm -lc I use SGI IRIX 6.5 Short of reinstalling perl, is there anything else that could be done? Where would I find libgdbm.so? Thanks in advance. -r
Apache.pm failed to load!.
Folks, After installing mod_perl-1.25 apache_1.3.22 I get this error message! I know this is a really serious error, but I was wondering if any one could tell me why I would get this since the installation of both mod_perl and apache went through without a problem?! -r
Re: Apache.pm failed to load!.
___cliff rayman___ wrote: first off, that looks like a spanking brand new version of apache but an older version of mod_perl. you will probaby be happier with mod_perl-1.26 what happens when you try the following from the command line? perl -MApache -e 1 Rasoul Hajikhani wrote: Folks, After installing mod_perl-1.25 apache_1.3.22 I get this error message! I know this is a really serious error, but I was wondering if any one could tell me why I would get this since the installation of both mod_perl and apache went through without a problem?! -r -- ___cliff [EMAIL PROTECTED]http://www.genwax.com/ Well don't know... I removed them both and are in the middle of reinstalling them. Will let you know asap ... -r
mod_perl failed at make test
After running make test (for the first time) here is waht I get: *** Error code 2 (bu21) mod_perl make test gives me this: (cd ../apache_1.3.22 PERL5LIB=/home/rasoul/mod_perl-1.26/lib make) === src === src/regex === src/regex === src/os/unix === src/os/unix === src/ap === src/ap === src/main === src/main === src/lib === src/lib === src/modules === src/modules/standard === src/modules/standard === src/modules/perl === src/modules/perl === src/modules cc -n32 -woff 1110,1184 -c -I. -I/usr/local/lib/perl5/5.00503/irix/CORE -I./os/unix -I./include -DIRIX -DMOD_PERL -DUSE_PERL_SSI -I/usr/lsd/include -I/usr/local/include -I/usr/apps/include -DUSE_HSREGEX -DNO_DL_NEEDED `./apaci` modules.c cc -n32 -woff 1110,1184 -c -I. -I/usr/local/lib/perl5/5.00503/irix/CORE -I./os/unix -I./include -DIRIX -DMOD_PERL -DUSE_PERL_SSI -I/usr/lsd/include -I/usr/local/include -I/usr/apps/include -DUSE_HSREGEX -DNO_DL_NEEDED `./apaci` buildmark.c cc -n32 -woff 1110,1184 -DIRIX -DMOD_PERL -DUSE_PERL_SSI -I/usr/lsd/include -I/usr/local/include -I/usr/apps/include -DUSE_HSREGEX -DNO_DL_NEEDED `./apaci`\ -o httpd buildmark.o modules.o modules/perl/libperl.a modules/standard/libstandard.a main/libmain.a ./os/unix/libos.a ap/libap.a regex/libregex.a -Wl,-rpath,/usr/local/lib/perl5/5.00503/irix/CORE -Wl,-rpath,/usr/local/informix/lib -Wl,-rpath,/usr/local/informix/lib/esql -Wl,-rpath,/usr/local/mysql/lib/mysql -n32 -L/usr/lsd/lib -L/usr/local/lib -L/usr/apps/lib -L/usr/local/informix/lib -L/usr/local/informix/lib/esql -L/usr/local/mysql/lib/mysql /usr/lsd/perl5.00503/lib/perl5/5.00503/irix/auto/DynaLoader/DynaLoader.a -L/usr/local/lib/perl5/5.00503/irix/CORE -lperl -lgdbm -lm -lc ld32: WARNING 84: /usr/lsd/lib/libgdbm.so is not used for resolving any symbol. === src/support === src/support === src cp t/conf/mod_perl_srm.conf t/conf/srm.conf ../apache_1.3.22/src/httpd -f `pwd`/t/conf/httpd.conf -X -d `pwd`/t httpd listening on port 8529 will write error_log to: t/logs/error_log letting apache warm up...done /usr/local/bin/perl5 t/TEST 0 modules/actions.ok modules/cgi.ok modules/constants...ok modules/cookie..skipping test on this platform modules/fileok modules/httpdconf...ok modules/include.ok modules/log.ok modules/module..skipping test on this platform modules/perlrun.ok modules/psections...ok modules/request.dubious Test returned status 0 (wstat 13, 0xd) modules/src.ok modules/ssi.ok modules/stage...FAILED test 1 Failed 1/2 tests, 50.00% okay modules/status..Internal Server Error dubious Test returned status 9 (wstat 2304, 0x900) DIED. FAILED tests 8-10 Failed 3/10 tests, 70.00% okay modules/symbol..ok modules/uri.ok modules/utilok internal/apiok internal/auth...ok internal/croak..ok internal/dirmagic...ok internal/error..ok internal/headersok internal/hooks..ok internal/http-get...ok internal/http-post..ok internal/proxy..ok internal/redirect...ok internal/rwrite.ok internal/stackedok internal/table..ok internal/taint..ok Failed Test Status Wstat Total Fail Failed List of failed --- modules/request 013?? ?? % ?? modules/stage.t 21 50.00% 1 modules/status. 9 2304103 30.00% 8-10 2 tests skipped. httpd terminated httpd terminated *** Error code 2 (bu21) This is the first error I have got. -r
A request's Origins
Hello folks, I am trying to find out where (which machine) a request has come from. We have several web servers running on different machines serving different documents, so it is possible to jump servers back and forth. This means that I would have to know what prev-uri was/is and what r-uri was/is. The problem is that if the request object is the original one, not a redirect or ErrorDocument handler r, the r-prev returns undef. Jumping from one server to another is not a redirect (in my case), so r-prev returns undef every time. Any ideas? Also, has any one encountered an error using MLDBM::Sync saving to an NFS mounted file? Appreciate all comments. Thanks in advance -r
Re: no_cache()
Ask Bjoern Hansen wrote: On Thu, 15 Nov 2001, Rasoul Hajikhani wrote: I am using $request_object-no_cache(1) with no success. Isn't it supported any more? Can some one shed some light on this for me... What do you mean with no success? What are you trying to do? -- ask bjoern hansen, http://ask.netcetera.dk/ !try; do(); more than a billion impressions per week, http://valueclick.com Well the cached document is returned rather than the new one. I know this because I make cosmetic changes to the document, reload it, and voila, still the old document. I have cleared the cache, set the cache size to 0, have even restarted the server at times just in case, but the result has been frantic. Sometimes the new document is shown on reloads, and at other times the old one is shown. -r
Re: no_cache()
Rob Bloodgood wrote: #set the content type $big_r-content_type('text/html'); $big_r-no_cache(1); # some more code return OK; You *are* remembering to do $r-send_http_header(); somewhere in (some more code), arent you? L8r, Rob #!/usr/bin/perl -w use Disclaimer qw/:standard/; Well then, that's what was missing :(... thanks -r
no_cache()
Hello folks, I am using $request_object-no_cache(1) with no success. Isn't it supported any more? Can some one shed some light on this for me... #set the content type $big_r-content_type('text/html'); $big_r-no_cache(1); # some more code return OK; thanks in advance. -r
Somewhat relevant
Folks, if this looks like an off topic, my apologies in advance... I have written an accessing scheme that checks for the existence of couple of cookies and if not present, the user is rerouted to a login page. So far simple stuff. The problem is that my boss is saying that it should work with a CGI script or a PHP script (legacy codes that are too many to port to mod_perl today). The basic mechanism behind my script is returning an error constant 403 in case the cookies are missing. Now, PHP, according to my boss, is very similar to a CGI script, so how does one throw an error (of any kind) that would cause Apache to generate its famous error page from a CGI program? Thanks in advance... -r
IPC::Shareable
Pardon the off topic thread, I am trying to make IPC::Shareable work with my script, however I get this error: IPC::Shareable::SharedMem: shmget: Permission denied at /usr/local/lib/perl5/site_perl/5.005/IPC/Shareable.pm line 456 [Tue Oct 16 14:44:15 2001] [error] Could not create shared memory segment: Permission denied Does any one know what's up? Here is how I am using it to set: unless (defined(%WEBACCESS) tied(%WEBACCESS)) { die Could not bind shared memory: $! unless tie %WEBACCESS, 'IPC::Shareable', 'randh_webaccess', {create =1, mode = 0666}; } tied(%WEBACCESS)-shlock; my $user= $WEBACCESS{$code}; unless ($user) { $WEBACCESS{$code} = {access_level = $status, access = $entities, time =$time}; } tied(%WEBACCESS)-shunlock; And to read it: tie %WEBACCESS, 'IPC::Shareable', 'randh_webaccess' unless (defined(%WEBACCESS) tied(%WEBACCESS)); tied(%WEBACCESS)-shlock; my $info= $WEBACCESS{$user}; tied(%WEBACCESS)-shunlock; Any help will be greatly appreciated. Thanks -r
Re: IPC::Shareable
Perrin Harkins wrote: I am trying to make IPC::Shareable work with my script, however I get this error: IPC::Shareable::SharedMem: shmget: Permission denied at /usr/local/lib/perl5/site_perl/5.005/IPC/Shareable.pm line 456 [Tue Oct 16 14:44:15 2001] [error] Could not create shared memory segment: Permission denied Does any one know what's up? In the time it takes you to debug it, you could switch your code to MLDBM::Sync and forget about all these annoying shared memory issues. It would probably be faster too. - Perrin Cool, it is really fast... and very easy to implement... Curious though, is there a delete method/operation any where? Could not find anything in the perldoc docs indicating a method like that! Any ideas?? Thanks in advance. -r
Re: ANNOUNCE: Apache::OpenIndex
George Sanderson wrote: Apache::OpenIndex (OpenIndex-1.00.tar.gz) was uploaded to CPAN on 14Sep2001 and is currently released. This was my first module. I enjoyed journey. OpenIndex provides a file manager for an Apache modperl web site using a web browser. It is a extensive rewrite of the Apache::AutoIndex module (written by Philippe M. Chiasson), which in turn was a remake of the autoindex Apache module. OpenIndex also provides the same functionality as autoindex, therefore it can be used to both manage and navigate a web site. A demo is available at: http://www.xorgate.com/Apache/OpenIndex/demo ++ | George Sanderson [EMAIL PROTECTED] | http://www.xorgate.com ++ George, I get a You don't have permission to access /Apache/OpenIndex/demo/ on this server message. -r
Setting headers
Hello, I am using template toolkit to generate dynamic content and I was wondering if there is any way to set a cookie after returning OK. Here is what I mean. 1-There are two scripts that check for access privileges of a user. One sets two cookies and the other (mine) sets three cookies. 2- My script checks for all the cookies and if it does not find the third one it should set it. But the catch is here: package some_package; # apache packages use vars qw($r); sub handler{ $r = Apache::Request-new(shift); #code here $object-{is_allowed_todo} = \is_allowed_todo; $template = Template-new(); $remplate-process($file,$object); return OK; } sub is_allowed_todo { my ($args) = shfit; # args are the arguments that I get from my .html file # [% is_allowed_todo('A HREF=' %] my $status = __PACKAGE__-SUPER::is_allowed_todo($r); if ($status) { # do this } else { # do that } } 1; # The SUPER package some_other; sub is_allowed_todo { my $r = shift; my $cookies = Apache::Cookie-new($r)-parse(); my @webaccess = $cookies-{'webaccess'} ? $cookies-{'webaccess'}-value() : (); unless ($webaccess[MIS_APPS::RHS::Constants::ONE()]); { my $user= $cookies-{'webuname'}-value(); my $job = $cookies-{'webjob'}-value(); ($code,$status,$dept) = get_userinfo($user,$job); Apache::Cookie-new( $r, -name = 'webaccess', -value = { 'department' = $dept, 'access' = $status, }, -domain = '.rhythm.com', -expires= '+24h', -path = '/' )-bake; } return $status; } But my problem is that I have already returned OK in my handler. How can I set another cookie when I have already opened the data stream to the client browser? I hope I have been clear... :) Any comments will be greatly appreciated. -r
MLDBM::Sync usage
Hi all, I am trying to use MLDBM::Sync to create persistent %hash. Has any one used this module? I was reading the archive mail between Joshua and Perrin and or do you tie/untie on every request? yes ?? Also, I would appreciate it if someone could direct me to a code snipet for this module. Thanks -r
Help with accessing system
I need some advice on implementing an accessing system. I have already implemented a few systems that now require some sort of advance accessing mechanism. I say advance because some parts of the systems that I have written are accessible by all, and some other parts should be accessible by managers, and still some other parts accessible by even fewer people. Not only that, I am also required to determine the identity of the user (not very challenging here), but to display the methods (links, buttons, ...) that the user with his/her access level can use and click on. I am hoping for some suggestions. All comments welcomed. Thanks in advance -r
mod_perl build
Hello, I am wondering whether there is a way of knowing how mod_perl was built? I have inhereted a box with mod_perl configured. Thanks -r
$r-args()
Hello, I already have asked this question and got an answer for it, so please accept my forwarded apologies. However, I was trying something else and got stuck. I know in order to pass around query string, or form data, pnotes may be used. However, I am trying something else and it does not seem to work! . . . $r = Apache::Request-new($r); # check for some condition if ($condition) { my $previous_uri= $r-param('previous_uri'); my $content = $r-param(); $r-method_number(M_GET); $r-method('GET'); $r-headers_in-unset(Content-length); $r-args($content); $r-internal_redirect($previous_uri); } . . . However, in my called handler, no Post data can be read. Can any one tell me why is that? Any comments welcomed... Thanks -r
$r-args()
Hello, I already have asked this question and got an answer for it, so please accept my forwarded apologies. However, I was trying something else and got stuck. I know in order to pass around query string, or form data, pnotes may be used. However, I am trying something else and it does not seem to work! . . . $r = Apache::Request-new($r); # check for some condition if ($condition) { my $previous_uri= $r-param('previous_uri'); my $content = $r-param(); $r-method_number(M_GET); $r-method('GET'); $r-headers_in-unset(Content-length); $r-args($content); $r-internal_redirect($previous_uri); } . . . However, in my called handler, no Post data can be read. Can any one tell me why is that? Any comments welcomed... Thanks -r
Re: $r-args()
Robert Landrum wrote: At 9:36 AM -0700 8/29/01, Rasoul Hajikhani wrote: Hello, I already have asked this question and got an answer for it, so please accept my forwarded apologies. However, I was trying something else and got stuck. I know in order to pass around query string, or form data, pnotes may be used. However, I am trying something else and it does not seem to work! $r = Apache::Request-new($r); # check for some condition if ($condition) { my $previous_uri= $r-param('previous_uri'); my $content = $r-param(); $r-method_number(M_GET); $r-method('GET'); $r-headers_in-unset(Content-length); $r-args($content); $r-internal_redirect($previous_uri); } So your goal is to turn a post request into a get request using an internal redirect. However, in my called handler, no Post data can be read. Can any one tell me why is that? Any comments welcomed... param does not work like args, and $content in this example will return the number of param keys (IIRC). I think you want my $content = join('',map{$_.=.$r-param($_)}($r-param)); Which should solve your problems (I think). I am affraid it did not work. I have no problem reading the data in the current handler, but right after redirect, which is also required to read the data, I loose all the POSTED data. Rob -- A good magician never reveals his secret; the unbelievable trick becomes simple and obvious once it is explained. So too with UNIX.
Re: $r-args()
Robert Landrum wrote: Which should solve your problems (I think). I am affraid it did not work. I have no problem reading the data in the current handler, but right after redirect, which is also required to read the data, I loose all the POSTED data. Performing a redirect causes posted data to be discarded. Did not find that in docs! maybe should pay more attention :( Your goal should be to convert ?? You lost me there... convert? convert to what? all of your posted data so that it can be passed via GET. Would it make any diference if the method, and method_number remained POST? Does this situation occure as a result of method conversion? (I will try that)... -r PS: Something wrong with the mail server? Rob -- A good magician never reveals his secret; the unbelievable trick becomes simple and obvious once it is explained. So too with UNIX.
Re: $r-args()
Robert Landrum wrote: At 11:19 AM -0700 8/29/01, Rasoul Hajikhani wrote: Robert Landrum wrote: Which should solve your problems (I think). I am affraid it did not work. I have no problem reading the data in the current handler, but right after redirect, which is also required to read the data, I loose all the POSTED data. Performing a redirect causes posted data to be discarded. Did not find that in docs! maybe should pay more attention :( I'm sure it's in the docs somewhere, but personal experience and previous posts to this list have addressed this issue. Your goal should be to convert ?? You lost me there... convert? convert to what? Convert as in from POST request to GET request. sub escaped { my $val = shift; $val =~ s/(\W)/sprintf(%%%.2X,ord($1))/g; return $val; } my $content = join('',map{$_.=.escaped($r-param($_))}($r-param)); my $internal_url = /some/path/to/handler?$content; $r-internal_redirect($internal_url); all of your posted data so that it can be passed via GET. Would it make any diference if the method, and method_number remained POST? Does this situation occure as a result of method conversion? (I will try that)... Unlikely. -r PS: Something wrong with the mail server? Uhh... Why? Rob -- A good magician never reveals his secret; the unbelievable trick becomes simple and obvious once it is explained. So too with UNIX. Thanks... It now works... -r
Re: PerlModule Error
Ken Williams wrote: [EMAIL PROTECTED] (Rasoul Hajikhani) wrote: use lib qw(...);. I have tried declaring: use MY::Perl::Control::WebAccess; in my startup.pl, with the same Here it is: Undefined subroutine My::Perl::Control::WebAccess::handler called. Looks like you need to check the capitalization on 'MY'. I chnaged the name to MIS_APPS::RHS::Control::WebAccess.pm but still get the same error. By the way, using the MY:: namespace isn't the greatest idea in the first place, because the MY:: namespace is used by MakeMaker during modules' installation process. I'm sure it's not causing a problem here, but it can at least create confusion in the mind. You are right, this did not solve the problem. -r ------ Ken Williams Last Bastion of Euclidity [EMAIL PROTECTED]The Math Forum
Re: PerlModule Error
Stas Bekman wrote: On Thu, 23 Aug 2001, Rasoul Hajikhani wrote: ___cliff rayman___ wrote: and what do the error logs say? Rasoul Hajikhani wrote: I know this question will sound primitive to most of you, however, I have this nagging error which won't go away. In my httpsd.conf, I have declared PerlModule MY::Perl::Control::WebAccess which I know is where it is supposed to be. My @INC does not include the path to that directory, however, in my startup.pl I have that directory as my use lib qw(...);. I have tried declaring: use MY::Perl::Control::WebAccess; in my startup.pl, with the same result: apache won't start. I mean what's up? I have another module sitting next to my MY::Perl::Control::WebAccess and in my startup.pl I have: use MY::Perl::Control::Cookie_Check; and all is fine and dandy... apache runs without a hitch. I tried perl5lib (all capital) in my .cshrc, again nothing. Now I come to you learned people in the hope of salvation... Any ideas people? -r -- ___cliff [EMAIL PROTECTED]http://www.genwax.com/ Here it is: Undefined subroutine My::Perl::Control::WebAccess::handler called. That's not the error that we want to see. The error you've listed can happen when you actually generate some request. But that's after Apache You are right. Apache does not even start. has started. PerlModule on the other hand merely loads the file similar to use. As you say use() doesn't work for you too. Are you sure you can perform: % perl -c MY/Perl/Control/WebAccess.pm Yes, I get WebAccess.pm syntax OK result. remove the error_log file before you start a new test and see what happens. If you still fail to find the problem. Take your code and shrink it to smallest possible size, while it still imposes a problem for you and together with the configuration section for this module send it to the list. Remember, we want a simple test that we can easily understand and reproduce the problem with. Thanks. _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://localhost/ http://eXtropia.com/ http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
push_handlers
Hi Is there any way that I could use $r-push_handlers(PerlHandler = myHandler); and send/include a query string with that? I need to push another handler with some specific form data. thanks -r
push_handlers
Hello again, The problem with push_handlers, I just realized, is that the PerlHandler argument assumes that its argument is a method, sub, within the same package/handler. However, I need some other handler to take over and finish the job. Chaining won't do since I don't know before hand which handler will step in. Any suggestions? thanks -r TOL: I am wondering if I should create a sub process?
Thanks
You guys/gals are the most helpful bunch of people I have had the pleasure of interacting with. You ROCK, all of YOU. Thanks
PerlModule Error
I know this question will sound primitive to most of you, however, I have this nagging error which won't go away. In my httpsd.conf, I have declared PerlModule MY::Perl::Control::WebAccess which I know is where it is supposed to be. My @INC does not include the path to that directory, however, in my startup.pl I have that directory as my use lib qw(...);. I have tried declaring: use MY::Perl::Control::WebAccess; in my startup.pl, with the same result: apache won't start. I mean what's up? I have another module sitting next to my MY::Perl::Control::WebAccess and in my startup.pl I have: use MY::Perl::Control::Cookie_Check; and all is fine and dandy... apache runs without a hitch. I tried perl5lib (all capital) in my .cshrc, again nothing. Now I come to you learned people in the hope of salvation... Any ideas people? -r
Re: PerlModule Error
___cliff rayman___ wrote: and what do the error logs say? Rasoul Hajikhani wrote: I know this question will sound primitive to most of you, however, I have this nagging error which won't go away. In my httpsd.conf, I have declared PerlModule MY::Perl::Control::WebAccess which I know is where it is supposed to be. My @INC does not include the path to that directory, however, in my startup.pl I have that directory as my use lib qw(...);. I have tried declaring: use MY::Perl::Control::WebAccess; in my startup.pl, with the same result: apache won't start. I mean what's up? I have another module sitting next to my MY::Perl::Control::WebAccess and in my startup.pl I have: use MY::Perl::Control::Cookie_Check; and all is fine and dandy... apache runs without a hitch. I tried perl5lib (all capital) in my .cshrc, again nothing. Now I come to you learned people in the hope of salvation... Any ideas people? -r -- ___cliff [EMAIL PROTECTED]http://www.genwax.com/ Here it is: Undefined subroutine My::Perl::Control::WebAccess::handler called. -r
Re: Problem with DBD::Oracle with mod_perl
Benjamin Trott wrote: PH Don't open a connection during startup. If you do, it will be shared when PH Apache forks, and sharing a database handle is bad for the same reasons PH sharig a file handle is. Open a connection in the child process instead. I will second this. I've done this (unintentionally) when using MySQL, and you get a lot of weird errors about statement handles being active, etc. Speaking of which, what does one do when Apache::DBI is loaded, and the parent process needs to pull some config info out of the database that all clients also use? That is, how can I force Apache::DBI to close that handle prior to the forking of children? By using the magic 6th arg ($connect_meth in the DBI::connect source) to DBI::connect. In my DB wrapper I have a connect method that internally calls DBI::connect; before doing so, it checks to see if it is being called while Apache is starting up in the parent process, and if so, it uses this special arg. my @args = (dbi:$db-{driver}:$dbname, $user, $pass, { RaiseError = 1 }); push @args, (undef, 'connect') if $Apache::Server::Starting or $Visius::httpd_conf::Loading; $self-{handle} = DBI-connect(@args); The 'connect' is that magic argument that forces DBI to use its standard connect method, rather than Apache::DBI::connect, when creating the new db handle. This means that it is essentially a use-once DB handle, and that it will not be reused by Apache::DBI. Does this help? bye, Ben I am sorry but this topic is confusing me... Are you saying that persistent DB connection objects are bad? I am about to switch to Apache::DBI for that very reason. I don't want to create a new db handle with every request. Should I stop, or am I missing something here? RFC -r
Apache::DBI
I am a bit confused! Can Apache::DBI handle db calls through proxies? -r
Out of Memory
I am getting out of memory error message in my error log. Can any one suggest a way in finding this memory leak? Thanks in advance... -r PS: it is a simple update of a record but I get: Out of memory during large request for 536875008 bytes... God help me :(
Re: Out of Memory
[EMAIL PROTECTED] wrote: Rasoul Hajikhani writes: Yes. It has three gig of ram. Is Template Toolkit memory intensive? I was told that the swap was turned off on that machine. Swap was completly turned off? That isn't good... should have a small amount of swap... You may be asking for a chunk of memory the machine doesn't have available... can you run top on the machine? -- C Wayne Huling [EMAIL PROTECTED] Yes. I can run top on that machine. This problem, out of memory error, has just come up... I am being told that the machine does not need swap space!? Is this true? -r
PerlModule
My apache server does not start up when I add PerlModule B::TerseSize to the httpsd.conf file. Or any PerlModule flag. Any one can tell me why? I am trying to determine a leakage in my script... thanks -r
Apache::Request
I get the following error on my $i = Apache::Request-instance($r); Can't locate object method instance via package Apache::Request Why is that? Is the method not available? Are the docs outdated? Any comments welcomed... :) I am running mod_perl/1.22... -r
Re: Apache::Request
I am reading the online docs... -r Robin Berjon wrote: On Wednesday 15 August 2001 22:11, Rasoul Hajikhani wrote: I get the following error on my $i = Apache::Request-instance($r); Can't locate object method instance via package Apache::Request Why is that? Is the method not available? Are the docs outdated? Any comments welcomed... :) I am running mod_perl/1.22... Are you readiong the docs that come with 1.22 or some docs online (eg from search.cpan.org) ? $r-instance works fine here, but iirc it was introduced rather recently (though I could be wrong there). -- ___ Robin Berjon [EMAIL PROTECTED] -- CTO k n o w s c a p e : // venture knowledge agency www.knowscape.com --- Machines take me by surprise with great frequency. -- Alan Turing
Re: Children dying
Jim Smith wrote: On Tue, Aug 14, 2001 at 10:48:48AM -0400, Aleksandr Vladimirskiy wrote: Hi all, I am running a perl 5.6.0, mod_perl 1.26, apache 1.3.19 on Solaris 2.6. I get the following error in my logs: [Tue Aug 14 10:45:10 2001] [notice] child pid 2630 exit signal Segmentation Fault (11) It looks like the child serves a request and immidiately dies. Does anyone have any ideas on how to figure out why this keeps happenning? What are you trying to do on the page that makes it segfault? If you are using XML::Parser in some way (with AxKit, for example) you need to make sure it and Apache are using the same expat library. Otherwise, it depends on what you are doing. --jim I also get that alot. Although, I am not using XML::Parser. I am using Template Toolkit to generate dynamic content. My Templates are plain templates. -r
mod_perl s//g
Are there any traps that I should be aware of when using s//g? I was reading the online mod_perl docs and could not find anything to that effect. But I do recall working with Perrin (correct me if I am wrong Perrin) that there were some issues with using global tag in substitutions. -r
Apache::Cookie
I must first thank all of you that helped and apologize to you... I now know why I was not able to read and write my cookies. The Domain. my module is now happy to accommodate my request after changing from http://localhost/...; to the appropriate http://mymachine.mydomain.com/...;. Thanks to you all for responding and thank god for the mod_perl archives... cheers thanks -r
Help with cookies...
Can some one tell me why I can not set a cookie... I have a module that is supposed to set a cookie called Cookie_Check: package MIS_APPS::RHS::Control::Cookie_Check; use Apache::Constants qw(:common); use Apache::Request; use Apache::Cookie (); use strict; sub handler { my $r = shift; $res= Apache::Cookie-new( $r, -name ='randh_webuname', -value = $webuname, -domain = '.rhythm.com', -expires= '+24H', -path = '/' )-bake; return OK; } 1; And after my second handler should kick in and do some other magic. In my httpd.conf I have: Location /scan SetHandler perl-script PerlHandler MIS_APPS::RHS::Control::Cookie_Check MIS_APPS::RHS::Control::Scan AuthName RHS AuthType Basic AuthUserFile /etc/passwd require valid-user /Location But I never get to set the cookie... Can someone tell me what I am doing wrong? Thanks in advance -r
Help with cookies
Can some one tell me why I can not set a cookie... I have a module that is supposed to set a cookie called Cookie_Check: package MIS_APPS::RHS::Control::Cookie_Check; use Apache::Constants qw(:common); use Apache::Request; use Apache::Cookie (); use strict; sub handler { my $r = shift; $res= Apache::Cookie-new( $r, -name ='randh_webuname', -value = $webuname, -domain = '.rhythm.com', -expires= '+24H', -path = '/' )-bake; return OK; } 1; And after my second handler should kick in and do some other magic. In my httpd.conf I have: Location /scan SetHandler perl-script PerlHandler MIS_APPS::RHS::Control::Cookie_Check MIS_APPS::RHS::Control::Scan AuthName RHS AuthType Basic AuthUserFile /etc/passwd require valid-user /Location But I never get to set the cookie... Can someone tell me what I am doing wrong? Thanks in advance -r
Cookies and Handlers
Why is setting cookies so complex in mod_perl... Can any one tell me how I can set a few cookies in one handler and hand over the operation to another handler to do some more stuff... I have tried everything that I know (that's not much) but I still can not set the cookies... here is the snippet of my cookie setter handler: my $u = Apache::Cookie-new( $r, -name = 'randh_webuname', -value = $webuname, -domain = '.rhythm.com', -expires= '+24H', -path = '/' ); $r-err_headers_out-add('Set-Cookie' = $u) if $u; some more cookies here $r-err_headers_out; return DECLINED; # tried OK with the same result } 1; At this point my second handler takes over ... . . . $r-err_headers_out; return OK; Please Help :( -r
Apache::Cookie
Hello, Is there a bug in Apache::Cookie? I am trying to set a cookie using: $webuname = Apache::Cookie-new( $r, -name = 'randh_webuname', -value =$user, -domain ='.rhythm.com', -expires ='+24h',-path ='/' ); $webuname-bake(); But the cookie never gets set? Can any one tell me what am I doing wrong? I have read the documentation for the Apache::Cookie but I can not set the cookie... Help :( Thanks in advance... -r
[Fwd: Help with @ISA]
Hello there, I have a problem and I am not sure how to explain it... So please forgive me if I sound like a rookie, since I am that. I have a packge called: my::foo in which I have declared the following: package my::foo; @my::foo::ISA = qw( my::bar ); . . . sub handler { my $r = shift; . . # rest of the code } I have a method called cookie_check in my 'my::bar' package that needs to be called before my controller or 'my::foo' takes over. package my::bar; sub cookie_check { my $self= shift; . . . # rest of the code } I have declared the following in my httpd.conf: Location /foo SetHandler perl-script PerlHandler my::foo-cookie_check() /Location However, I get an error message: Can't locate object method cookie_check() via package my::foo Can anyone tell me what am I doing wrong? Thanks in advance -r