Another newbie question: SetPerlVar
Hello, If I use SetPerlVar in my apache-perl httpd.conf by just plainly stating. SetPerlVar Foo Bar Apache-perl won't start: Syntax error on line xxx of /etc/apache-perl/httpd.conf: Invalid command 'SetPerlVar', perhaps mis-spelled or defined by a module not included in the server configuration /usr/sbin/apache-perl-ctl start: httpd could not be started What is the obvious thing I am overlooking? Regards, Walter -- Like almost everyone, I receive a lot of spam every day, much of it offering to help me get out of debt or get rich quick. It's ridiculous. (Bill Gates)
Re: Another newbie question: SetPerlVar
On Today at 6:47pm, WHvH=Walter H. van Holst [EMAIL PROTECTED]...: WHvH Hello, WHvH WHvH If I use SetPerlVar in my apache-perl httpd.conf by just plainly WHvH stating. WHvH WHvH SetPerlVar Foo Bar WHvH Try PerlSetVar instead. For 1.0 http://perl.apache.org/docs/1.0/guide/config.html#PerlSetVar_and_PerlAddVar For 2.0 http://perl.apache.org/docs/2.0/user/config/config.html#C_PerlSetVar_ -- Haroon Rafique [EMAIL PROTECTED]
Re: Another newbie question: SetPerlVar
On 17 Jul 2003 18:47:06 +0200 Walter H. van Holst [EMAIL PROTECTED] wrote: Hello, If I use SetPerlVar in my apache-perl httpd.conf by just plainly stating. SetPerlVar Foo Bar Apache-perl won't start: Syntax error on line xxx of /etc/apache-perl/httpd.conf: Invalid command 'SetPerlVar', perhaps mis-spelled or defined by a module not included in the server configuration /usr/sbin/apache-perl-ctl start: httpd could not be started What is the obvious thing I am overlooking? It's PerlSetVar not SetPerlVar. - Frank Wiles [EMAIL PROTECTED] http://frank.wiles.org -
Re: Another newbie question: SetPerlVar
On Thu, 2003-07-17 at 18:56, Frank Wiles wrote: What is the obvious thing I am overlooking? It's PerlSetVar not SetPerlVar. * Blush * Thanks. Regards, Walter -- All things that are, are with more spirit chased than enjoyed. -- Shakespeare, Merchant of Venice
Re: Newbie question about mod_perl capabilities
On Monday, Jul 7, 2003, at 20:50 Europe/London, Ged Haywood wrote: On 7 Jul 2003, Walter H. van Holst wrote: I am new to mod_perl and am trying to figure out whether it suits my needs or not. Can I use it to intercept any http CONNECT requests Apache receives and answer those? The concept of a connection is at the transport level, way below HTTP. The HTTP protocol simply assumes a reliable transport (you don't even need an Internet:) and deals with exchanges of messages. See RFC1945. Sorry Ged, Walter is talking about CONNECT which is a proxy request. It goes in place of GET or POST in the request line: CONNECT mail.openrelay.com:25 HTTP/1.1 I *think* mod_perl will be able to intercept this, but I've never tried it. You might need to do it very early on in the request, and make sure it gets passed through to mod_proxy later on or things just won't work. Matt.
Re: Newbie question about mod_perl capabilities
On Tue, 2003-07-08 at 10:14, Matt Sergeant wrote: Sorry Ged, Walter is talking about CONNECT which is a proxy request. It goes in place of GET or POST in the request line: CONNECT mail.openrelay.com:25 HTTP/1.1 I *think* mod_perl will be able to intercept this, but I've never tried it. You might need to do it very early on in the request, and make sure it gets passed through to mod_proxy later on or things just won't work. Well, thanks to a someone on IRC I have found a code snippet that might do exactly that. So it appears that mod_perl can do this. And yes, it is intended for exactly the kind of CONNECT requests you describe. Regards, Walter -- Like almost everyone, I receive a lot of spam every day, much of it offering to help me get out of debt or get rich quick. It's ridiculous. (Bill Gates)
Re: Newbie question about mod_perl capabilities
Hi there, On 8 Jul 2003, Walter H. van Holst wrote: On Tue, 2003-07-08 at 10:14, Matt Sergeant wrote: Sorry Ged, Walter is talking about CONNECT which is a proxy request. Argh. :) Well, thanks to a someone on IRC I have found a code snippet that might do exactly that. So it appears that mod_perl can do this. And yes, it is intended for exactly the kind of CONNECT requests you describe. :) 73, Ged.
Newbie question about mod_perl capabilities
Hi, I am new to mod_perl and am trying to figure out whether it suits my needs or not. Can I use it to intercept any http CONNECT requests Apache receives and answer those? Regards, Walter -- Like almost everyone, I receive a lot of spam every day, much of it offering to help me get out of debt or get rich quick. It's ridiculous. (Bill Gates)
Re: Newbie question about mod_perl capabilities
Hi there, On 7 Jul 2003, Walter H. van Holst wrote: I am new to mod_perl and am trying to figure out whether it suits my needs or not. Can I use it to intercept any http CONNECT requests Apache receives and answer those? The concept of a connection is at the transport level, way below HTTP. The HTTP protocol simply assumes a reliable transport (you don't even need an Internet:) and deals with exchanges of messages. See RFC1945. Read the Eagle Book (*), for more information about where mod_perl fits into the scheme of things. Chapter 3 has a good explanation of the Apache request cycle. 73, Ged. (*) Writing Apache Modules with Perl and C, ISBN 1-56592-567-X
Upgrading to perl 5.8.0 (newbie question)
Hi, I have a server which has the following pre-installed on it: Apache/1.3.27 mod_perl/1.27 Perl/5.6.1 If I upgrade to Perl/5.8.0 will I have to upgrade mod_perl to a newer version as well? Thanks, NG
Re: Upgrading to perl 5.8.0 (newbie question)
Hi, mod_perl 1.27 is the latest stable version of mod_perl 1. You're fine. Regards, Sven. Am Mon, 2003-02-24 um 12.24 schrieb Gazi, Nasser (London): Hi, I have a server which has the following pre-installed on it: Apache/1.3.27 mod_perl/1.27 Perl/5.6.1 If I upgrade to Perl/5.8.0 will I have to upgrade mod_perl to a newer version as well? Thanks, NG
Re: Upgrading to perl 5.8.0 (newbie question)
Hi, mod_perl 1.27 is the latest stable version of mod_perl 1. You're fine. Regards, Sven. Am Mon, 2003-02-24 um 12.24 schrieb Gazi, Nasser (London): Hi, I have a server which has the following pre-installed on it: Apache/1.3.27 mod_perl/1.27 Perl/5.6.1 If I upgrade to Perl/5.8.0 will I have to upgrade mod_perl to a newer version as well? You'll have to rebuild it after the new perl is installed though. http://perl.apache.org/docs/1.0/guide/install.html#Should_I_Rebuild_mod_perl_if_I_have_Upgraded_Perl_ dave
RE: Upgrading to perl 5.8.0 (newbie question)
Hi, mod_perl 1.27 is the latest stable version of mod_perl 1. You're fine. Regards, Sven. Am Mon, 2003-02-24 um 12.24 schrieb Gazi, Nasser (London): Hi, I have a server which has the following pre-installed on it: Apache/1.3.27 mod_perl/1.27 Perl/5.6.1 If I upgrade to Perl/5.8.0 will I have to upgrade mod_perl to a newer version as well? You'll have to rebuild it after the new perl is installed though. http://perl.apache.org/docs/1.0/guide/install.html#Should_I_Rebuild_mod_per l_if_I_have_Upgraded_Perl_ dave Thanks. I should go and read the docs! (typical newbie...)
Re: Upgrading to perl 5.8.0 (newbie question)
No, but you will need to recompile it plus lots of other modules, basically any module that includes XS code. Consider using CPAN's autobundle feature. :-) Wes Sheldahl Gazi, Nasser (London) [EMAIL PROTECTED] on 02/24/2003 06:24:32 AM To:[EMAIL PROTECTED] cc: Subject:Upgrading to perl 5.8.0 (newbie question) Hi, I have a server which has the following pre-installed on it: Apache/1.3.27 mod_perl/1.27 Perl/5.6.1 If I upgrade to Perl/5.8.0 will I have to upgrade mod_perl to a newer version as well? Thanks, NG
Re: Help installing mod_perl 1.27 and apache 1.3.27. newbie question.
On Thursday, February 20, 2003, at 08:13 AM, Charlie Smith wrote: I get errors on installing mod_perl/Apache 1.3.27, under the root account when running perl Makefile.PL. I'm running perl 5.8 on solaris. gcc 2.95. # # # perl Makefile.PL Configure mod_perl with ../apache_1.3.27/src ? [y] Shall I build httpd in ../apache_1.3.27/src for you? [y] sh: make: not found It can't find the 'make' program. You either need to install make, or, if it is isntalled, make sure it's in your $PATH. Cory 'G' Watson http://gcdb.spleck.net
RE: Help installing mod_perl 1.27 and apache 1.3.27. newbie question.
Charlie, It just seems like you need to add make in your path (sh: make: not found). Cheers, Martin Martin Scantland IP Services, Internet Engineering, Nortel Networks Phone: 613.765.4052, ESN 395.4052 -Original Message-From: Charlie Smith [mailto:[EMAIL PROTECTED]]Sent: Thursday, February 20, 2003 9:14 AMTo: [EMAIL PROTECTED]Subject: Help installing mod_perl 1.27 and apache 1.3.27. newbie question. I get errors on installing mod_perl/Apache 1.3.27, under the root account when running perl Makefile.PL. I'm running perl 5.8 on solaris. gcc 2.95. ### perl Makefile.PLConfigure mod_perl with ../apache_1.3.27/src ? [y]Shall I build httpd in ../apache_1.3.27/src for you? [y]sh: make: not foundAppending mod_perl to src/ConfigurationUsing config file: /www/Apache/src/mod_perl-1.27/src/ConfigurationCreating Makefile+ configured for Solaris 280 platform+ setting C compiler to gcc+ setting C pre-processor to gcc -E+ checking for system header files+ adding selected modules o perl_module uses ConfigStart/End + mod_perl build type: OBJ + setting up mod_perl build environment + id: mod_perl/1.27 + id: Perl/v5.8.0 (solaris) [perl] + adjusting Apache build environment + enabling Perl support for SSI (mod_include)./helpers/TestCompile: make: not found+ using builtin Expat./Configure: make: not found+ checking sizeof various data types./helpers/TestCompile: make: not found./helpers/TestCompile: make: not found./helpers/TestCompile: make: not found./helpers/TestCompile: make: not found./helpers/TestCompile: make: not found./helpers/TestCompile: make: not found./helpers/TestCompile: make: not found./helpers/TestCompile: make: not found./helpers/TestCompile: make: not found+ doing sanity check on compiler and options./helpers/TestCompile: make: not found** A test compilation with your Makefile configuration** failed. The below error output from the compilation** test will give you an idea what is failing. Note that** Apache requires an ANSI C Compiler, such as gcc. Error Output for sanity check ./helpers/TestCompile: make: not found= End of Error Report = Aborting!PerlDispatchHandler.disabled (enable with PERL_DISPATCH=1)PerlChildInitHandlerenabledPerlChildExitHandlerenabledPerlPostReadRequestHandler..disabled (enable with PERL_POST_READ_REQUEST=1)PerlTransHandlerdisabled (enable with PERL_TRANS=1)PerlHeaderParserHandler.disabled (enable with PERL_HEADER_PARSER=1)PerlAccessHandler...disabled (enable with PERL_ACCESS=1)PerlAuthenHandler...disabled (enable with PERL_AUTHEN=1)PerlAuthzHandlerdisabled (enable with PERL_AUTHZ=1)PerlTypeHandler.disabled (enable with PERL_TYPE=1)PerlFixupHandlerdisabled (enable with PERL_FIXUP=1)PerlHandler.enabledPerlLogHandler..disabled (enable with PERL_LOG=1)PerlInitHandler.disabled (enable with PERL_INIT=1)PerlCleanupHandler..disabled (enable with PERL_CLEANUP=1)PerlRestartHandler..disabled (enable with PERL_RESTART=1)PerlStackedHandlers.disabled (enable with PERL_STACKED_HANDLERS=1)PerlMethodHandlers..disabled (enable with PERL_METHOD_HANDLERS=1)PerlDirectiveHandlers...disabled (enable with PERL_DIRECTIVE_HANDLERS=1)PerlTableApidisabled (enable with PERL_TABLE_API=1)PerlLogApi..disabled (enable with PERL_LOG_API=1)PerlUriApi..disabled (enable with PERL_URI_API=1)PerlUtilApi.disabled (enable with PERL_UTIL_API=1)PerlFileApi.disabled (enable with PERL_FILE_API=1)PerlConnectionApi...enabledPerlServerApi...enabledPerlSectionsdisabled (enable with PERL_SECTIONS=1) PerlSSI.disabled (enable with PERL_SSI=1) Will run tests as User: 'nobody' Group: 'other'Checking CGI.pm VERSION..okChecking for LWP::UserAgent..okChecking for HTML::HeadParserokWriting Makefile for ApacheWriting Makefile for Apache::ConnectionWriting Makefile for Apache::ConstantsWriting Makefile for Apache::FileWriting Makefile for Apache::LeakWriting Makefile for Apache::LogWriting Makefile for Apache::ModuleConfigWriting Makefile for Apache::PerlRunXSWriting Makefile for Apache::ServerWriting Makefile for Apache::SymbolWriting Makefile for Apache::TableWriting Makefile for Apache::URIWriting Makefile for Apache::UtilWriting Makefile for mod_perl# --This message may contain confidential information, and is intended only for the use of the individual(s) to whom it is addressed.==
What is lastest stable version of mod_perl? newbie question.
What's the latest stable version of mod_perl? I believe the latest stable version of Apache is 1.3.19, which is what I am running. I am at mod_perl version 1.25. As I understand it, I need to recompile mod_perl with Apache 1.3.19 and perl 5.8 on sun box in order to get perl 5.8 (hitting an Oracle 9.0.1 database) working with the mod_perl scripts. Charlie 2/10/03 -- This message may contain confidential information, and is intended only for the use of the individual(s) to whom it is addressed. ==
Re: What is lastest stable version of mod_perl? newbie question.
On Mon, 10 Feb 2003, Charlie Smith wrote: What's the latest stable version of mod_perl? Always available at http://perl.apache.org/download I believe the latest stable version of Apache is 1.3.19, which is what I am running. No, the latest stable Apache version is 2.0.44. However, you should probably get the stable 1.x version, 1.3.27, since mod_perl 2.x is not really stable yet. See http://httpd.apache.org I am at mod_perl version 1.25. As I understand it, I need to recompile mod_perl with Apache 1.3.19 and perl 5.8 on sun box in order to get perl 5.8 (hitting an Oracle 9.0.1 database) working with the mod_perl scripts. PLEASE spend some time at http://perl.apache.org perusing the VERY comprehensive and clear documentation. I am not aware that you _need_ perl 5.8 to compile the latest apache and mod_perl, but you might as well get it now since you are upgrading those packages too. perl 5.6.1 eould also be fine; perl 5.6.0 has problems. HTH, - nick Nick Tonkin {|8^)
Re: What is lastest stable version of mod_perl? newbie question.
Nick Tonkin wrote: [...] I am not aware that you _need_ perl 5.8 to compile the latest apache and mod_perl... You need 5.8 only to work with threaded mpm (Apache 2.0) and mod_perl 1.99_08. http://perl.apache.org/docs/2.0/user/install/install.html#Prerequisites __ 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
Stupid newbie question: where is .?
So, I'm using mod_perl as installed via RPMS on RedHat 8.0, and can't believe that an hour of hunting hasn't netted an answer to this apparently simple problem. Perl scripts seem not to have . set to ~user/public_html, as use() and require() fail on files which are in the same directory as the CGI script. What have I missed? The error message states that . is in @INC. To be specific, I've enabled mod_perl for ~user's files like this: Directory /home/user/public_html Options +Includes +ExecCGI AddHandler perl-script .pl PerlHandler ModPerl::Registry::handler PerlOptions +ParseHeaders /Directory -- Stephen Walton, Professor, Dept. of Physics Astronomy, Cal State Northridge [EMAIL PROTECTED]
Re: Stupid newbie question: where is .?
Stephen Walton wrote: Please state [mp2] or something in the subject or at least in the message so we don't have to guess what version you are talking about. So, I'm using mod_perl as installed via RPMS on RedHat 8.0, and can't believe that an hour of hunting hasn't netted an answer to this apparently simple problem. Perl scripts seem not to have . set to ~user/public_html, as use() and require() fail on files which are in the same directory as the CGI script. What have I missed? The error message states that . is in @INC. To be specific, I've enabled mod_perl for ~user's files like this: Directory /home/user/public_html Options +Includes +ExecCGI AddHandler perl-script .pl PerlHandler ModPerl::Registry::handler PerlOptions +ParseHeaders /Directory Yes, ModPerl::Registry does *not* chdir to the script's dir in 2.0. Here is why: http://perl.apache.org/docs/2.0/user/coding/coding.html#Threads_Coding_Issues_under_mod_perl Various workarounds were discussed, but none were implemented so far. By the time mod_perl 2.0 is released we should sort it out. For now use mod_perl 1.0 if that's an issue to you. Of course you are more than welcome to sort this problem out and submit a patch for 2.0. __ 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
Silly Newbie Question: cookies and such
Unfortunatly, I find myself with a silly newbie question: I need to make an Apache module (not a Registry script) which will: 1. Check for a cookie, and if not there, pushhandler to a module for logging in (keeping the original request at hand for use after they succeed in logging in). 2. Extract data from the cookie (encrypted for security?) 3. Based on data from both the query string ($r-args?) and from data in the cookie, pushhandler to another module. I have looked at Apache::AuthCookie - it didn't seem to make much sense to me. Apache::Session looks promising, but the instructions don't say how to set up the mysql tables, etc. My worst problem is that I haven't had occasion to deal with cookies much (setting, checking,etc.) in the past and I know this is hampering my understanding. Can anyone give me a general overview (use this module, this way, etc.)? I'm not totally new to Apache Modules, but my experience is gleaned from writing modules already pushed into the handler stack by PerlTransHandlers written by someone else. I don't want to use PerlTransHandler, just PerlHandler, so I can use Location in perl.conf. In conclusion: I'm making a system/site where no .html files even exist. I need to handle security via a mysql db, and to push handlers based on a part of the url and a piece of the cookie which identifies the user as either a teacher, student, or parent (oops... I gave it away ;-) Jonathon Robison
Re: Silly Newbie Question: cookies and such
On Tue, 13 Nov 2001 04:28, you wrote: I need to make an Apache module (not a Registry script) which will: 1. Check for a cookie, and if not there, pushhandler to a module for logging in (keeping the original request at hand for use after they succeed in logging in). 2. Extract data from the cookie (encrypted for security?) 3. Based on data from both the query string ($r-args?) and from data in the cookie, pushhandler to another module. I have looked at Apache::AuthCookie - it didn't seem to make much sense to me. Apache::Session looks promising, but the instructions don't say how to set up the mysql tables, etc. My worst problem is that I haven't had occasion to deal with cookies much (setting, checking,etc.) in the past and I know this is hampering my understanding. You should definately be using Auth::Cookie for this. I would give the docs another read. It took me a couple of tries to get it working successfully, but I have implemented it in about 4 or 5 applications, and it works flawlessly. With Auth::Cookie it will handle the cookies for you, it will do the redirection to your login page for you, and it can handle logouts as well (by expiring the cookie). As for Apache::Session, it is really just a keyed data store with expiry times. You give it some data, and it gives you a key. If you come back later and give it the same key, it gives you back your data. A lot of people use Auth::Cookie and Apache::Session together to build a session management system, but I prefer just using a ticket based system with Auth::Cookie alone (See the Eagle book on how to do ticket based authentication). I have included a sample Auth::Cookie implementation that might give you some ideas. It is not complete, but it might get you going (I have stripped out some of the irrelevant code, so it probably won't work out of the box). Also you will have to provide your own login.pl and logout.pl scripts (I would use the examples that come with Auth::Cookie until you get a working system, then you can look at building your own. In conclusion: I'm making a system/site where no .html files even exist. I need to handle security via a mysql db, and to push handlers based on a part of the url and a piece of the cookie which identifies the user as either a teacher, student, or parent (oops... I gave it away ;-) After Auth::Cookie has finished it's phase, it will set the REMOTE_USER environment variable to the user that logged in. You could just as easily set this to 'teacher' or whatever. Then your content handler can look at this variable and decide what to do. HTH Cees package My::Auth::AuthCookie; require 5.000; use strict; use Apache::AuthCookie; use My::Crypt; @My::Auth::AuthCookie::ISA = qw(Apache::AuthCookie); # ## # There are far more secure ways of handling the passphrase then keeping it in # the actual code, but this is by far the easiest... sub SECRET () { 'No one will ever guess this passphrase :)'; } my $CRYPTER ||= new My::Crypt; # This utility just uses the Crypt::CBC and # Storable modules to encrypt and decrypt perl # data structures. It also does an MD5 checksum sub authen_cred ($$\@) { my $self = shift; my $r = shift; my @creds = @_; # # get the entered details # my $email= $creds[0]; my $password = $creds[1]; # # ensure that the user is valid and authorized... # right now it accepts any email and password combo, # so obviously you would check this in a database or # something # if ($email $password) { return $self-makeTicket($r, $email); } else { return; } } sub authen_ses_key ($$$) { my $self = shift; my $r = shift; my $ticket = shift; # # verify the ticket (to make sure no-one has tampered with it and it hasn't expired etc...) # my ($result, $message) = $self-verifyTicket($r, $ticket); # # Check the result and act appropriately... # if (!$result) { # $r-log-error(Browser returned bad cookie ($message)); return undef; } else { # # Make and set a new cookie (so that the 'time' in the cookie is updated and expires # works as expected - since last access etc...) # my $new_ticket = $self-makeTicket($r, $message); $self-send_cookie($new_ticket); # # Return the 'message/string' which will be set in the environment # under REMOTE_USER (aka.. $ENV{REMOTE_USER}). In our case that is # the users email
Newbie question
Sorry if this is in an FAQ somehere (googled for it, but no luck). Does anyone know of a *good* guide to compiling/configuring/installing Apache + mod_perl on a Windows NT system? The impression I get from scouting newsgrops is that most people resort to using a prebuild binary - so I figure it must be tricky? Jason
RE: Newbie question
Yes, Go to Ron Savages site. He has a binary build of Apache + mod_perl and also the latest perl. http://www.savage.net.au go to the navigation and press on Perl, and look under Perl Modules and look three bullet items down ... It is there. Follow along. I have used it twice and it gets you operational in about an hour. Yell if you have any questions, as I have done this twice on NT. Scott -Original Message- From: Randy Kobes [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 12, 2001 10:20 AM To: Jason Cc: [EMAIL PROTECTED] Subject: Re: Newbie question On Thu, 12 Jul 2001, Jason wrote: Sorry if this is in an FAQ somehere (googled for it, but no luck). Does anyone know of a *good* guide to compiling/configuring/installing Apache + mod_perl on a Windows NT system? INSTALL.win32 in the mod_perl sources describes how to build and install mod_perl - this is geared towards using VC++. As for configuring, if you have Apache set up already, the configuration and use is very similar to Unix - see http://take23.org/ and http://perl.apache.org/, especially the guide, for lots more info on that. There's a sample Win32 httpd.conf at http://theoryx5.uwinnipeg.ca/ppmpackages/httpd.conf-perl that contains a number of common directives used for mod_perl related things. The impression I get from scouting newsgrops is that most people resort to using a prebuild binary - so I figure it must be tricky? No, not really - the build process differs from Unix, but after that, and taking into account the differences in general with Perl/Apache on Win32, it's relatively straightforward to use. best regards, randy kobes
Re: [NQ] Newbie Question about mod_perl
"Differentiated Software Solutions Pvt. Ltd.," wrote: I have written two mod_perl programs whose output is same (through browser). I want to know what are the difference between them! If there is any difference then what are the pros and cons in using both of them? The second program is taking advantage of the PerlSendHeader feature. This is mostly a compatibility feature, I would tend to think that it might be slightly slower (because mod_perl has to watch for the empty line). The first program should be a very small amount faster, as far as I know, but the second has a partial advantage of portability to non-mod_perl regular CGI environment. I say "partial", because you test for $ENV{MOD_PERL}, which you don't need to do. -- "The number of Unix installations has grown to 10, with more expected." -- The Unix Programmer's Manual, 2nd Edition, June 1972
[NQ] Newbie Question about mod_perl
Hi, Now Iam doing mod_perl programing And I have gone through the related documents also. I have written two mod_perl programs whose output is same (through browser). I want to know what are the difference between them! If there is any difference then what are the pros and cons in using both of them? one.cgi if(exists $ENV{MOD_PERL}) { my $r = Apache-request; $r-content_type("text/html"); $r-send_http_header; $r-print("Hi There!");} two.cgi if(exists $ENV{MOD_PERL}) { print "Content-Type: text/html\n\n"; print "Hi There!";} Thanks, Muthu S Ganesh P.S. [NQ] - Newbie Question Differentiated Software Solutions Pvt. Ltd.,90, 3rd Cross,2nd Main, Ganga Nagar,Bangalore - 560 032Phone : 91 80 3631445Visit us at www.diffsoft.com
Newbie question about AuthCookieDBI
Hi all, I am a newbie user of mod_perl trying to work with Apache::AuthCookieDBI and have been running into several obstacles. I'm hoping someone can point me in the right direction. I just installed Apache::AuthCookie successfully and was able to get it to work with the necessary changes in my httpd.conf file. Now I want to use Apache::AuthCookieDBI to authenticate against a database table. However during my installation, while doing the 'make test' I get the following error message --- Can't locate object method "module" via package "Apache" at /usr/local/lib/perl5/site_perl/5.6.0/Apache/DBI.pm line 202. Compilation failed in require at blib/lib/Apache/AuthCookieDBI.pm line 41. BEGIN failed--compilation aborted at blib/lib/Apache/AuthCookieDBI.pm line 41. Compilation failed in require at test.pl line 11. BEGIN failed--compilation aborted at test.pl line 11. make: *** [test_dynamic] Error 255 When I do a 'make install' after this, it appears to install correctly. However I run into trouble when I try to modify my httpd.conf file to use Apache::AuthCookieDBI. When I add the line --- PerlModule Apache::AuthCookieDBI to my httpd.conf file and restart the server, the server returns a message that it has restarted successfully, but in fact doesn't actually start. There are no error messages on my screen or in the error log that indicate anything being wrong but the server is simply not running. In addition to the above PerlModule line, I've also included the following in my httpd.conf file with the appropriate values --- PerlSetVar WhatEverPath / PerlSetVar WhatEverLoginScript /login.pl # These must be set PerlSetVar WhatEverDBI_DSN "DBI:mysql:database=test" PerlSetVar WhatEverDBI_SecretKeyFile /etc/httpd/foo.com.key # These are optional, the module sets sensible defaults. PerlSetVar WhatEverDBI_User "mysql" PerlSetVar WhatEverDBI_Password "mypassword" PerlSetVar WhatEverDBI_UsersTable "users" PerlSetVar WhatEverDBI_UserField "username" PerlSetVar WhatEverDBI_PasswordField "password" PerlSetVar WhatEverDBI_CryptType "none" PerlSetVar WhatEverDBI_GroupsTable "groups" PerlSetVar WhatEverDBI_GroupField "grp" PerlSetVar WhatEverDBI_GroupUserField "user" PerlSetVar WhatEverDBI_EncryptionType "none" PerlSetVar WhatEverDBI_SessionLifetime 00-24-00-00 Directory /foo/protected AuthType Apache::AuthCookieDBI AuthName WhatEver PerlAuthenHandler Apache::AuthCookieDBI-authenticate PerlAuthzHandler Apache::AuthCookieDBI-authorize require valid-user /Directory Files LOGIN AuthType Apache::AuthCookieDBI AuthName WhatEver SetHandler perl-script PerlHandler Apache::AuthCookieDBI-login /Files The above directory and files locations are unchanged from when I got AuthCookie/AuthCookieHandler to work, except that I change the references from AuthCookieHandler to AuthCookieDBI. Also, the file /etc/httpd/foo.com.key exists, contains a long text string in the first line and is readable only by root. The problematic line in the httpd.conf file seems to be the PerlModule Apache::AuthCookieDBI line. If I comment it out, the server starts up with no problems whatsoever. Of course I need to use AuthCookieDBI, hence the issue.. Can someone possibly shed some light on this? Its completely baffling me and the lack of error messages in both the error log and on screen is only compounding the problem. If it helps, I am running Apache 1.3.14, mod_perl 1.25 and using Apache-AuthCookieDBI-1.18 and Apache-AuthCookie-2.011. Thanks a ton in advance for your help! Renu
Newbie question about AuthCookieDBI
Hi all, I am a newbie user of mod_perl trying to work with Apache::AuthCookieDBI and have been running into several obstacles. I'm hoping someone can point me in the right direction. I just installed Apache::AuthCookie successfully and was able to get it to work with the necessary changes in my httpd.conf file. Now I want to use Apache::AuthCookieDBI to authenticate against a database table. However during my installation, while doing the 'make test' I get the following error message --- Can't locate object method "module" via package "Apache" at /usr/local/lib/perl5/site_perl/5.6.0/Apache/DBI.pm line 202. Compilation failed in require at blib/lib/Apache/AuthCookieDBI.pm line 41. BEGIN failed--compilation aborted at blib/lib/Apache/AuthCookieDBI.pm line 41. Compilation failed in require at test.pl line 11. BEGIN failed--compilation aborted at test.pl line 11. make: *** [test_dynamic] Error 255 When I do a 'make install' after this, it appears to install correctly. However I run into trouble when I try to modify my httpd.conf file to use Apache::AuthCookieDBI. When I add the line --- PerlModule Apache::AuthCookieDBI to my httpd.conf file and restart the server, the server returns a message that it has restarted successfully, but in fact doesn't actually start. There are no error messages on my screen or in the error log that indicate anything being wrong but the server is simply not running. In addition to the above PerlModule line, I've also included the following in my httpd.conf file with the appropriate values --- PerlSetVar WhatEverPath / PerlSetVar WhatEverLoginScript /login.pl # These must be set PerlSetVar WhatEverDBI_DSN "DBI:mysql:database=test" PerlSetVar WhatEverDBI_SecretKeyFile /etc/httpd/foo.com.key # These are optional, the module sets sensible defaults. PerlSetVar WhatEverDBI_User "mysql" PerlSetVar WhatEverDBI_Password "mypassword" PerlSetVar WhatEverDBI_UsersTable "users" PerlSetVar WhatEverDBI_UserField "username" PerlSetVar WhatEverDBI_PasswordField "password" PerlSetVar WhatEverDBI_CryptType "none" PerlSetVar WhatEverDBI_GroupsTable "groups" PerlSetVar WhatEverDBI_GroupField "grp" PerlSetVar WhatEverDBI_GroupUserField "user" PerlSetVar WhatEverDBI_EncryptionType "none" PerlSetVar WhatEverDBI_SessionLifetime 00-24-00-00 Directory /foo/protected AuthType Apache::AuthCookieDBI AuthName WhatEver PerlAuthenHandler Apache::AuthCookieDBI-authenticate PerlAuthzHandler Apache::AuthCookieDBI-authorize require valid-user /Directory Files LOGIN AuthType Apache::AuthCookieDBI AuthName WhatEver SetHandler perl-script PerlHandler Apache::AuthCookieDBI-login /Files The above directory and files locations are unchanged from when I got AuthCookie/AuthCookieHandler to work, except that I change the references from AuthCookieHandler to AuthCookieDBI. Also, the file /etc/httpd/foo.com.key exists, contains a long text string in the first line and is readable only by root. The problematic line in the httpd.conf file seems to be the PerlModule Apache::AuthCookieDBI line. If I comment it out, the server starts up with no problems whatsoever. Of course I need to use AuthCookieDBI, hence the issue.. Can someone possibly shed some light on this? Its completely baffling me and the lack of error messages in both the error log and on screen is only compounding the problem. If it helps, I am running Apache 1.3.14, mod_perl 1.25 and using Apache-AuthCookieDBI-1.18 and Apache-AuthCookie-2.011. Thanks a ton in advance for your help! Renu
Newbie question to mod_perl and Apache::DBI
Hi there, I am new to mod_perl and currently trying to make use of Apache::DBI. This is my enviroment: Suse Linux 6.3, Apache 1.3.12, mod_perl 1.24 and Oracle 8i. I am using HTML:Mason as well, as a templating system. Everything works. Apache::DBI is loaded via httpd.conf by Apache properly and I can make use of it in my scripts, when reading data. With my other script, updating data, I get the following error : Rebuild with -DPERL_STACKED_HANDLERS to $r-push_handlers at /usr/local/lib/perl5/site_perl/5.6.0/Apache/DBI.pm line 93. and the script does not get to connect the database and dies with a timeout. I think, I should add, that in both scripts, the one who is reading and the one who is updating, I open and close a $dbh (connect / disconnect). Anybody having an idea, what I am doing wrong ? Or where to find help ? Thanks for the help. Caro -- -- Caroline Kliegl Neustadt - Germany Sent through GMX FreeMail - http://www.gmx.net
Newbie question to mod_perl and Apache::DBI
Hi there, I am new to mod_perl and currently trying to make use of Apache::DBI. This is my enviroment: Suse Linux 6.3, Apache 1.3.12, mod_perl 1.24 and Oracle 8i. I am using HTML:Mason as well, as a templating system. Everything works. Apache::DBI is loaded via httpd.conf by Apache properly and I can make use of it in my scripts, when reading data. With my other script, updating data, I get the following error : Rebuild with -DPERL_STACKED_HANDLERS to $r-push_handlers at /usr/local/lib/perl5/site_perl/5.6.0/Apache/DBI.pm line 93. and the script does not get to connect the database and dies with a timeout. I think, I should add, that in both scripts, the one who is reading and the one who is updating, I open and close a $dbh (connect / disconnect). Anybody having an idea, what I am doing wrong ? Or where to find help ? Thanks for the help. Caro -- -- Caroline Kliegl Neustadt - Germany Sent through GMX FreeMail - http://www.gmx.net
Re: Newbie question to mod_perl and Apache::DBI
On Thu, Feb 08, 2001 at 11:57:50PM +0100, Caroline Kliegl wrote: [..] With my other script, updating data, I get the following error : Rebuild with -DPERL_STACKED_HANDLERS to $r-push_handlers at /usr/local/lib/perl5/site_perl/5.6.0/Apache/DBI.pm line 93. [..] You need to compile mod_perl with PERL_STACKED_HANDLERS = 1. See following for details: http://perl.apache.org/guide/databases.html#Apache_DBI_does_not_work Ajit
Re: Newbie question to mod_perl and Apache::DBI
Hi there, On Thu, 8 Feb 2001, Caroline Kliegl wrote: I am new to mod_perl and currently trying to make use of Apache::DBI. I get the following error : Rebuild with -DPERL_STACKED_HANDLERS to $r-push_handlers at /usr/local/lib/perl5/site_perl/5.6.0/Apache/DBI.pm line 93. I think it wants you to rebuild with -DPERL_STACKED_HANDLERS. http:perl.apache.org/guide - see the section on configuration. 73, Ged.
RE: Newbie question to mod_perl and Apache::DBI
Apache::DBI will call push_handlers on to issue a rollback if AutoCommit=0 in your connect string... but the problem may not be with you... looks like a bug (somewhere): if(!$Rollback{$Idx} and $needCleanup and Apache-can('push_handlers'){ ... } looks like calling Apache-can('push_handlers') is returning true even though you didn't activate PERL_STACKED_HANDLERS. I wonder if somehow can() isn't correctly capturing the build-time arguments (something to look into...) at any rate, the quickest way to fix this is to rebuild mod_perl with EVERYTHING=1 or PERL_STACKED_HANDLERS=1 (or don't set AutoCommit=0 in your connect string if you can't rebuild it now...) try these and see if they make a difference... HTH --Geoff -Original Message- From: Caroline Kliegl To: [EMAIL PROTECTED] Sent: 2/8/01 5:57 PM Subject: Newbie question to mod_perl and Apache::DBI Hi there, I am new to mod_perl and currently trying to make use of Apache::DBI. This is my enviroment: Suse Linux 6.3, Apache 1.3.12, mod_perl 1.24 and Oracle 8i. I am using HTML:Mason as well, as a templating system. Everything works. Apache::DBI is loaded via httpd.conf by Apache properly and I can make use of it in my scripts, when reading data. With my other script, updating data, I get the following error : Rebuild with -DPERL_STACKED_HANDLERS to $r-push_handlers at /usr/local/lib/perl5/site_perl/5.6.0/Apache/DBI.pm line 93. and the script does not get to connect the database and dies with a timeout. I think, I should add, that in both scripts, the one who is reading and the one who is updating, I open and close a $dbh (connect / disconnect). Anybody having an idea, what I am doing wrong ? Or where to find help ? Thanks for the help. Caro -- -- Caroline Kliegl Neustadt - Germany Sent through GMX FreeMail - http://www.gmx.net
RE: Newbie question to mod_perl and Apache::DBI
yup, it's a bug... #!/usr/bin/perl use Apache::MyConfig; my $r = shift; $r-send_http_header('text/plain'); print "can push_handlers\n" if Apache-can('push_handlers'); print "but PERL_STACKED_HANDLERS: ", $Apache::MyConfig::Setup{PERL_STACKED_HANDLERS}; basically Apache-can('push_handlers') returns true even if PERL_STACKED_HANDLERS=0 at build time... I guess that at some point this worked correctly, otherwise Edmund wouldn't have coded it that way? --Geoff -Original Message- From: Geoffrey Young To: 'Caroline Kliegl ' Cc: '[EMAIL PROTECTED]' Sent: 2/8/01 7:52 PM Subject: RE: Newbie question to mod_perl and Apache::DBI Apache::DBI will call push_handlers on to issue a rollback if AutoCommit=0 in your connect string... but the problem may not be with you... looks like a bug (somewhere): if(!$Rollback{$Idx} and $needCleanup and Apache-can('push_handlers'){ ... } looks like calling Apache-can('push_handlers') is returning true even though you didn't activate PERL_STACKED_HANDLERS. I wonder if somehow can() isn't correctly capturing the build-time arguments (something to look into...) at any rate, the quickest way to fix this is to rebuild mod_perl with EVERYTHING=1 or PERL_STACKED_HANDLERS=1 (or don't set AutoCommit=0 in your connect string if you can't rebuild it now...) try these and see if they make a difference... HTH --Geoff -Original Message- From: Caroline Kliegl To: [EMAIL PROTECTED] Sent: 2/8/01 5:57 PM Subject: Newbie question to mod_perl and Apache::DBI Hi there, I am new to mod_perl and currently trying to make use of Apache::DBI. This is my enviroment: Suse Linux 6.3, Apache 1.3.12, mod_perl 1.24 and Oracle 8i. I am using HTML:Mason as well, as a templating system. Everything works. Apache::DBI is loaded via httpd.conf by Apache properly and I can make use of it in my scripts, when reading data. With my other script, updating data, I get the following error : Rebuild with -DPERL_STACKED_HANDLERS to $r-push_handlers at /usr/local/lib/perl5/site_perl/5.6.0/Apache/DBI.pm line 93. and the script does not get to connect the database and dies with a timeout. I think, I should add, that in both scripts, the one who is reading and the one who is updating, I open and close a $dbh (connect / disconnect). Anybody having an idea, what I am doing wrong ? Or where to find help ? Thanks for the help. Caro -- -- Caroline Kliegl Neustadt - Germany Sent through GMX FreeMail - http://www.gmx.net
RE: Newbie question to mod_perl and Apache::DBI
Hi everybody, I have just removed RaiseError = 1, AutoCommit = 0 out of my DBI-connect. No more errors, ORA works! Next, I will recompile mod_perl with PERL_STACKED_HANDLERS = 1. Will come up with the result today. Thanks a lot, everybody! Caro -- -- Caroline Kliegl Neustadt - Germany Sent through GMX FreeMail - http://www.gmx.net
Apache::Registry newbie question -- CGI state
I am trying to implement Example 2-14 in Stein and MacEachern. Here's my code: #!/usr/bin/perl # file: hello.cgi use CGI qw(:standard); use strict; my $name = param('name') || 'Anonymous'; print header(),start_html(-title='Yo!', -bgcolor='yellow'), h1("Hello $name"), p( "To change your name, enter it into the text field below and press", em("change name.") ), start_form(), "Name: ", textfield(-name='name', -value='Anonymous'), submit(-value='Change Name'), end_form(), hr(), end_html(); It works once -- BUT -- the value entered after the first appearance with 'Anonymous', sticks and never changes despite submitting the form again and again. I thought that each invocation via CGI would change the value of param('name')? I understand the code has been compiled once and is now running thru Apache::Registry. Nevertheless, shouldn't new param() values be visable?
RE: Apache::Registry newbie question -- CGI state
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 10, 2001 6:01 AM To: [EMAIL PROTECTED] Subject: Apache::Registry newbie question -- CGI state I am trying to implement Example 2-14 in Stein and MacEachern. Here's my code: #!/usr/bin/perl # file: hello.cgi use CGI qw(:standard); use strict; I don't ever user CGI.pm, but aren't you forgetting to create a new CGI object in here? my $name = param('name') || 'Anonymous'; HTH --Geoff
Re: Apache::Registry newbie question -- CGI state
Geoffrey Young wrote: #!/usr/bin/perl # file: hello.cgi use CGI qw(:standard); use strict; I don't ever user CGI.pm, but aren't you forgetting to create a new CGI object in here? my $name = param('name') || 'Anonymous'; Geoff, I have another question: if you don't use CGI.pm, how do you generate the web form elements? Just "print qq{INPUT TYPE="text" ...}" or are there some nicer tricks?
Re: Apache::Registry newbie question -- CGI state
On Wed Jan 10, 2001 at 03:41:12PM +0100, Alexander Farber (EED) wrote: Geoff, I have another question: if you don't use CGI.pm, how do you generate the web form elements? Just "print qq{INPUT TYPE="text" ...}" or are there some nicer tricks? Are you know templates methode ? it's a realy nicer trick :) -- ___ O l i v i e rP o i t r e y "Si tous ceux qui n'ont rien n'en demandaient pas plus, il serait bien facile de contenter tout le monde." Coluche
RE: Apache::Registry newbie question -- CGI state
-Original Message- From: Alexander Farber (EED) [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 10, 2001 9:41 AM Cc: [EMAIL PROTECTED] Subject: Re: Apache::Registry newbie question -- CGI state Geoffrey Young wrote: #!/usr/bin/perl # file: hello.cgi use CGI qw(:standard); use strict; I don't ever user CGI.pm, but aren't you forgetting to create a new CGI object in here? my $name = param('name') || 'Anonymous'; Geoff, I have another question: if you don't use CGI.pm, how do you generate the web form elements? Just "print qq{INPUT TYPE="text" ...}" or are there some nicer tricks? see one of the many, many threads in the archives on templating :) --Geoff
Extreme Newbie Question
Let me apologize in advance if this is covered on a FAQ somewhere, or if this is the wrong place for this question. I've looked on the Apache web sites and in "Administering Apache" by Arnold, Almeida, and Miller but no luck. I'm just trying to get started with Apache and Perl on WinNT. I've been using IIS (with Perl), and would like to switch to Apache. I'm having trouble with getting Perl CGIs to run. I was able to get a basic "Hello world" (compiled C) CGI working, but not a simple "Hello world" Perl script. When I try the script's URL I get: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. In the error log I get: (2)No such file or directory: couldn't spawn child process: g:/apache group/apache/cgi-bin/test.pl The file's there, and since a missing file generates a "Not found" message, something else is going on. I suspect that Apache is trying to execute test.pl as an executable, and doesn't know it should send test.pl to Perl.exe. So is there some sort of "Set Interpretter" function in httpd.cnf I need to use? The only changes I made to httpd.cnf was to set the admin email to my email. I decommented #AddModule mod_perl.c but that caused Apache to refuse to start. Any help would be greatly appreciated, Gaf
Extreme Newbie Question
Nevermind, after searching on altavista for a couple hours I found a page that explained I had to use the #! notation (its not just for Unix anymore!) The test script works fine now. Gaf
Code Reuse (newbie question)
Basically I'm a bit stumped by how perl lets us reuse code snippets. I can't seem to bend modules to what I need to do exactly: I'm using Apache and mod_perl. Each perl script will produce a dynamic web page. Now, with each script I need to recover the session variables I'm saving (using Apache:Session:File) and also verify account name and password: # use vars qw(%session); eval { tie %session, 'Apache::Session::File', $authid, { Directory = '/tmp/sessions' } }; if ($@) { print redirect("LOGIN.pl?CAUSE=FailedSessionTie"); exit; } if (time() $session{expire_time}) { print redirect("LOGIN.pl?CAUSE=TIMED_OUT"); exit; } $session{expire_time} = time() + SURVEYDESIGN::survey_expire(); # Basically this chuck of code that I want to replicate across scripts is going to grow/shrink/change rapidly in the coming weeks as I toy with the project. My problem seems to be that I can not include/inherit a chunk of text, but rather need to place code in a separate package for reuse. But I don't see how that allows me to recover sessions and setup variables in the main package. Any input (or a redirection to a good FAQ) would be very welcome! Thanks. Daniel Hutchison Target Analysis Group mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 617.583.8411
modperl newbie: question about unable to load File.pm
I am trying to learn mod_perl, and have been going through the O'Reilly book. Got to the "footer" example, where it just simply adds some HTML to the bottom of a page. not a big deal. when I try to run it, I get issues with mod_perl not being able to find File.pm. here is some of what I see (I removed lots of extra text): File.pm: Can't locate loadable object for module Apache::File in @INC (@INC contains: /usr/local/apache/lib/perl /usr/local/lib/perl5/5.00503/sun4-solaris /usr/local/lib/perl5/5.00503 /usr/local/lib/perl5/site_perl/5.005/sun4-solaris /usr/local/lib/perl5/site_perl/5.005 . /usr/local/apache/ /usr/local/apache/lib/perl) at /usr/local/lib/perl5/site_perl/5.005/sun4-solaris/mod_perl.pm line 14 [Thu Aug 24 15:30:59 2000] Footer.pm: [Thu Aug 24 15:30:59 2000] Footer.pm: BEGIN failed--compilation aborted at /usr/local/apache/lib/perl/Apache/Footer.pm line 6. for reference, this is Solaris 2.6. Footer.pm is the module I am trying to write, sites at ~apache/lib/perl/Apache/Footer.pm. this is latest Apache (1.3.12) and mod_perl (1.24). Mainly a stock install, with grabbing the sources, doing the standard make and make install on them. I didn't do any extra setup for it, other than Use Apache::File ();, which is basically where it is choking. I checked, File.pm IS located down in the /usr/local/lib/perl5 directory, in the same directories as other modules that ARE working (like Constants). Hate to ask what may be an obvious question, but anyone have any idea what is causing this? any information would be appreciated.
RE: modperl newbie: question about unable to load File.pm
make sure that you enabled Apache::File when you built mod_perl, ie perl Makefile.PL EVERYTHING=1 or perl Makefile.PL PERL_FILE_API=1 HTH --Geoff -Original Message- From: Hoffman , Geoffrey [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 24, 2000 3:40 PM To: modperl Subject: modperl newbie: question about unable to load File.pm I am trying to learn mod_perl, and have been going through the O'Reilly book. Got to the "footer" example, where it just simply adds some HTML to the bottom of a page. not a big deal. when I try to run it, I get issues with mod_perl not being able to find File.pm. here is some of what I see (I removed lots of extra text): File.pm: Can't locate loadable object for module Apache::File in @INC (@INC contains: /usr/local/apache/lib/perl /usr/local/lib/perl5/5.00503/sun4-solaris /usr/local/lib/perl5/5.00503 /usr/local/lib/perl5/site_perl/5.005/sun4-solaris /usr/local/lib/perl5/site_perl/5.005 . /usr/local/apache/ /usr/local/apache/lib/perl) at /usr/local/lib/perl5/site_perl/5.005/sun4-solaris/mod_perl.pm line 14 [Thu Aug 24 15:30:59 2000] Footer.pm: [Thu Aug 24 15:30:59 2000] Footer.pm: BEGIN failed--compilation aborted at /usr/local/apache/lib/perl/Apache/Footer.pm line 6. for reference, this is Solaris 2.6. Footer.pm is the module I am trying to write, sites at ~apache/lib/perl/Apache/Footer.pm. this is latest Apache (1.3.12) and mod_perl (1.24). Mainly a stock install, with grabbing the sources, doing the standard make and make install on them. I didn't do any extra setup for it, other than Use Apache::File ();, which is basically where it is choking. I checked, File.pm IS located down in the /usr/local/lib/perl5 directory, in the same directories as other modules that ARE working (like Constants). Hate to ask what may be an obvious question, but anyone have any idea what is causing this? any information would be appreciated.
RE: modperl newbie: question about unable to load File.pm - fixed
hey, never mind about this. It seems that it was mainly missing the: perl Makefile.pl EVERYTHING=1 thing. I actually compiled it, then did the make with everything, but forgot the make install. sorry to bother y'all. -Original Message- From: Hoffman , Geoffrey Sent: Thursday, August 24, 2000 3:40 PM To: modperl Subject: modperl newbie: question about unable to load File.pm I am trying to learn mod_perl, and have been going through the O'Reilly book. Got to the "footer" example, where it just simply adds some HTML to the bottom of a page. not a big deal. when I try to run it, I get issues with mod_perl not being able to find File.pm. here is some of what I see (I removed lots of extra text): File.pm: Can't locate loadable object for module Apache::File in @INC (@INC contains: /usr/local/apache/lib/perl /usr/local/lib/perl5/5.00503/sun4-solaris /usr/local/lib/perl5/5.00503 /usr/local/lib/perl5/site_perl/5.005/sun4-solaris /usr/local/lib/perl5/site_perl/5.005 . /usr/local/apache/ /usr/local/apache/lib/perl) at /usr/local/lib/perl5/site_perl/5.005/sun4-solaris/mod_perl.pm line 14 [Thu Aug 24 15:30:59 2000] Footer.pm: [Thu Aug 24 15:30:59 2000] Footer.pm: BEGIN failed--compilation aborted at /usr/local/apache/lib/perl/Apache/Footer.pm line 6. for reference, this is Solaris 2.6. Footer.pm is the module I am trying to write, sites at ~apache/lib/perl/Apache/Footer.pm. this is latest Apache (1.3.12) and mod_perl (1.24). Mainly a stock install, with grabbing the sources, doing the standard make and make install on them. I didn't do any extra setup for it, other than Use Apache::File ();, which is basically where it is choking. I checked, File.pm IS located down in the /usr/local/lib/perl5 directory, in the same directories as other modules that ARE working (like Constants). Hate to ask what may be an obvious question, but anyone have any idea what is causing this? any information would be appreciated.
Newbie question on Apache::Debug::dump
Sorry if this has been asked before but I have been unable to find the answer (not in perldoc, apache modules book, searching archives): I would like my perl compilation and process errors to be written to an HTML page if/when they occur, in the same way they are written to stdout when I run from the command line. I thought that Apache::Debug::dump would do this, am I correct?? I am unable to make it work though. I can't seem to find any examples of how to use it, perldoc is too brief for my limited skills, the apache modules book (eagle) says: "The three arguments to dump() are the request object, an error code to return to Apache... and an error message..." What is a "request object"? No matter what I do, all I can produce is that "OK" server error page. My perl code is a simple: give userid, password, database, sql query, connect to my database (oracle) and display the results. Can someone please give me an example of how to use dump()? Or if you have a different suggestion. Appended is my simple perl code and HTML error page Thanks Jay Jay Strauss [EMAIL PROTECTED] (h) 773.935.5326 (c) 312.617.0264 #!/usr/bin/perl -w use strict; use Apache::Constants qw(:common); use Apache::Registry; use Apache::Debug; use DBI; print "Content-Type: text/html\n\n"; print "HTML\n"; print "BODY\n"; my $r = shift; my %input = $r-method eq 'POST' ? $r-content : $r-args; $ENV{ORACLE_HOME} = "/u01/app/oracle/product/8.1.6"; my $dbh = DBI-connect("dbi:Oracle:$input{servicename}",$input{userid},$input{password}) or Apache::Debug::dump($dbh,SERVER_ERROR,"Can not connect to database $input {servicename}"); my $sqlh = $dbh-prepare($input{query}); my $rc = $sqlh-execute; print "table border=1\n"; foreach my $ColumnName (@{$sqlh-{NAME}}){ print "td align=left$ColumnName"; } while (my @row = $sqlh-fetchrow_array()){ print "tr\n"; foreach my $column (@row) { while (my @row = $sqlh-fetchrow_array()){ print "tr\n"; foreach my $column (@row) { print "td$column/td"; } print "/tr\n"; } warn "Problem in fetchrow_array(): ", $sqlh-errstr(), "\n" if $sqlh-err(); print "/table\n"; $dbh-disconnect; print "/BODY\n"; print "/HTML\n"; exit; The error page HTML --- HTML BODY HTTP/1.1 200 OK Date: Sat, 19 Aug 2000 16:36:10 GMT Server: Apache/1.3.12 (Unix) mod_perl/1.24 Connection: close Transfer-Encoding: chunked Content-Type: text/html; charset=iso-8859-1 !DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN" HTMLHEAD TITLE200 OK/TITLE /HEADBODY H1OK/H1 The server encountered an internal error or misconfiguration and was unable to complete your request.P Please contact the server administrator, [EMAIL PROTECTED] and inform them of the time the error occurred, and anything you might have done that may have caused the error.P More information about this error may be available in the server error log.P HR ADDRESSApache/1.3.12 Server at abba.hostdb.com Port 80/ADDRESS /BODY/HTML
Re: Newbie question on Apache::Debug::dump
The request object is $r Craig On Sat, 19 Aug 2000, Jay Strauss wrote: Sorry if this has been asked before but I have been unable to find the answer (not in perldoc, apache modules book, searching archives): I would like my perl compilation and process errors to be written to an HTML page if/when they occur, in the same way they are written to stdout when I run from the command line. I thought that Apache::Debug::dump would do this, am I correct?? I am unable to make it work though. I can't seem to find any examples of how to use it, perldoc is too brief for my limited skills, the apache modules book (eagle) says: "The three arguments to dump() are the request object, an error code to return to Apache... and an error message..." What is a "request object"? No matter what I do, all I can produce is that "OK" server error page. My perl code is a simple: give userid, password, database, sql query, connect to my database (oracle) and display the results. Can someone please give me an example of how to use dump()? Or if you have a different suggestion. Appended is my simple perl code and HTML error page Thanks Jay
RE: newbie question - require
Check the mod_perl guide for the usage of require() and do(). You probably want to use do() instead of require(). Chris -Original Message- From: Brett Lee [mailto:[EMAIL PROTECTED]] Sent: Monday, May 15, 2000 7:56 AM To: [EMAIL PROTECTED] Subject: newbie question - require In moving from CGI.pm to mod_perl, I ran across the common error with functions that exist in scripts pulled in with 'require'. Mod_perl_traps.html had the solution. Similarly, am using ('require') another file which holds all the hash tables (countries, states, etc.) that my scripts need to reference. It appeared to work fine in CGI.pm, but with mod_perl, the info in the hash tables seems to be found "every other refresh" (which has me stumped). Would anyone be able to suggest a solution or reading material on this? Thanks in advance. -Brett
Re: newbie question - require
Brett Lee wrote: but with mod_perl, the info in the hash tables seems to be found "every other refresh" (which has me stumped). Would anyone be able to suggest a solution or reading material on this? don't forget to check your stuff out with single-process mode, via 'apachectl stop; apache -X'; if it's acting sporadically in your browser, it may be because you're talking to different child apache servers, each in its own state of affairs... http://perl.apache.org/guide/porting.html#Sometimes_it_Works_Sometimes_it
newbie question - require
In moving from CGI.pm to mod_perl, I ran across the common error with functions that exist in scripts pulled in with 'require'. Mod_perl_traps.html had the solution. Similarly, am using ('require') another file which holds all the hash tables (countries, states, etc.) that my scripts need to reference. It appeared to work fine in CGI.pm, but with mod_perl, the info in the hash tables seems to be found "every other refresh" (which has me stumped). Would anyone be able to suggest a solution or reading material on this? Thanks in advance. -Brett
Re: Newbie Question -
On Sat, 6 May 2000, Gunther Birznieks wrote: At 06:56 PM 5/5/00 -0400, Jim Winstead wrote: On May 05, Adi wrote: You can still use CGI.pm from within mod_perl (and you should). There is nothing better at handling data passed from a browser via HTTP POST and/or GET. If you currently use CGI.pm, I think you'll find that a lot of your current code can simply be cut-and-pasted into a mod_perl setup. Well, arguably Apache::Request is better at handling data passed from a browser via HTTP POST and/or GET in a mod_perl environment. And it has the advantage that is entirely focused on request handling, and doesn't have any of the HTML generation cruft like CGI.pm. The "HTML Generation cruft" is optional "cruft" and doesn't have to be compiled in. not compiled, but the all the code lives in a BIG hash table for CGI.pm to autoload from. the export lists take up alot of space too. regardless if you're using html routines or not.
Re: Newbie Question -
On Fri, 12 May 2000, Doug MacEachern wrote: On Sat, 6 May 2000, Gunther Birznieks wrote: At 06:56 PM 5/5/00 -0400, Jim Winstead wrote: On May 05, Adi wrote: You can still use CGI.pm from within mod_perl (and you should). There is nothing better at handling data passed from a browser via HTTP POST and/or GET. If you currently use CGI.pm, I think you'll find that a lot of your current code can simply be cut-and-pasted into a mod_perl setup. Well, arguably Apache::Request is better at handling data passed from a browser via HTTP POST and/or GET in a mod_perl environment. And it has the advantage that is entirely focused on request handling, and doesn't have any of the HTML generation cruft like CGI.pm. The "HTML Generation cruft" is optional "cruft" and doesn't have to be compiled in. not compiled, but the all the code lives in a BIG hash table for CGI.pm to autoload from. the export lists take up alot of space too. regardless if you're using html routines or not. As I have replied to FEITO Nazareno today, this happens only if you precompile CGI.pm's functions at the server startup. I've used B::Terse in /perl-status to check that. Refer to the post with subject "[iso-8859-1] Whats better?program with C" for a complete showcase. If you don't precompile them, only the minumum set of functions will be inherited, so it's possible to exclude the html generation functions. __ Stas Bekman | JAm_pH--Just Another mod_perl Hacker http://stason.org/ | mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] | http://perl.orghttp://stason.org/TULARC/ http://singlesheaven.com| http://perlmonth.com http://sourcegarden.org --
Re: Newbie Question -
not compiled, but the all the code lives in a BIG hash table for CGI.pm to autoload from. the export lists take up alot of space too. regardless if you're using html routines or not. As I have replied to FEITO Nazareno today, this happens only if you precompile CGI.pm's functions at the server startup. I've used B::Terse in /perl-status to check that. Refer to the post with subject "[iso-8859-1] Whats better?program with C" for a complete showcase. If you don't precompile them, only the minumum set of functions will be inherited, so it's possible to exclude the html generation functions. re-read what i said, i'm talking about variables in CGI.pm like %EXPORT_TAGS, %SUBS, etc.
Re: Newbie Question -
Peter Haworth wrote: Drew Taylor wrote: What I would really like is a module which subclasses Apache::Request, and has the popup_menu, scrolling_list, and checkbox group methods available. That way I can use the smaller (faster) Apache::Request and still have the few HTML generation methods that I need. This would be similar to Apache::RequestNotes. One day I'll actually do it when I convert my CGI scripts to perl handlers... I've written one, but to get it released on CPAN would mean months of legal wrangling, which I'm already going through with my shared cache module. It's easy enough to write for yourself though. Plus you get to restrict the API to one style which makes your code much simpler and faster than CGI.pm I'm quite sure it would be an easy write, but I just haven't done it yet. I think once I convert my CGIs to handlers, it makes sense to do it then. It would be interesting to see if anyone else is interested and work out an API for the most commonly used methods. I work in a small shop, so it would probably not be a big deal to get any resulting code released to the world. Of course, then I have to learn how to create a distributible package... :-) -- Drew Taylor Vialogix Communications, Inc. 501 N. College Street Charlotte, NC 28202 704 370 0550 http://www.vialogix.com/
Re: Newbie Question -
Drew Taylor wrote: What I would really like is a module which subclasses Apache::Request, and has the popup_menu, scrolling_list, and checkbox group methods available. That way I can use the smaller (faster) Apache::Request and still have the few HTML generation methods that I need. This would be similar to Apache::RequestNotes. One day I'll actually do it when I convert my CGI scripts to perl handlers... I've written one, but to get it released on CPAN would mean months of legal wrangling, which I'm already going through with my shared cache module. It's easy enough to write for yourself though. Plus you get to restrict the API to one style which makes your code much simpler and faster than CGI.pm -- Peter Haworth [EMAIL PROTECTED] "Psychos do not explode when sunlight hits them. I don't give a f**k how crazy they are." -- Seth Gecko, _From Dusk Till Dawn_
RE: Newbie Question -
-Original Message- From: Drew Taylor [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 09, 2000 9:08 AM To: Peter Haworth Cc: [EMAIL PROTECTED] Subject: Re: Newbie Question - Peter Haworth wrote: Drew Taylor wrote: What I would really like is a module which subclasses Apache::Request, and has the popup_menu, scrolling_list, and checkbox group methods available. That way I can use the smaller (faster) Apache::Request and still have the few HTML generation methods that I need. This would be similar to Apache::RequestNotes. One day I'll actually do it when I convert my CGI scripts to perl handlers... I've written one, but to get it released on CPAN would mean months of legal wrangling, which I'm already going through with my shared cache module. It's easy enough to write for yourself though. Plus you get to restrict the API to one style which makes your code much simpler and faster than CGI.pm I'm quite sure it would be an easy write, but I just haven't done it yet. I think once I convert my CGIs to handlers, it makes sense to do it then. It would be interesting to see if anyone else is interested and work out an API for the most commonly used methods. I work in a small shop, so it would probably not be a big deal to get any resulting code released to the world. Of course, then I have to learn how to create a distributible package... :-) for guidance on how to contribute your stuff, read http://perl.apache.org/src/apache-modlist.html specifically: HINT: For a nice set of template files try this: % h2xs -AX -n Apache::YourPackageName HTH --Geoff -- Drew Taylor Vialogix Communications, Inc. 501 N. College Street Charlotte, NC 28202 704 370 0550 http://www.vialogix.com/
Re: Newbie Question -
Geoffrey Young wrote: Drew Taylor wrote: I'm quite sure it would be an easy write, but I just haven't done it yet. I think once I convert my CGIs to handlers, it makes sense to do it then. It would be interesting to see if anyone else is interested and work out an API for the most commonly used methods. I work in a small shop, so it would probably not be a big deal to get any resulting code released to the world. Of course, then I have to learn how to create a distributible package... :-) for guidance on how to contribute your stuff, read http://perl.apache.org/src/apache-modlist.html specifically: HINT: For a nice set of template files try this: % h2xs -AX -n Apache::YourPackageName I'll be sure to remember that. Thanks for the pointer. Hopefully I can contribute something back to the community. After all, it gave me mod_perl. :-) -- Drew Taylor Vialogix Communications, Inc. 501 N. College Street Charlotte, NC 28202 704 370 0550 http://www.vialogix.com/
RE: Newbie Question -
-Original Message- From: Doug MacEachern [mailto:[EMAIL PROTECTED]] Sent: Friday, May 05, 2000 6:22 PM To: Geoffrey Young Cc: 'Pierre J. Nicolas'; [EMAIL PROTECTED] Subject: RE: Newbie Question - mod_perl overrides the perl print() function - print()ing to STDOUT explititly will not work. just use print() if you can... sure it will, print STDOUT "hi"; and print "hi"; are the same thing, provided STDOUT is the currently selected output filehandle, which it is by default. ack, I swore I tried this just last week and it didn't work - clearly is does. Sorry for the misinformation... --Geoff
Re: Newbie Question -
Adi wrote: Jim Winstead wrote: On May 05, Adi wrote: You can still use CGI.pm from within mod_perl (and you should). There is nothing better at handling data passed from a browser via HTTP POST and/or GET. If you currently use CGI.pm, I think you'll find that a lot of your current code can simply be cut-and-pasted into a mod_perl setup. Well, arguably Apache::Request is better at handling data passed from a browser via HTTP POST and/or GET in a mod_perl environment. And it has the advantage that is entirely focused on request handling, and doesn't have any of the HTML generation cruft like CGI.pm. Wow, I wasn't aware of Apache::Request.. thanks for letting me know. What I would really like is a module which subclasses Apache::Request, and has the popup_menu, scrolling_list, and checkbox group methods available. That way I can use the smaller (faster) Apache::Request and still have the few HTML generation methods that I need. This would be similar to Apache::RequestNotes. One day I'll actually do it when I convert my CGI scripts to perl handlers... -- Drew Taylor Vialogix Communications, Inc. 501 N. College Street Charlotte, NC 28202 704 370 0550 http://www.vialogix.com/
Newbie Question -
Good Morning, I just started using mod_perl, I'm still using the CGI.pm module, but I plan to convert. I've loaded the Apache::Registry and I'm experiencing a strange problem. I have this snippet: print "Content-Type: text/html\n\n"; print_template(file_handle, *file_handle_ref) { open file_handle() while (file_handle()) { manipulate current_line print file_handle_ref current_line } } where "*file_handle_ref" could be a reference to STDOUT, this snippet worked fine, but now it stopped working, instead I get the message "The document contained no data" Also in my location tag I also have the directive "PerlSendHearder On" however, when I remove that line all I get is the string "Content-Type: text/html" displayed in the browser. Thanks, Pierre
Newbie Question
Good Morning, I just started using mod_perl, could someone please tell me why I would get an error: "Undefined subroutine Apache::ROOT::dir::prog_name::function_name called at /path/to/script/script_name line line_numer" when I specifically "require module_with_function_name" in the script. I am using Apache::Registry. Thanks, Pierre
RE: Newbie Question
you'll find a great many questions answered in the mod_perl guide... http://perl.apache.org/guide/troubleshooting.html#Undefined_subroutine_Apach e_RO --Geoff -Original Message- From: Pierre J. Nicolas [mailto:[EMAIL PROTECTED]] Sent: Friday, May 05, 2000 10:15 AM To: [EMAIL PROTECTED] Subject: Newbie Question Good Morning, I just started using mod_perl, could someone please tell me why I would get an error: "Undefined subroutine Apache::ROOT::dir::prog_name::function_name called at /path/to/script/script_name line line_numer" when I specifically "require module_with_function_name" in the script. I am using Apache::Registry. Thanks, Pierre
Re: Newbie Question -
On Fri, 5 May 2000, Pierre J. Nicolas wrote: Good Morning, I just started using mod_perl, I'm still using the CGI.pm module, but I plan to convert. I've loaded the Apache::Registry and I'm experiencing a strange problem. I have this snippet: print "Content-Type: text/html\n\n"; print_template(file_handle, *file_handle_ref) { open file_handle() while (file_handle()) { manipulate current_line print file_handle_ref current_line } } where "*file_handle_ref" could be a reference to STDOUT, this snippet worked fine, but now it stopped working, instead I get the message "The document contained no data" are you saying you re-open STDOUT? if so, you break the tie to the browser. but, i don't understand the code you've posted, if you have a tiny example that we can actually run, we should be able to see the problem.
RE: Newbie Question -
mod_perl overrides the perl print() function - print()ing to STDOUT explititly will not work. just use print() if you can... sure it will, print STDOUT "hi"; and print "hi"; are the same thing, provided STDOUT is the currently selected output filehandle, which it is by default.
Re: Newbie Question -
"Pierre J. Nicolas" wrote: Good Morning, I just started using mod_perl, I'm still using the CGI.pm module, but I plan to convert. You can still use CGI.pm from within mod_perl (and you should). There is nothing better at handling data passed from a browser via HTTP POST and/or GET. If you currently use CGI.pm, I think you'll find that a lot of your current code can simply be cut-and-pasted into a mod_perl setup. -Adi
Re: Newbie Question -
On May 05, Adi wrote: You can still use CGI.pm from within mod_perl (and you should). There is nothing better at handling data passed from a browser via HTTP POST and/or GET. If you currently use CGI.pm, I think you'll find that a lot of your current code can simply be cut-and-pasted into a mod_perl setup. Well, arguably Apache::Request is better at handling data passed from a browser via HTTP POST and/or GET in a mod_perl environment. And it has the advantage that is entirely focused on request handling, and doesn't have any of the HTML generation cruft like CGI.pm. (But you are certainly correct in saying that you can continue to use CGI.pm with mod_perl.) Jim
Re: Newbie Question -
Jim Winstead wrote: On May 05, Adi wrote: You can still use CGI.pm from within mod_perl (and you should). There is nothing better at handling data passed from a browser via HTTP POST and/or GET. If you currently use CGI.pm, I think you'll find that a lot of your current code can simply be cut-and-pasted into a mod_perl setup. Well, arguably Apache::Request is better at handling data passed from a browser via HTTP POST and/or GET in a mod_perl environment. And it has the advantage that is entirely focused on request handling, and doesn't have any of the HTML generation cruft like CGI.pm. Wow, I wasn't aware of Apache::Request.. thanks for letting me know.
Re: Newbie Question -
At 06:56 PM 5/5/00 -0400, Jim Winstead wrote: On May 05, Adi wrote: You can still use CGI.pm from within mod_perl (and you should). There is nothing better at handling data passed from a browser via HTTP POST and/or GET. If you currently use CGI.pm, I think you'll find that a lot of your current code can simply be cut-and-pasted into a mod_perl setup. Well, arguably Apache::Request is better at handling data passed from a browser via HTTP POST and/or GET in a mod_perl environment. And it has the advantage that is entirely focused on request handling, and doesn't have any of the HTML generation cruft like CGI.pm. The "HTML Generation cruft" is optional "cruft" and doesn't have to be compiled in. __ Gunther Birznieks ([EMAIL PROTECTED]) Extropia - The Web Technology Company http://www.extropia.com/
Re: newbie question: extra Content-Type headers?
On Fri, Feb 04, 2000 at 06:21:21PM -0800, John Darrow wrote: I apologize if this is a dumb question, but I just installed Apache and mod_perl and all seems to have gone well. The trouble comes in when I try to run a script using Apache::Registry and CGI.pm. I get an extra Content-Type in the resulting page, and I can't figure out where it's coming from. [snipped the rest] perldoc cgi_to_mod_perl search the pod for "PerlSendHeader" - wendell
Re: newbie question: extra Content-Type headers?
On Fri, Feb 04, 2000 at 06:21:21PM -0800, John Darrow wrote: I apologize if this is a dumb question, but I just installed Apache and mod_perl and all seems to have gone well. The trouble comes in when I try to run a script using Apache::Registry and CGI.pm. I get an extra Content-Type in the resulting page, and I can't figure out where it's coming from. [snipped the rest] perldoc cgi_to_mod_perl search the pod for "PerlSendHeader" CGI.pm long ago has become mod_perl aware. If you remove PerlSendHeader, other scripts that don't use CGI.pm won't work correctly. Upgrade CGI.pm as suggested by Brian and your problem will disappear. ___ Stas Bekmanmailto:[EMAIL PROTECTED] http://www.stason.org/stas Perl,CGI,Apache,Linux,Web,Java,PC http://www.stason.org/stas/TULARC perl.apache.orgmodperl.sourcegarden.org perlmonth.comperl.org single o- + single o-+ = singlesheavenhttp://www.singlesheaven.com
RE: newbie question: extra Content-Type headers?
Thanks. Upgrading to 2.56 did fix it. My system still had CGI version 2.36. -john. -Original Message- From: Stas Bekman [mailto:[EMAIL PROTECTED]] Sent: Saturday, February 05, 2000 1:33 AM To: Wendell Cc: John Darrow; [EMAIL PROTECTED] Subject: Re: newbie question: extra Content-Type headers? On Fri, Feb 04, 2000 at 06:21:21PM -0800, John Darrow wrote: I apologize if this is a dumb question, but I just installed Apache and mod_perl and all seems to have gone well. The trouble comes in when I try to run a script using Apache::Registry and CGI.pm. I get an extra Content-Type in the resulting page, and I can't figure out where it's coming from. [snipped the rest] perldoc cgi_to_mod_perl search the pod for "PerlSendHeader" CGI.pm long ago has become mod_perl aware. If you remove PerlSendHeader, other scripts that don't use CGI.pm won't work correctly. Upgrade CGI.pm as suggested by Brian and your problem will disappear. ___ Stas Bekmanmailto:[EMAIL PROTECTED] http://www.stason.org/stas Perl,CGI,Apache,Linux,Web,Java,PC http://www.stason.org/stas/TULARC perl.apache.orgmodperl.sourcegarden.org perlmonth.comperl.org single o- + single o-+ = singlesheavenhttp://www.singlesheaven.com
newbie question: extra Content-Type headers?
I apologize if this is a dumb question, but I just installed Apache and mod_perl and all seems to have gone well. The trouble comes in when I try to run a script using Apache::Registry and CGI.pm. I get an extra Content-Type in the resulting page, and I can't figure out where it's coming from. First example: #!/usr/bin/perl print "Content-Type: text/html\n\n"; print "htmlheadtitleboo/title/head"; print "bodyh1I was here./h1/body/html"; This work fine. Second example: #!/usr/bin/perl use CGI qw(:standard); print header(), start_html(-title='boo'), h1("this doesn't work!!!"), end_html(); This second example ends up printing "Content-type: text/html" at the top of the page. Is there something in httpd.conf that tells the server to print the content type automatically? Why does the first example work if the second doesn't, if ultimately they should both end up printing more or less the same thing. If I run the second example as a regular CGI script (not under mod_perl) it comes out fine. so, I'm stumped. But I know it's something painfully obvious. thanks, -john.
Re: newbie question: extra Content-Type headers?
At 06:21 PM 02/04/00 -0800, John Darrow wrote: I apologize if this is a dumb question, but I just installed Apache and mod_perl and all seems to have gone well. The trouble comes in when I try to run a script using Apache::Registry and CGI.pm. I get an extra Content-Type in the resulting page, and I can't figure out where it's coming from. What version of CGI.pm are you running? Might try upgrading. Or try turning PerlSendHeader Off. Bill Moseley mailto:[EMAIL PROTECTED]
Re: Newbie Question
I am a relative newbie to mod_perl myself, but - I would think if you just want "a script to handle forms" that a vanilla CGI would be cake to set up and sufficient for your needs unless you get huge traffic. And I am led to think that if you just loaded ActivePerl then you are a long way from having mod_perl installed anyway. Have you recompiled Apache etc.? -S At 01:58 PM 2/2/00 +1000, you wrote: Thanks for your responses so far, I know I have a lot of reading to do but I just thought I would add this to my first post. After loading Activeperl I changed the httpd.conf file by adding the following: Alias /perl/ c:/Program Files/Apache Group/Apache/cgi-bin Location /perl SetHandler perl-script PerlHandler Apache::Registry Options ExecCGI /Location PerlModule Apache::Registry PerlModule CGI PerlSendHeader On It was after adding this that the service refused to restart. I will obviously have to read a whole lot more before this is going to work. The annoying thing is that I just want to run a script to handle forms seems like a hell of a lot of effort for such a simple request :) Thanks all Ian * Ian Ollier - [EMAIL PROTECTED] Systems Administrator Queensland Centre for Schizophrenia Research Wolston Park Hospital, Wolston Park Road Wacol QLD 4076 AUSTRALIA ph: +61 7 3271 8592 fax: +61 7 3271 8567 mobile: 0411145593 website: http://www.qcsr.uq.edu.au Any opinions herein are my own and do not necessarily reflect my employer's views. *
Re: Newbie Question
I am a relative newbie to mod_perl myself, but - I would think if you just want "a script to handle forms" that a vanilla CGI would be cake to set up and sufficient for your needs unless you get huge traffic. And I am led to think that if you just loaded ActivePerl then you are a long way from having mod_perl installed anyway. Have you recompiled Apache etc.? Or just use already built Win Apache / PERL / mod_perl distribution : ftp://theoryx5.uwinnipeg.ca/pub/other/ Regards, Waldek Grudzien _ http://www.uhc.lublin.pl/~waldekg/ University Health Care Lublin/Lubartow, Poland tel. +48 81 44 111 88 ICQ # 20441796 I know I have a lot of reading to do but I just thought I would add this to my first post. After loading Activeperl I changed the httpd.conf file by adding the following: Alias /perl/ c:/Program Files/Apache Group/Apache/cgi-bin Location /perl SetHandler perl-script PerlHandler Apache::Registry Options ExecCGI /Location PerlModule Apache::Registry PerlModule CGI PerlSendHeader On It was after adding this that the service refused to restart. I will obviously have to read a whole lot more before this is going to work. The annoying thing is that I just want to run a script to handle forms seems like a hell of a lot of effort for such a simple request :)
Newbie Question
Hi all, I hope you guys will forgive this question, but I am a complete beginner with CGI etc. We run an NT Server using Apache Web Server and I want to run Perl scripts on our web site to handle our administration forms. I loaded the Activeperl software onto the server, but it still doesn't run perl scripts. I have read heaps of stuff (most confusing) I have made changes to the httpd.conf file as outlined in some documents I read but then the service won't restart. I read a lot about the MOD-PERL but very little about what it is and how it works, is this my problem? Is anyone willing to tell me in SIMPLE terms what i have to do to get this thing working? I think you all for any help you can provide. And again I apologise for bringing such a lame question to the list. Thanks again Ian * Ian Ollier - [EMAIL PROTECTED] Systems Administrator Queensland Centre for Schizophrenia Research Wolston Park Hospital, Wolston Park Road Wacol QLD 4076 AUSTRALIA ph: +61 7 3271 8592 fax: +61 7 3271 8567 mobile: 0411145593 website: http://www.qcsr.uq.edu.au Any opinions herein are my own and do not necessarily reflect my employer's views. *
Re: Newbie Question
Hi Ian, We run an NT Server using Apache Web Server and I want to run Perl scripts on our web site to handle our administration forms. To get full advantage out of mod_perl, it is more interesting to use it on UNIX machines. But, in this community, we will encourage you to use mod_perl even if you are determined to use NT. I loaded the Activeperl software onto the server With the ActivePerl distribution, you can run Perl scripts in plain CGI mode, but you cannot use mod_perl. but then the service won't restart. You should provide a complete technical description of your problem. I read a lot about the MOD-PERL but very little about what it is and how it works, is this my problem? Yes. You should start by reading http://perl.apache.org/guide. Take your time to read this document carefully. Is anyone willing to tell me in SIMPLE terms what i have to do to get this thing working? You should understand that mod_perl is a bridge between Perl and Apache, which, apart from its technical excellence, allows Perl programmers to use their Perl culture while configuring and programming their Web applications not only at the application level (the script itself) but also at the system level (the server, i.e. Apache). Whether you use mod_perl or not, programming a Web application requires understanding how the Web works and how http servers work. Reading http://perl.apache.org/guide will attract your attention to mod_perl's major ambitions. Try to define what your application's ambition first of all, then look for corresponding guidelines in that document. Victor.
Newbie Question
Thanks for your responses so far, I know I have a lot of reading to do but I just thought I would add this to my first post. After loading Activeperl I changed the httpd.conf file by adding the following: Alias /perl/ c:/Program Files/Apache Group/Apache/cgi-bin Location /perl SetHandler perl-script PerlHandler Apache::Registry Options ExecCGI /Location PerlModule Apache::Registry PerlModule CGI PerlSendHeader On It was after adding this that the service refused to restart. I will obviously have to read a whole lot more before this is going to work. The annoying thing is that I just want to run a script to handle forms seems like a hell of a lot of effort for such a simple request :) Thanks all Ian * Ian Ollier - [EMAIL PROTECTED] Systems Administrator Queensland Centre for Schizophrenia Research Wolston Park Hospital, Wolston Park Road Wacol QLD 4076 AUSTRALIA ph: +61 7 3271 8592 fax: +61 7 3271 8567 mobile: 0411145593 website: http://www.qcsr.uq.edu.au Any opinions herein are my own and do not necessarily reflect my employer's views. *
Embperl problem (newbie question?)
Just trying out Embperl, and I discovered that (in my test of dynamic tables) the $maxrow and $maxcol variables are being set to defaults of 100 and 10 respectively and then obeyed, even though the $tabmode variable is set to 17. According to the documentation, these variables should only be obeyed when tabmode contains bits in the 64 and 4 position. My test called for 209 rows and 11 columns, and I was flummoxed for a bit until I started playing around with these variables. Am I missing something, or is it just a documentation inconsistancy? /edg Ed Greenberg __ Get Your Private, Free Email at http://www.hotmail.com