[Q maybe OT] forward
Hi all, maybe this is going to be a little off topic, but it won't take you much time: I am quite certain that recently I saw a server response code concerning forwarding. It may have looked like HTTP_DOCUMENT_FORWARDED or anything alike. Silly enough I can't recall where I saw it (or whether I even just dreamt it), so my questions are: 1. Has anyone ever seen that ghost before? 2. If I'm right, what is the correct memnonic, what's its code - and: where an I find it? perl5.6.1-Apache::Constants::Exports.pm doesn't mention it. Hope it wasn't all just a dream... thx M -- http://www.meome.de --- Martin Haase-Thomas |Tel.: +49 30 43730-558 meOme AG|Fax.: +49 30 43730-555 Software Development| [EMAIL PROTECTED] ---
full-featured online database apps
Does anyone know of a good customizable, user-friendly, online database application, preferably mod_perl-based? I want to migrate a small Access database to MySQL with a web interface, for added features and room for growth. Has anyone come across a good open source project or toolkit that would make this job really easy? TIA, -Adi
Re: startup for Apache 2.0/mod_perl 1.99
Chuck Goehring wrote: > Stas/Everyone, > > To follow up. With the starting and stopping of Apache and looking at the > log, I see entries like "Child 1032: Waiting for 250 worker threads to > exit." I was gettiong "Low virtual memory" errors from Win/2000, so I added > ThreadsPerChild 24 to the http.conf. This makes it stop quicker and use a > whole lot less memory. Also, the error at the browser comes back faster. Why did you have it set to 250 in first place? For testing set it to just a few to have the minimal overhead. __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: startup for Apache 2.0/mod_perl 1.99
Chuck Goehring wrote: > You're right. I'm getting impatient and jumping ahead. Pasted directly > from your post, restarted Apache and get same thing > > [Tue Apr 23 12:16:54 2002] [notice] Parent: Created child process 2560 > [Tue Apr 23 12:16:58 2002] [notice] Child 2560: Child process is running > [Tue Apr 23 12:16:58 2002] [notice] Child 2560: Acquired the start mutex. > [Tue Apr 23 12:16:58 2002] [notice] Child 2560: Starting 250 worker threads. > [Tue Apr 23 12:17:46 2002] [error] 2560: ModPerl::Registry: `Can't call > method "args" on an undefined value at c:/perl/5.6.1/lib/CGI.pm line 433. > > It is referring to the IF statement: >if ($MOD_PERL) { >$query_string = Apache->request->args; >} else { >$query_string = $ENV{'QUERY_STRING'} if defined $ENV{'QUERY_STRING'}; >$query_string ||= $ENV{'REDIRECT_QUERY_STRING'} if defined > $ENV{'REDIRECT_QUERY_STRING'}; >} I know what was missing. add 'PerlOptions +GlobalRequest', like so: SetHandler perl-script PerlResponseHandler ModPerl::Registry Options ExecCGI PerlSendHeader On PerlOptions +GlobalRequest http://perl.apache.org/preview/modperl-docs/dst_html/docs/2.0/user/config/config.html#PerlOptions_Directive # GlobalRequest Setup the global request_rec for use with Apache->request Sorry for missing this one, I'm not used to it yet :) Also I'd like to repeat that the 2.0 test suite is the best place to learn how, before the docs will be completed. __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: startup for Apache 2.0/mod_perl 1.99
Stas/Everyone, To follow up. With the starting and stopping of Apache and looking at the log, I see entries like "Child 1032: Waiting for 250 worker threads to exit." I was gettiong "Low virtual memory" errors from Win/2000, so I added ThreadsPerChild 24 to the http.conf. This makes it stop quicker and use a whole lot less memory. Also, the error at the browser comes back faster. I added use "Apache::compat;" to the test program after "use ModPerl::Registry;" hoping it would stop it from complaining about CGI.pm. But, I still get Error 500 in the browser and "[error] 2724: ModPerl::Registry: `Can't call method "args" on an undefined value at c:/perl/5.6.1/lib/CGI.pm line 433." in the log. The build I'm using is modperl-2.0_2002042700.tar.gz. I tried adding PerlModule Apache2 to http.conf right after "LoadModule perl_module modules/mod_perl.so" and I get a "Application Error/memory could not be read". The same CGI.pm error appears in the log. Also, the CGI.pm I have is dated 03/03/2001 and came with perl 5.6.1. Thanks Chuck - Original Message - From: "Stas Bekman" <[EMAIL PROTECTED]> To: "Chuck Goehring" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, April 23, 2002 11:12 AM Subject: Re: startup for Apache 2.0/mod_perl 1.99 > Chuck Goehring wrote: > > Stas, > > First, there was no mod_perl 1.2x installed on this machine. I didn't think > > I would need it, but I'm guessing. > > > > This was as you say. The didn't aggree with the registry > > loaded in startup. That fixed that problem but now it complains about > > CGI.pm as follows: > > > > [Tue Apr 23 10:10:00 2002] [error] 2676: ModPerl::Registry: `Can't call > > method "args" on an undefined value at c:/perl/5.6.1/lib/CGI.pm line 433. > > It's a very bad idea to try to find the problem without reducing the > setup to a bare minimum. > > Does the very basic setup work for you? If it does, start from here and > add things till you hit the problem. > > httpd.conf: > --- > LoadModule perl_module modules/mod_perl.so > Alias /perl e:/Apache2/cgi-perl > PerlRequire e:\apache2\conf\startup.cgi > > >SetHandler perl-script >PerlResponseHandler ModPerl::Registry >Options ExecCGI >PerlSendHeader On > > > startup.pl: > --- > #! /perl/5.6.1/bin/MSWin32-x86-multi-thread/perl.exe -w > > use strict; > use Apache2 (); > use Apache::compat; > > and a test script: > #! c:/perl/5.6.1/bin/MSWin32-x86-multi-thread/perl.exe -w > use ModPerl::Registry; > use CGI; > > $q = new CGI; > > print $q->header, >$q->start_html(), >'Hello', >$q->end_html(); > > > __ > Stas BekmanJAm_pH --> Just Another mod_perl Hacker > http://stason.org/ mod_perl Guide ---> http://perl.apache.org > mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com > http://modperlbook.org http://apache.org http://ticketmaster.com >
Re: Installing mod_perl 1.26 - URI::URL error
On Tue, 23 Apr 2002, Silvio Wanka wrote: > Stas Bekman wrote: > > > > Einar Roheim wrote: > > > At 17:00 4/23/2002 +0800, you wrote: > > > > > >> Einar Roheim wrote: > > >> > > >>> Hi everyone, > > >>> > > >>> I have a problem installing mod_perl 1.26 with Apache 1.3.24. When I > > >>> do the "make test" I'm getting this in the end before it aborts: > > >> > > >> > > >> You have a mismatching version of LWP and URI packages, update both > > >> and the problem should disappear. > > > > > > > > > I did a "force install" on both of them (since I had the last version), > > > but I still have the same problem. > > > > > > How can this mismatch happen? > > > > Well I had this problem with lwp 5.64 and URI 1.09, after upgrading to > > libwww-perl 5.64 and URI 1.1 the problem has disappeared. > > Maybe with URI 1.1 but not with the current 1.11 Perhaps you have two different URI modules on your system? Is your mod_perl installation using the same library directories (@INC) as you used when you did the "force install"? This can happen if you update your system perl after installing mod_perl. Andrew McNaughton
Re: two distinct installations
Certainly. You can run as many separate apache instances as you want, each with it's own configuration. These cannot share the same IP/port directly, but If you want these to share the same server name space then you can set up an apache instance which proxies requests to different servers as appropriate. That said, I'm not sure why you'd want to do this. Usually the things you need to run as root are not the things you need mod_perl's speed for. I suspect you might be better to look at whether you could use cgi scripts run through a suid wrapper. Andrew McNaughton On Tue, 23 Apr 2002, Carlo Giomini wrote: > Date: Tue, 23 Apr 2002 12:28:24 +0200 (MEST) > From: Carlo Giomini <[EMAIL PROTECTED]> > To: [EMAIL PROTECTED] > Subject: two distinct installations > > Hi there! > I wonder if it is possible to have two distinct installations of mod_perl > on the same machine, let's say one made as root user and another as > normal user. > Thanks for helping, > Carlo. > > >
Re: [SOT] C/F77 Wrapper for Perl
Hi there, On Tue, 23 Apr 2002, Vuillemot, Ward W wrote: > Is it possible to write a simple C wrapper to the f77 library, and then link > to Perl as a module? Have a look at Inline.pm. 73, Ged.
Applications/Products compatible with/running under mod_perl?
Hi, For the mod_perl site I've started collecting different applications which run under mod_perl (either required or under Apache::Registry as a complement to CGI). I was thinking more in the way of things like content management systems, entire applications, we already know about all our application toolkits :) I was wondering if anyone knows of any products like this. Just come on with URLs and I'll check them out. Send them either directly to me or to the docs-dev list, and I'll review them quickly. Thank you for your time. -- Per Einar Ellefsen [EMAIL PROTECTED]
Re: Q & A: $r->custom_response
At 22:04 23.04.2002, Perrin Harkins wrote: >Per Einar Ellefsen wrote: >>I suppose Apache::Constants could have been extended to return globals if >>requested... But is there really any gain in that? > >Only in that people will not get tripped up by the possible bugs that >using subroutines as constants causes. I guess Apache::Constants is >difficult to replace, so everyone will just have to keep an eye out for >this sort of problem. Agreed. I'll add a warning in the docs for Apache::Constants which might help out in the future. -- Per Einar Ellefsen [EMAIL PROTECTED]
hub.org "virtual machine" for mod_perl?
Does anyone of the list have experience with using hub.org's "virtual machine" setup for a mod_perl site? I'm doing a "proof of concept" site for a new business that needs to be hosted somewhere other than my machine at home for people to bang on, and I don't want to pay for a dedicated server before I'm sure that we're ready. I'm an OO perl person, so just running things as a CGI gets pretty slow as the traffic increases. -- Barry Hoggard Tristan Media LLC e: [EMAIL PROTECTED] p: 212-627-1596 aim: hoggardb
Re: Q & A: $r->custom_response
Per Einar Ellefsen wrote: > I suppose Apache::Constants could have been extended to return globals > if requested... But is there really any gain in that? Only in that people will not get tripped up by the possible bugs that using subroutines as constants causes. I guess Apache::Constants is difficult to replace, so everyone will just have to keep an eye out for this sort of problem. - Perrin
Re: startup for Apache 2.0/mod_perl 1.99
You're right. I'm getting impatient and jumping ahead. Pasted directly from your post, restarted Apache and get same thing [Tue Apr 23 12:16:54 2002] [notice] Parent: Created child process 2560 [Tue Apr 23 12:16:58 2002] [notice] Child 2560: Child process is running [Tue Apr 23 12:16:58 2002] [notice] Child 2560: Acquired the start mutex. [Tue Apr 23 12:16:58 2002] [notice] Child 2560: Starting 250 worker threads. [Tue Apr 23 12:17:46 2002] [error] 2560: ModPerl::Registry: `Can't call method "args" on an undefined value at c:/perl/5.6.1/lib/CGI.pm line 433. It is referring to the IF statement: if ($MOD_PERL) { $query_string = Apache->request->args; } else { $query_string = $ENV{'QUERY_STRING'} if defined $ENV{'QUERY_STRING'}; $query_string ||= $ENV{'REDIRECT_QUERY_STRING'} if defined $ENV{'REDIRECT_QUERY_STRING'}; } In CGI>pm up at line 148 there is this: # Turn on special checking for Doug MacEachern's modperl if (exists $ENV{'GATEWAY_INTERFACE'} && ($MOD_PERL = $ENV{'GATEWAY_INTERFACE'} =~ /^CGI-Perl\//)) { $| = 1; require Apache; } Do I need to define 'GATEWAY_INTERFACE', or is it provided automatically by mod_perl? This is on Win2000. Thanks Chuck - Original Message - From: "Stas Bekman" <[EMAIL PROTECTED]> To: "Chuck Goehring" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, April 23, 2002 11:12 AM Subject: Re: startup for Apache 2.0/mod_perl 1.99 > Chuck Goehring wrote: > > Stas, > > First, there was no mod_perl 1.2x installed on this machine. I didn't think > > I would need it, but I'm guessing. > > > > This was as you say. The didn't aggree with the registry > > loaded in startup. That fixed that problem but now it complains about > > CGI.pm as follows: > > > > [Tue Apr 23 10:10:00 2002] [error] 2676: ModPerl::Registry: `Can't call > > method "args" on an undefined value at c:/perl/5.6.1/lib/CGI.pm line 433. > > It's a very bad idea to try to find the problem without reducing the > setup to a bare minimum. > > Does the very basic setup work for you? If it does, start from here and > add things till you hit the problem. > > httpd.conf: > --- > LoadModule perl_module modules/mod_perl.so > Alias /perl e:/Apache2/cgi-perl > PerlRequire e:\apache2\conf\startup.cgi > > >SetHandler perl-script >PerlResponseHandler ModPerl::Registry >Options ExecCGI >PerlSendHeader On > > > startup.pl: > --- > #! /perl/5.6.1/bin/MSWin32-x86-multi-thread/perl.exe -w > > use strict; > use Apache2 (); > use Apache::compat; > > and a test script: > #! c:/perl/5.6.1/bin/MSWin32-x86-multi-thread/perl.exe -w > use ModPerl::Registry; > use CGI; > > $q = new CGI; > > print $q->header, >$q->start_html(), >'Hello', >$q->end_html(); > > > __ > Stas BekmanJAm_pH --> Just Another mod_perl Hacker > http://stason.org/ mod_perl Guide ---> http://perl.apache.org > mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com > http://modperlbook.org http://apache.org http://ticketmaster.com >
Re: Installing mod_perl 1.26 - URI::URL error
Silvio Wanka wrote: BTW, have you tried the latest mod_perl CVS? I think your problem has been solved long time ago. Sometimes I forget that others don't use the cvs version all the time :) From Changes: =item 1.26_01-dev ... require URI::URL to work with newer libwww-perl ... > Stas Bekman wrote: > >>Einar Roheim wrote: >> >>>At 17:00 4/23/2002 +0800, you wrote: >>> >>> Einar Roheim wrote: >Hi everyone, > >I have a problem installing mod_perl 1.26 with Apache 1.3.24. When I >do the "make test" I'm getting this in the end before it aborts: You have a mismatching version of LWP and URI packages, update both and the problem should disappear. >>> >>> >>>I did a "force install" on both of them (since I had the last version), >>>but I still have the same problem. >>> >>> >>>As Nicolai Schlenzig said, I can add "use URI::URL;" to these files: >>> >>>mod_perl-x.xx/t/internal/hooks.t >>>mod_perl-x.xx/lib/Apache/test.pm >>>mod_perl-x.xx/blib/Apache/test.pm >>> >>>But I still have the mismatch that you talked about. Don't I? >>> >>>How can this mismatch happen? >> >>Well I had this problem with lwp 5.64 and URI 1.09, after upgrading to >>libwww-perl 5.64 and URI 1.1 the problem has disappeared. > > > Maybe with URI 1.1 but not with the current 1.11 > > >>[...] >>-- >>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 > > > The patch at the end solves the problems, the tests are running > but you get error messages in one of the URI modules, that a undefined > value is used. > > Regards, Silvio > > --- lib/Apache/test.pm~ Wed Feb 14 23:57:08 2001 > +++ lib/Apache/test.pmFri Feb 22 18:57:13 2002 > @@ -5,6 +5,12 @@ > use Exporter (); > use Config; > use FileHandle (); > + > +use URI::URL (); > +sub URI::WithBase::can { > +return UNIVERSAL::can(@_) || UNIVERSAL::can($_[0]->[0], $_[1]); > +} > + > *import = \&Exporter::import; > > @EXPORT = qw(test fetch simple_fetch have_module skip_test > --- t/internal/hooks.t~ Thu Jan 21 00:16:38 1999 > +++ t/internal/hooks.tFri Feb 22 18:46:53 2002 > @@ -7,6 +7,7 @@ > use ExtUtils::testlib; > BEGIN { require "net/config.pl"; } > require LWP::UserAgent; > +require URI::URL; > > #first one queries httpd for enabled hooks, > #generating a hook::handler() for each and writing t/docs/.htaccess > @@ -29,7 +30,7 @@ > foreach $loc (@urls) { > $url = new URI::URL("http://$net::httpserver$loc";); > > -$request = new HTTP::Request('GET', $url); > +$request = new HTTP::Request('GET', "$url"); > > print "GET $url\n\n"; -- __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: startup for Apache 2.0/mod_perl 1.99
Chuck Goehring wrote: > Stas, > First, there was no mod_perl 1.2x installed on this machine. I didn't think > I would need it, but I'm guessing. > > This was as you say. The didn't aggree with the registry > loaded in startup. That fixed that problem but now it complains about > CGI.pm as follows: > > [Tue Apr 23 10:10:00 2002] [error] 2676: ModPerl::Registry: `Can't call > method "args" on an undefined value at c:/perl/5.6.1/lib/CGI.pm line 433. It's a very bad idea to try to find the problem without reducing the setup to a bare minimum. Does the very basic setup work for you? If it does, start from here and add things till you hit the problem. httpd.conf: --- LoadModule perl_module modules/mod_perl.so Alias /perl e:/Apache2/cgi-perl PerlRequire e:\apache2\conf\startup.cgi SetHandler perl-script PerlResponseHandler ModPerl::Registry Options ExecCGI PerlSendHeader On startup.pl: --- #! /perl/5.6.1/bin/MSWin32-x86-multi-thread/perl.exe -w use strict; use Apache2 (); use Apache::compat; and a test script: #! c:/perl/5.6.1/bin/MSWin32-x86-multi-thread/perl.exe -w use ModPerl::Registry; use CGI; $q = new CGI; print $q->header, $q->start_html(), 'Hello', $q->end_html(); __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Q & A: $r->custom_response
At 19:51 23.04.2002, Perrin Harkins wrote: >Per Einar Ellefsen wrote: >>Well, this one is exported by Apache::Constants, so if you don't want to do >>$FORBIDDEN = FORBIDDEN; >>somewhere at the top of your code, you're bound to continue using >>constants, right? > >That's still safer. I used the constants pragma on a big project and I >saw people get bitten by $hash{CONSTANT} and "string interp CONSTANT" as >well as the aforementioned CONSTANT => value problem. It's just asking >for trouble, in my opinion. > >Can anyone tell us if the Apache::Constants all just standard HTTP >response codes, or are some of them actually Apache-specific? Apache::Constants gets them from httpd.h. Here is the expert: #define HTTP_CONTINUE 100 #define HTTP_SWITCHING_PROTOCOLS 101 #define HTTP_PROCESSING102 #define HTTP_OK200 #define HTTP_CREATED 201 #define HTTP_ACCEPTED 202 #define HTTP_NON_AUTHORITATIVE 203 #define HTTP_NO_CONTENT204 #define HTTP_RESET_CONTENT 205 #define HTTP_PARTIAL_CONTENT 206 #define HTTP_MULTI_STATUS 207 #define HTTP_MULTIPLE_CHOICES 300 #define HTTP_MOVED_PERMANENTLY 301 #define HTTP_MOVED_TEMPORARILY 302 #define HTTP_SEE_OTHER 303 #define HTTP_NOT_MODIFIED 304 #define HTTP_USE_PROXY 305 #define HTTP_TEMPORARY_REDIRECT307 #define HTTP_BAD_REQUEST 400 #define HTTP_UNAUTHORIZED 401 #define HTTP_PAYMENT_REQUIRED 402 #define HTTP_FORBIDDEN 403 #define HTTP_NOT_FOUND 404 #define HTTP_METHOD_NOT_ALLOWED405 #define HTTP_NOT_ACCEPTABLE406 #define HTTP_PROXY_AUTHENTICATION_REQUIRED 407 #define HTTP_REQUEST_TIME_OUT 408 #define HTTP_CONFLICT 409 #define HTTP_GONE 410 #define HTTP_LENGTH_REQUIRED 411 #define HTTP_PRECONDITION_FAILED 412 #define HTTP_REQUEST_ENTITY_TOO_LARGE 413 #define HTTP_REQUEST_URI_TOO_LARGE 414 #define HTTP_UNSUPPORTED_MEDIA_TYPE415 #define HTTP_RANGE_NOT_SATISFIABLE 416 #define HTTP_EXPECTATION_FAILED417 #define HTTP_UNPROCESSABLE_ENTITY 422 #define HTTP_LOCKED423 #define HTTP_FAILED_DEPENDENCY 424 #define HTTP_INTERNAL_SERVER_ERROR 500 #define HTTP_NOT_IMPLEMENTED 501 #define HTTP_BAD_GATEWAY 502 #define HTTP_SERVICE_UNAVAILABLE 503 #define HTTP_GATEWAY_TIME_OUT 504 #define HTTP_VERSION_NOT_SUPPORTED 505 #define HTTP_VARIANT_ALSO_VARIES 506 #define HTTP_INSUFFICIENT_STORAGE 507 #define HTTP_NOT_EXTENDED 510 #define DOCUMENT_FOLLOWSHTTP_OK #define PARTIAL_CONTENT HTTP_PARTIAL_CONTENT #define MULTIPLE_CHOICESHTTP_MULTIPLE_CHOICES #define MOVED HTTP_MOVED_PERMANENTLY #define REDIRECTHTTP_MOVED_TEMPORARILY #define USE_LOCAL_COPY HTTP_NOT_MODIFIED #define BAD_REQUEST HTTP_BAD_REQUEST #define AUTH_REQUIRED HTTP_UNAUTHORIZED #define FORBIDDEN HTTP_FORBIDDEN #define NOT_FOUND HTTP_NOT_FOUND #define METHOD_NOT_ALLOWED HTTP_METHOD_NOT_ALLOWED #define NOT_ACCEPTABLE HTTP_NOT_ACCEPTABLE #define LENGTH_REQUIRED HTTP_LENGTH_REQUIRED #define PRECONDITION_FAILED HTTP_PRECONDITION_FAILED #define SERVER_ERRORHTTP_INTERNAL_SERVER_ERROR #define NOT_IMPLEMENTED HTTP_NOT_IMPLEMENTED #define BAD_GATEWAY HTTP_BAD_GATEWAY #define VARIANT_ALSO_VARIES HTTP_VARIANT_ALSO_VARIES So apparently, FORBIDDEN == HTTP_FORBIDDEN == 403. However, I wouldn't rely on any of this, because that's the reason behind constants: they hide what they really are! For example, we have this: #define DECLINED -1 /* Module declines to handle */ #define DONE -2 /* Module has served the response completely * - it's safe to die() with no more output */ #define OK 0/* Module has handled this stage. */ OK should therefore not be confused with HTTP_OK (many people seem to bite the bug and return 200, which isn't supposed to be right). I suppose Apache::Constants could have been extended to return globals if requested... But is there really any gain in that? -- Per Einar Ellefsen [EMAIL PROTECTED]
Re: Q & A: $r->custom_response
> Can anyone tell us if the Apache::Constants all just standard HTTP > response codes, or are some of them actually Apache-specific? > there are over 90 constants in Apache::Constants, which range from HTTP constants (like FORBIDDEN for 403) to Apache specific ones (like DECLINED for -1 and OPT_INCLUDES for 2). there is also stuff like SERVER_VERSION which is really a runtime call to ap_get_server_version(). --Geoff
Re: Q & A: $r->custom_response
Per Einar Ellefsen wrote: > Well, this one is exported by Apache::Constants, so if you don't want to do > $FORBIDDEN = FORBIDDEN; > somewhere at the top of your code, you're bound to continue using > constants, right? That's still safer. I used the constants pragma on a big project and I saw people get bitten by $hash{CONSTANT} and "string interp CONSTANT" as well as the aforementioned CONSTANT => value problem. It's just asking for trouble, in my opinion. Can anyone tell us if the Apache::Constants all just standard HTTP response codes, or are some of them actually Apache-specific? - Perrin
Re: startup for Apache 2.0/mod_perl 1.99
Stas, First, there was no mod_perl 1.2x installed on this machine. I didn't think I would need it, but I'm guessing. This was as you say. The didn't aggree with the registry loaded in startup. That fixed that problem but now it complains about CGI.pm as follows: [Tue Apr 23 10:10:00 2002] [error] 2676: ModPerl::Registry: `Can't call method "args" on an undefined value at c:/perl/5.6.1/lib/CGI.pm line 433. As you suggested, the use Apache::compat; is in startup. It had no effect. Here is location in http.conf LoadModule perl_module modules/mod_perl.so Alias /perl e:/Apache2/cgi-perl PerlRequire e:\apache2\conf\startup.cgi # Access.conf # Below for .js files AllowOverride FileInfo # Below changed from Set to Add to accomodate .js files # Vaguely recall some problem on newsgroups but? # don't use this one SetHandler perl-script AddHandler perl-script .cgi #PerlHandler Apache::Registry PerlHandler ModPerl::Registry PerlResponseHandler ModPerl::Registry Options ExecCGI allow from 206.128.139 PerlSendHeader On ==> Here is startup.cgi #! /perl/5.6.1/bin/MSWin32-x86-multi-thread/perl.exe -w use strict; #use Apache (); use Apache2 (); use Apache::compat; use ModPerl::Registry; use DBI(); use CGI qw(-compile :cgi); use Carp(); use DBI(); use CGI qw(-compile :cgi); 1; __END__ ===> Here's the test program: #! c:/perl/5.6.1/bin/MSWin32-x86-multi-thread/perl.exe -w use Apache2 (); use Apache::compat; use ModPerl::Registry;# use Apache::Registry; use CGI qw/:standard :html3/; use CGI::Carp qw(fatalsToBrowser); use DBI(); # use Apache::DBI(); $cgiOBJ = new CGI; $dataSource = "dbi:Oracle:dis.world"; # put your DSN here $dataSource = "dbi:Oracle:rciora"; # put your DSN here $userName = 'terminals'; # you know what goes here $password = ''; # and here $dbh = DBI->connect($dataSource, $userName, $password) or die $DBI::errstr; print $cgiOBJ->header(-expires=>'-1d'), $cgiOBJ->start_html(-TITLE=>'oracle test.pl', -BGCOLOR=>'#FF'); print "start here"; $sql = "SELECT * FROM terminals.assets where substr(asset_part_no,1,1) = 'B'"; $sth = $dbh->prepare($sql) || die $dbh->errstr; $rc = $sth->execute || die $sth->errstr; while (($firstField, $anotherField) = $sth->fetchrow_array){ print "$firstField: $anotherField\n"; } warn $DBI::errstr if $DBI::err; $sth->finish; $dbh->disconnect; print "end here"; print $cgiOBJ->end_html; Thanks for any input. Chuck - Original Message - From: "Stas Bekman" <[EMAIL PROTECTED]> To: "Chuck Goehring" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, April 22, 2002 7:26 PM Subject: Re: startup for Apache 2.0/mod_perl 1.99 > Chuck Goehring wrote: > > To all, > > > > > > > > Having trouble configuring Apache 2.0 with mod_perl. Don't know if I > > need compat or not. > > > > > > > > My Apache 1.x/mod_perl 1.24 startup starts like this: > > > > > > > > use strict; > > use Apache (); > > use Apache::Registry; > > use Apache::DBI(); > > use CGI qw(-compile :cgi); > > use Carp(); > > > > > > > > That didn't fly on Apache 2.0.35/mod_perl 1.99 (snapshot). Trying to > > get something equivalent working. > > If you want to use the old registry, the above missing: > > use Apache2 (); > use Apache::compat; > > > Below doesn't work with or without > > Apache::compat. > > > > > > > > use strict; > > use Apache2 (); > > use Apache::compat; > > use ModPerl::Registry;# use Apache::Registry; > > > > #use Apache2::DBI(); # use Apache::DBI(); > > use DBI(); > > use CGI qw(-compile :cgi); > > looks good to me. You don't show your config. Does it include > >SetHandler perl-script >PerlResponseHandler ModPerl::Registry > > ?? > > > Apache error log id like so (last line): > > > > [Mon Apr 22 18:00:58 2002] [error] failed to resolve handler > > `Apache::Registry' > > Apache::Registry? Above you said you are using ModPerl::Registry. Check > your config. I suggest to grep for Apache::Registry. > > Apache::DBI (for 2.0 wasn't ported yet, and available for those seeking > interesting challenges) > > __ > Stas BekmanJAm_pH --> Just Another mod_perl Hacker > http://stason.org/ mod_perl Guide ---> http://perl.apache.org > mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com > http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Q & A: $r->custom_response
At 19:38 23.04.2002, Perrin Harkins wrote: >Issac Goldstand wrote: >>Reposting a question (and the answer) that geoff and I discussed in the >>IRC room, as I think it's worthwhile to mention... >>I had the following line of code (actually many of the sort): >>$r->custom_response(FORBIDDEN=>"File size exceeds quota."); >>And kept getting errors like: >>[Tue Apr 23 19:46:14 2002] null: Argument "FORBIDDEN" isn't numeric in >>subroutine entry at /usr/local/httpd/lib/perl/Mine/Pic/Application.pm >>line 1343. >>The answer to the problem is that by using '=>' instead of ',', I was >>making 'FORBIDDEN' become '"FORBIDDEN"' (string instead of numeric 403). >>Moral of the story: don't use => with Apache::Constants! > >In fact, don't use constants at all. At least not the kind created by the >"use constants" pragma and similar tricks. They have all kinds of >problems like this. Use package variables instead ($FORBIDDEN). Maybe >some day Perl will have real constants, but I'm perfectly happy with >package variables in the meantime. Well, this one is exported by Apache::Constants, so if you don't want to do $FORBIDDEN = FORBIDDEN; somewhere at the top of your code, you're bound to continue using constants, right? -- Per Einar Ellefsen [EMAIL PROTECTED]
Re: Q & A: $r->custom_response
At 19:29 23.04.2002, Issac Goldstand wrote: >Reposting a question (and the answer) that geoff and I discussed in the >IRC room, as I think it's worthwhile to mention... > >I had the following line of code (actually many of the sort): >$r->custom_response(FORBIDDEN=>"File size exceeds quota."); > >And kept getting errors like: >[Tue Apr 23 19:46:14 2002] null: Argument "FORBIDDEN" isn't numeric in >subroutine entry at /usr/local/httpd/lib/perl/Mine/Pic/Application.pm line >1343. > >The answer to the problem is that by using '=>' instead of ',', I was >making 'FORBIDDEN' become '"FORBIDDEN"' (string instead of numeric 403). > >Moral of the story: don't use => with Apache::Constants! Or you can use &FORBIDDEN or FORBIDDEN() or +FORBIDDEN, which are another fix if you want to continue using =>. -- Per Einar Ellefsen [EMAIL PROTECTED]
Re: Q & A: $r->custom_response
Issac Goldstand wrote: > Reposting a question (and the answer) that geoff and I discussed in the > IRC room, as I think it's worthwhile to mention... > > I had the following line of code (actually many of the sort): > $r->custom_response(FORBIDDEN=>"File size exceeds quota."); > > And kept getting errors like: > [Tue Apr 23 19:46:14 2002] null: Argument "FORBIDDEN" isn't numeric in > subroutine entry at /usr/local/httpd/lib/perl/Mine/Pic/Application.pm > line 1343. > > The answer to the problem is that by using '=>' instead of ',', I was > making 'FORBIDDEN' become '"FORBIDDEN"' (string instead of numeric 403). > > Moral of the story: don't use => with Apache::Constants! In fact, don't use constants at all. At least not the kind created by the "use constants" pragma and similar tricks. They have all kinds of problems like this. Use package variables instead ($FORBIDDEN). Maybe some day Perl will have real constants, but I'm perfectly happy with package variables in the meantime. - Perrin
Q & A: $r->custom_response
Reposting a question (and the answer) that geoff and I discussed in the IRC room, as I think it's worthwhile to mention... I had the following line of code (actually many of the sort): $r->custom_response(FORBIDDEN=>"File size exceeds quota."); And kept getting errors like: [Tue Apr 23 19:46:14 2002] null: Argument "FORBIDDEN" isn't numeric in subroutine entry at /usr/local/httpd/lib/perl/Mine/Pic/Application.pm line 1343. The answer to the problem is that by using '=>' instead of ',', I was making 'FORBIDDEN' become '"FORBIDDEN"' (string instead of numeric 403). Moral of the story: don't use => with Apache::Constants! Hope this helps some of you... Issac
Re: Installing mod_perl 1.26 - URI::URL error
Stas Bekman wrote: > > Einar Roheim wrote: > > At 17:00 4/23/2002 +0800, you wrote: > > > >> Einar Roheim wrote: > >> > >>> Hi everyone, > >>> > >>> I have a problem installing mod_perl 1.26 with Apache 1.3.24. When I > >>> do the "make test" I'm getting this in the end before it aborts: > >> > >> > >> You have a mismatching version of LWP and URI packages, update both > >> and the problem should disappear. > > > > > > I did a "force install" on both of them (since I had the last version), > > but I still have the same problem. > > > > > > As Nicolai Schlenzig said, I can add "use URI::URL;" to these files: > > > > mod_perl-x.xx/t/internal/hooks.t > > mod_perl-x.xx/lib/Apache/test.pm > > mod_perl-x.xx/blib/Apache/test.pm > > > > But I still have the mismatch that you talked about. Don't I? > > > > How can this mismatch happen? > > Well I had this problem with lwp 5.64 and URI 1.09, after upgrading to > libwww-perl 5.64 and URI 1.1 the problem has disappeared. Maybe with URI 1.1 but not with the current 1.11 > [...] > -- > 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 The patch at the end solves the problems, the tests are running but you get error messages in one of the URI modules, that a undefined value is used. Regards, Silvio --- lib/Apache/test.pm~ Wed Feb 14 23:57:08 2001 +++ lib/Apache/test.pm Fri Feb 22 18:57:13 2002 @@ -5,6 +5,12 @@ use Exporter (); use Config; use FileHandle (); + +use URI::URL (); +sub URI::WithBase::can { +return UNIVERSAL::can(@_) || UNIVERSAL::can($_[0]->[0], $_[1]); +} + *import = \&Exporter::import; @EXPORT = qw(test fetch simple_fetch have_module skip_test --- t/internal/hooks.t~ Thu Jan 21 00:16:38 1999 +++ t/internal/hooks.t Fri Feb 22 18:46:53 2002 @@ -7,6 +7,7 @@ use ExtUtils::testlib; BEGIN { require "net/config.pl"; } require LWP::UserAgent; +require URI::URL; #first one queries httpd for enabled hooks, #generating a hook::handler() for each and writing t/docs/.htaccess @@ -29,7 +30,7 @@ foreach $loc (@urls) { $url = new URI::URL("http://$net::httpserver$loc";); -$request = new HTTP::Request('GET', $url); +$request = new HTTP::Request('GET', "$url"); print "GET $url\n\n";
Re: framesets/AuthCookie question
On Mon, 22 Apr 2002, Fran Fabrizio wrote: > It seems that even if AuthCookie returns a FORBIDDEN with a custom_error > page set, the $r->notes() don't propagate. Does apache consider the > display of the custom_response page to be a completely new request? Its a subrequest, so the notes shold be in $r->prev->notes(). Mike
Apache::RPC::Server basic config problem
Hi All, I'm trying to get a basic test install of Apache::RPC::Server running on my system, but I'm getting an error which I haven't been able to sort out. I've got all the RPC::XML bits installed ok and the server minimally configured according to the synopsis on the man page: In startup.pl: use Apache::RPC::Server(); In httpd.conf: PerlSetVar RpcMethodDir/usr/local/apache/lib/perl/Apache/procs PerlChildInitHandlerApache::RPC::Server->init_handler SetHandler perl-script PerlHandler Apache::RPC::Server Order deny,allow Allow from all But when I run the client which is only: #!/usr/bin/perl -w require RPC::XML; require RPC::XML::Client; my $client = RPC::XML::Client->new('http://localhost/RPC'); my $request = $client->request("hello"); my $resp = $client->simple_request($request); if ($resp) { print $resp, "\n"; } else { print $RPC::XML::ERROR, "\n"; } I get: RPC::XML::Client::simple_request: RPC::XML::Client:send_request: HTTP server error: Internal Server Error In error_log I get: [Mon Apr 22 23:09:42 2002] [error] Can't locate object method "server_hostname" via package "Apache" (perhaps you forgot to load "Apache"?) at /usr/local/lib/perl5/site_perl/5.6.1/Apache/RPC/Server.pm line 247. The rest of my mod_perl applications on the server still run fine, so I didn't forget Apache, and the server make no complaints at startup. Can anyone point me in the right direction? Thank in advance, Bill Config: RH linux 7.2/intel (apache and perl not included in the install) apache 1.3.22 mod_perl 1.26 perl 5.6.1
Re: Installing mod_perl 1.26 - URI::URL error
I had the similar problem on Solaris about a week ago. I just added manually two 'use URI::URL' to the appropriate test sources (sorry, do not remember exactly the module names). I'm fine since then. Best regards, Slava - Original Message - From: "Einar Roheim" <[EMAIL PROTECTED]> To: "Stas Bekman" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, April 23, 2002 5:30 AM Subject: Re: Installing mod_perl 1.26 - URI::URL error > At 17:00 4/23/2002 +0800, you wrote: > >Einar Roheim wrote: > >>Hi everyone, > >> > >>I have a problem installing mod_perl 1.26 with Apache 1.3.24. When I do > >>the "make test" I'm getting this in the end before it aborts: > > > >You have a mismatching version of LWP and URI packages, update both and > >the problem should disappear. > > I did a "force install" on both of them (since I had the last version), but > I still have the same problem. > > > As Nicolai Schlenzig said, I can add "use URI::URL;" to these files: > > mod_perl-x.xx/t/internal/hooks.t > mod_perl-x.xx/lib/Apache/test.pm > mod_perl-x.xx/blib/Apache/test.pm > > But I still have the mismatch that you talked about. Don't I? > > How can this mismatch happen? > > > > >>make[1]: Leaving directory `/usr/local/src/mod_perl-1.26/Util' > >>cp t/conf/mod_perl_srm.conf t/conf/srm.conf > >>../apache_1.3.24/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...\c > >>done > >>/usr/local/bin/perl t/TEST 0 > >>Can't locate object method "new" via package "URI::URL" (perhaps you > >>forgot to load "URI::URL"?) at ../blib/lib/Apache/test.pm line 252. > >>make: *** [run_tests] Error 255 > >> > >>The strange thing is that I installed it on my test-server that has the > >>same software (SuSE Linux 7.3 Pro / Apache 1.3.24 / mod_perl 1.24) and it > >>worked like a dream. The only difference is the hardware. The test-server > >>is a PIII with EIDE-disks and the big server (with the problem) has dual > >>PIII with SCSI-disks and more memory. > > > >probably not exactly the same sw. > > > >>The server is registered in the DNS. > >> > >>Thanks in advance ... > >>Einar > > > > > > > >-- > > > > > >__ > >Stas BekmanJAm_pH --> Just Another mod_perl Hacker > >http://stason.org/ mod_perl Guide ---> http://perl.apache.org > >mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com > >http://modperlbook.org http://apache.org http://ticketmaster.com > > > >
Re: SOLVED: Problem using Perl Modules under mod_perl
>>>Nice, but see below >>> somescript.pl --- #!/usr/bin/perl -wT use strict; use lib "."; use lib_netContest; use DBI; use CGI (qw:standard:); use vars qw(%c $config_module $db_handle); my $r = shift; if (defined $r && $r->dir_config('ConfigMod')) { $config_module = $r->dir_config('ConfigMod'); } else { use netContestConfig; $config_module = "netContestConfig"; } >>> >>>it's rather unusual to see use() inside the conditional code, >>>since use() is a compile time directive. meaning that netContestConfig >>>will be always loaded no matter if $r->dir_config('ConfigMod') returns >>>something or not. >>> >>>You probably want to s/use/require/. require() is a runtime directive. >>>Or move 'use netContestConfig;" to the top, so it'll be clear that it >>>always gets loaded. >> >> >> Good point, thanks! I will require the module to save the overhead of >> loading both configuration modules but using only one. Although the >> overhead should not be too big, if the "used but unused" module is >> emtpy... > > Uhm, it has nothing to do with the overhead. use() is almost the same > as require() but is run at compile time. I know, but since require works inside conditional code, i can prevent loading the module I don't need (netContestConfig), if I use another module for configuration under mod_perl. That's what I mean with "saving overhead". Ciao Sören -- netendance GmbH Sören Stuckenbrock Fränkische Straße 38 30455 Hannover Telefon: 49 (0) 511/4733773 Fax: 49 (0) 511/4733776 Mobil : 49 (0) 173/6000319 http://www.netendance.de
[SOT] C/F77 Wrapper for Perl
Since I have been unable to use Open3 effectively on my Win32, I am looking for some alternatives. BTW, one of my goals is to make the scripts relatively platform independent -- and therefore I am leaving Open3 and its IPC::Run cousin behind. I have a set of f77 libraries that I know can be compiled on a variety of platforms (Win, UN*X, Mac). For now, I have created an executable on my Win32, whereby it takes STDIN for input and returns results as STDOUT. Is it possible to write a simple C wrapper to the f77 library, and then link to Perl as a module? I have never written a lick of code other than "Hello, World!", and I am not looking to be an expert in C. I just want to get the libraries up and functioning. I know this may not be the best place to ask. . .but I thought others might have a fair amount experience with IPC in its many forms. . . ANY HELP IS APPRECIATED! Thanks! Ward
Re: Installing mod_perl 1.26 - URI::URL error
Einar Roheim wrote: > At 17:00 4/23/2002 +0800, you wrote: > >> Einar Roheim wrote: >> >>> Hi everyone, >>> >>> I have a problem installing mod_perl 1.26 with Apache 1.3.24. When I >>> do the "make test" I'm getting this in the end before it aborts: >> >> >> You have a mismatching version of LWP and URI packages, update both >> and the problem should disappear. > > > I did a "force install" on both of them (since I had the last version), > but I still have the same problem. > > > As Nicolai Schlenzig said, I can add "use URI::URL;" to these files: > > mod_perl-x.xx/t/internal/hooks.t > mod_perl-x.xx/lib/Apache/test.pm > mod_perl-x.xx/blib/Apache/test.pm > > But I still have the mismatch that you talked about. Don't I? > > How can this mismatch happen? Well I had this problem with lwp 5.64 and URI 1.09, after upgrading to libwww-perl 5.64 and URI 1.1 the problem has disappeared. >>> make[1]: Leaving directory `/usr/local/src/mod_perl-1.26/Util' >>> cp t/conf/mod_perl_srm.conf t/conf/srm.conf >>> ../apache_1.3.24/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...\c >>> done >>> /usr/local/bin/perl t/TEST 0 >>> Can't locate object method "new" via package "URI::URL" (perhaps you >>> forgot to load "URI::URL"?) at ../blib/lib/Apache/test.pm line 252. >>> make: *** [run_tests] Error 255 >>> >>> The strange thing is that I installed it on my test-server that has >>> the same software (SuSE Linux 7.3 Pro / Apache 1.3.24 / mod_perl >>> 1.24) and it worked like a dream. The only difference is the >>> hardware. The test-server is a PIII with EIDE-disks and the big >>> server (with the problem) has dual PIII with SCSI-disks and more memory. >> >> >> probably not exactly the same sw. -- __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: SOLVED: Problem using Perl Modules under mod_perl
Sören Stuckenbrock wrote: >>Nice, but see below >> >>>somescript.pl >>>--- >>>#!/usr/bin/perl -wT >>>use strict; >>>use lib "."; >>>use lib_netContest; >>>use DBI; >>>use CGI (qw:standard:); >>> >>>use vars qw(%c $config_module $db_handle); >>> >>>my $r = shift; >>> >>>if (defined $r && $r->dir_config('ConfigMod')) { >>> $config_module = $r->dir_config('ConfigMod'); >>>} >>>else { >>> use netContestConfig; >>> $config_module = "netContestConfig"; >>>} >> >>it's rather unusual to see use() inside the conditional code, >>since use() is a compile time directive. meaning that netContestConfig >>will be always loaded no matter if $r->dir_config('ConfigMod') returns >>something or not. >> >>You probably want to s/use/require/. require() is a runtime directive. >>Or move 'use netContestConfig;" to the top, so it'll be clear that it >>always gets loaded. > > > Good point, thanks! I will require the module to save the overhead of > loading both configuration modules but using only one. Although the overhead > should not be too big, if the "used but unused" module is emtpy... Uhm, it has nothing to do with the overhead. use() is almost the same as require() but is run at compile time. You probably need to read: http://perl.apache.org/guide/perl.html#use_require_do_INC_and perldoc -f use perldoc -f require -- __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: two distinct installations
> I wonder if it is possible to have two distinct installations of mod_perl > on the same machine, let's say one made as root user and another as > normal user. Also see Stas' article, "Installing mod_perl without superuser privileges", at http://www.perl.com/pub/a/2002/04/10/mod_perl.html --Ade.
Re: Global (to page) variables under Apache::ASP
Simon Oliver wrote: > The Apache::ASP mailing list is at [EMAIL PROTECTED] ... please subscribe to it to post questions on this topic by emailing [EMAIL PROTECTED] Apache::ASP dev issues are officially off-topic on the mod_perl list now. More below on this issue... > In my httpd.conf I have set 'PerlSetVar UseStrict 1' because I always use > sctict anyway and I see in the docs that this might become the default > too. So I always declare my variables with my(). > > Suppose I have a master ASP file that includes other scripts and these > other scripts need access to the variables declrared in the master - no > problem. But reading through the docs it looks like turning on > DynamicIncludes would save alot of memory and be generally more > efficient. > > Indeed, it would also "protect" the variables declared in one file from > another because the includes are compliled and called as seperate subs. > And here lies the problem, how to declare a vaiable in the master ASP file > that is also in the scope of the dynamic include? > You can stick with inline includes as you are doing, but DynamicIncludes are good, and you can pass values into them as subroutines: $Response->Includes($file, @args); # in $file <% my @args = @_; %> Just like a normal perl subroutine. For more on this, please see: http://www.apache-asp.org/objects.html#%24Response-%3EI2a8df2f3 You can also use globals, which you can declare for your entire application in your global.asa # global.asa use vars qw($Var1 $Var2); sub Script_OnStart { $Var1 = ''; $Var2 = 0; } I would strongly suggest you use locally scoped my() variables when possibly passing as @args to an include, but sometimes having a global can be handy which is why I mention the latter. --Josh _ Joshua Chamas Chamas Enterprises Inc. NodeWorks Founder Huntington Beach, CA USA http://www.nodeworks.com1-714-625-4051
Global (to page) variables under Apache::ASP
In my httpd.conf I have set 'PerlSetVar UseStrict 1' because I always use sctict anyway and I see in the docs that this might become the default too. So I always declare my variables with my(). Suppose I have a master ASP file that includes other scripts and these other scripts need access to the variables declrared in the master - no problem. But reading through the docs it looks like turning on DynamicIncludes would save alot of memory and be generally more efficient. Indeed, it would also "protect" the variables declared in one file from another because the includes are compliled and called as seperate subs. And here lies the problem, how to declare a vaiable in the master ASP file that is also in the scope of the dynamic include? -- Simon Oliver
Re: SOLVED: Problem using Perl Modules under mod_perl
> Nice, but see below >> somescript.pl >> --- >> #!/usr/bin/perl -wT >> use strict; >> use lib "."; >> use lib_netContest; >> use DBI; >> use CGI (qw:standard:); >> >> use vars qw(%c $config_module $db_handle); >> >> my $r = shift; >> >> if (defined $r && $r->dir_config('ConfigMod')) { >>$config_module = $r->dir_config('ConfigMod'); >> } >> else { >>use netContestConfig; >>$config_module = "netContestConfig"; >> } > > it's rather unusual to see use() inside the conditional code, > since use() is a compile time directive. meaning that netContestConfig > will be always loaded no matter if $r->dir_config('ConfigMod') returns > something or not. > > You probably want to s/use/require/. require() is a runtime directive. > Or move 'use netContestConfig;" to the top, so it'll be clear that it > always gets loaded. Good point, thanks! I will require the module to save the overhead of loading both configuration modules but using only one. Although the overhead should not be too big, if the "used but unused" module is emtpy... -- netendance GmbH Sören Stuckenbrock Fränkische Straße 38 30455 Hannover Telefon: 49 (0) 511/4733773 Fax: 49 (0) 511/4733776 Mobil : 49 (0) 173/6000319 http://www.netendance.de
Re: two distinct installations
On Tue, 23 Apr 2002 12:28:24 +0200 (MEST) Carlo Giomini <[EMAIL PROTECTED]> wrote: > Hi there! > I wonder if it is possible to have two distinct installations of mod_perl > on the same machine, let's say one made as root user and another as > normal user. > Thanks for helping, > Carlo. > > > You can running two apache (using the same DSO binary installation) with two different httpd.conf file specifying User and Group (and Port, off course) directives that you need. By the way, be careful if you run apache as root user Bye - Enrico = Enrico Sorcinelli - Gruppo E-Comm Italia On Line S.p.a. Via Malagoli, 12 - 56124 Pisa Tel. +39 050 944303 E-Mail: [EMAIL PROTECTED]
Re: two distinct installations
Carlo Giomini wrote: > Hi there! > I wonder if it is possible to have two distinct installations of mod_perl > on the same machine, let's say one made as root user and another as > normal user. Of course, see the installation chapter in the guide. __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: SOLVED: Problem using Perl Modules under mod_perl
Sören Stuckenbrock wrote: > Hi, > > thanks to all of your help, I found a way to achieve the following > goal: Nice, but see below > somescript.pl > --- > #!/usr/bin/perl -wT > use strict; > use lib "."; > use lib_netContest; > use DBI; > use CGI (qw:standard:); > > use vars qw(%c $config_module $db_handle); > > my $r = shift; > > if (defined $r && $r->dir_config('ConfigMod')) { >$config_module = $r->dir_config('ConfigMod'); > } > else { >use netContestConfig; >$config_module = "netContestConfig"; > } it's rather unusual to see use() inside the conditional code, since use() is a compile time directive. meaning that netContestConfig will be always loaded no matter if $r->dir_config('ConfigMod') returns something or not. You probably want to s/use/require/. require() is a runtime directive. Or move 'use netContestConfig;" to the top, so it'll be clear that it always gets loaded. This is not a mistake to use use() here, however misunderstanding how it works may lead to mistakes in the future. Another comment is that it's a good idea to name your modules with some prefix, which most likely won't collide with some core or 3rd party modules. e.g. MyProjectName::netContestConfig. (whereas MyProjectName, is the name of your project :) __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Installing mod_perl 1.26 - URI::URL error
At 17:00 4/23/2002 +0800, you wrote: >Einar Roheim wrote: >>Hi everyone, >> >>I have a problem installing mod_perl 1.26 with Apache 1.3.24. When I do >>the "make test" I'm getting this in the end before it aborts: > >You have a mismatching version of LWP and URI packages, update both and >the problem should disappear. I did a "force install" on both of them (since I had the last version), but I still have the same problem. As Nicolai Schlenzig said, I can add "use URI::URL;" to these files: mod_perl-x.xx/t/internal/hooks.t mod_perl-x.xx/lib/Apache/test.pm mod_perl-x.xx/blib/Apache/test.pm But I still have the mismatch that you talked about. Don't I? How can this mismatch happen? >>make[1]: Leaving directory `/usr/local/src/mod_perl-1.26/Util' >>cp t/conf/mod_perl_srm.conf t/conf/srm.conf >>../apache_1.3.24/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...\c >>done >>/usr/local/bin/perl t/TEST 0 >>Can't locate object method "new" via package "URI::URL" (perhaps you >>forgot to load "URI::URL"?) at ../blib/lib/Apache/test.pm line 252. >>make: *** [run_tests] Error 255 >> >>The strange thing is that I installed it on my test-server that has the >>same software (SuSE Linux 7.3 Pro / Apache 1.3.24 / mod_perl 1.24) and it >>worked like a dream. The only difference is the hardware. The test-server >>is a PIII with EIDE-disks and the big server (with the problem) has dual >>PIII with SCSI-disks and more memory. > >probably not exactly the same sw. > >>The server is registered in the DNS. >> >>Thanks in advance ... >>Einar > > > >-- > > >__ >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 >
two distinct installations
Hi there! I wonder if it is possible to have two distinct installations of mod_perl on the same machine, let's say one made as root user and another as normal user. Thanks for helping, Carlo.
SOLVED: Problem using Perl Modules under mod_perl
Hi, thanks to all of your help, I found a way to achieve the following goal: - have a couple of instances of a web application running under the same (name based) virtual host, under different s each using a different configuration than the others - having backwards compatibillity to pure CGI without mod_perl - have both of these points working without modifying anything in the (countless) scripts themselve but only in the environment like httpd.conf, startup.pl and of course the configuration file. Even if it's just a little achievement I make my solution public, hoping it saves others some time in the future. Or maybe someone has suggestions, to improve it? Here we go: First, for using mod_perl, httpd.conf includes the following (example for two instances on the server): httpd.conf --- NameVirtualHost 192.168.1.83:80 DocumentRoot "/www/u-dev-local/htdocs" ServerName u-dev-local PerlModule Apache::Registry PerlModule Apache::DBI PerlTaintCheck On Alias /contest /www/u-dev-local/contest SetHandler perl-script PerlHandler Apache::Registry PerlSendHeader Off PerlSetVar ConfigMod Contest::Config PerlRequire /www/u-dev-local/contest/mod_perl_init.pl Options ExecCGI allow from all Alias /contest_demo /www/u-dev-local/contest_demo SetHandler perl-script PerlHandler Apache::Registry PerlSendHeader Off PerlSetVar ConfigMod ContestDemo::Config PerlRequire /www/u-dev-local/contest_demo/mod_perl_init.pl Options ExecCGI allow from all --- For each instance of the application, I have different startup-scripts which load the Config-File for the instance: /www/u-dev-local/contest/mod_perl_init.pl --- use lib "/www/u-dev-local/contest"; use Contest::Config; --- /www/u-dev-local/contest_demo/mod_perl_init.pl --- use lib "/www/u-dev-local/contest_demo"; use ContestDemo::Config; --- And in the scripts the decision has to be made, if the default configuration file is used (netContestConfig), or if the context of the request is given to the script as an argument (which means running under mod_perl), and the name of the configfile is given, too: somescript.pl --- #!/usr/bin/perl -wT use strict; use lib "."; use lib_netContest; use DBI; use CGI (qw:standard:); use vars qw(%c $config_module $db_handle); my $r = shift; if (defined $r && $r->dir_config('ConfigMod')) { $config_module = $r->dir_config('ConfigMod'); } else { use netContestConfig; $config_module = "netContestConfig"; } { no strict 'refs'; *c = \%{"${config_module}::c"}; } --- And by the way: the configfile has the "hash structure" described by Stas Bekman at http://perl.apache.org/preview/modperl-docs/dst_html/docs/1.0/guide/porting.html#Configuration_Files__Writing__Dynamically_Updating_and_Reloading And: one must not forget to change the package declaration in the config file if using not the default file. Again: thank you! S.Stuckenbrock -- netendance GmbH Sören Stuckenbrock Fränkische Straße 38 30455 Hannover Telefon: 49 (0) 511/4733773 Fax: 49 (0) 511/4733776 Mobil : 49 (0) 173/6000319 http://www.netendance.de
Re: Installing mod_perl 1.26 - URI::URL error
Einar Roheim wrote: > Hi everyone, > > > I have a problem installing mod_perl 1.26 with Apache 1.3.24. When I do > the "make test" I'm getting this in the end before it aborts: You have a mismatching version of LWP and URI packages, update both and the problem should disappear. > > make[1]: Leaving directory `/usr/local/src/mod_perl-1.26/Util' > cp t/conf/mod_perl_srm.conf t/conf/srm.conf > ../apache_1.3.24/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...\c > done > /usr/local/bin/perl t/TEST 0 > Can't locate object method "new" via package "URI::URL" (perhaps you > forgot to load "URI::URL"?) at ../blib/lib/Apache/test.pm line 252. > make: *** [run_tests] Error 255 > > The strange thing is that I installed it on my test-server that has the > same software (SuSE Linux 7.3 Pro / Apache 1.3.24 / mod_perl 1.24) and > it worked like a dream. The only difference is the hardware. The > test-server is a PIII with EIDE-disks and the big server (with the > problem) has dual PIII with SCSI-disks and more memory. probably not exactly the same sw. > The server is registered in the DNS. > > > Thanks in advance ... > > Einar -- __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
RE: Installing mod_perl 1.26 - URI::URL error
Hi Einar, I just did some digging in my mailbox and found the following: (btw - mod_perl 1.26 has been around for some time, and it looks like you're using it - but not in your spec. list) // Nicolai --- OLD MESSAGE --- Hi, For what it's worth it, I always have to add "use URI::URL;" to the files: mod_perl-x.xx/t/internal/hooks.t mod_perl-x.xx/lib/Apache/test.pm mod_perl-x.xx/blib/Apache/test.pm then all tests work - apart from the ones skipped on my OS - as usual ;) Hope this helps // Nicolai - Original Message - From: "terry mcintyre" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, April 03, 2002 1:49 AM Subject: install test fails > > Redhat Linux 7.2 > Apache 1.3.24 > Perl 5.6.1 > mod-perl-1.26 > > make test fails with result: > > /usr/bin/perl t/TEST 0 > Can't locate object method "new" via package > "URI::URL" (perhaps you forgot to load "URI::URL"?) > at > ./blib/lib/Apache/test.pm line 252. > make: *** [run_tests] Error 255 > > typescript with complete output follows: > > Any clues greatly appreciated. > > Thanks! > > > __ > Do You Yahoo!? > Yahoo! Tax Center - online filing with TurboTax > http://taxes.yahoo.com/ -Original Message- From: Einar Roheim [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 23, 2002 11:42 AM To: [EMAIL PROTECTED] Subject: Installing mod_perl 1.26 - URI::URL error Hi everyone, I have a problem installing mod_perl 1.26 with Apache 1.3.24. When I do the "make test" I'm getting this in the end before it aborts: make[1]: Leaving directory `/usr/local/src/mod_perl-1.26/Util' cp t/conf/mod_perl_srm.conf t/conf/srm.conf ../apache_1.3.24/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...\c done /usr/local/bin/perl t/TEST 0 Can't locate object method "new" via package "URI::URL" (perhaps you forgot to load "URI::URL"?) at ../blib/lib/Apache/test.pm line 252. make: *** [run_tests] Error 255 The strange thing is that I installed it on my test-server that has the same software (SuSE Linux 7.3 Pro / Apache 1.3.24 / mod_perl 1.24) and it worked like a dream. The only difference is the hardware. The test-server is a PIII with EIDE-disks and the big server (with the problem) has dual PIII with SCSI-disks and more memory. The server is registered in the DNS. Thanks in advance ... Einar
Installing mod_perl 1.26 - URI::URL error
Hi everyone, I have a problem installing mod_perl 1.26 with Apache 1.3.24. When I do the "make test" I'm getting this in the end before it aborts: make[1]: Leaving directory `/usr/local/src/mod_perl-1.26/Util' cp t/conf/mod_perl_srm.conf t/conf/srm.conf ../apache_1.3.24/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...\c done /usr/local/bin/perl t/TEST 0 Can't locate object method "new" via package "URI::URL" (perhaps you forgot to load "URI::URL"?) at ../blib/lib/Apache/test.pm line 252. make: *** [run_tests] Error 255 The strange thing is that I installed it on my test-server that has the same software (SuSE Linux 7.3 Pro / Apache 1.3.24 / mod_perl 1.24) and it worked like a dream. The only difference is the hardware. The test-server is a PIII with EIDE-disks and the big server (with the problem) has dual PIII with SCSI-disks and more memory. The server is registered in the DNS. Thanks in advance ... Einar
cannot run make test
Hallo everybody, I made an installation of mod_perl with apxs and everything seems to work fairly well BUT I cannot run make test! When I try to, I get the message "Can't make test with apxs (yet)". Any suggestions? Thanks in advance, Carlo.