Re: howto config apache to allow perl to filter php pages
Rob Tanner wrote: --On 07/16/00 16:11:07 -0400 Sam Carleton [EMAIL PROTECTED] wrote: I would like perl to process a php page before or after the php interpreter get's it hands on the file. I am trying to add a navbar to the PHP code. How would I go about doing that? Sam The simple answer is wait for Apache 2.x, but since that's just barely alpha now, that's a looong [sic] while away. The issue in Apache 1.x is that you can use only one handler in any particular phase to process you're request. Thus, php or mod_perl (or cgi, depending on how you meant to invoke perl). But the real question is why? I have never done a navbar on a page (most of my web work is server app development, not pages), si I may be making some wrong assumptions here. If you are creating the page with a cgi or a mod-perl app, I would think you would be able to do the whole thing without ever using PHP. But, if what you are really doing is displaying a page with server-side components, PHP is a much better chice by far than cgi or mod-perl. What are you trying to do that php won't do for you? I was reading the O'Reilly book "Writting Apache Modules in Perl and C" and discovered the navbar example. I really like how Stein/MacEachern designed the navbar code. Once the code was written, it read in a configuration file so that it would know the url/name of all items on the navbar. This config file was passed to the navar code via variable in the apache directive. I put the navbar code into the essi example (enhansted server side include) so that one would only need to the correct comment !--#NAVBAR-- in the html file. I think this is a great idea. If I could get the navbar/essi code to parse the php page either before or after php processed the page, the navbar would always be there. The bottom line: I would like to have some navigation code that is totally seperate from everything so that I don't have to worry about broken links and stuff like that. I also want the ability to change the look/feel of the navigation without affecting everything. sam
my first attempt at a perl script (syntax error)
I have begun writting my first mod_perl module. I figured that I would get the logic working perl first, considering I am new at the language in general. Well, low and behold, I have a few syntax error which I don't know how to resolve. One issue is how to declare a local variable, and the other is a problem with my open statement. Can someone take a look and help me out? Here is the code: #! /usr/bin/perl use strict; sub process { local $str = @_; return $str; } my $filename="testinput.txt"; my $fh; unless( open $fh, $filename) { print STDERR "Cannot open file [$filename]\n"; } while($fh) { chomp; print process($_); } 1; __END__ This is the error I am getting: Global symbol "$str" requires explicit package name at ./test.pl line 6. Bareword found where operator expected at ./test.pl line 18, near "$fh" (Missing operator before fh?) Bareword "fh" not allowed while "strict subs" in use at ./test.pl line 18. syntax error at ./test.pl line 18, near "$fh" syntax error at ./test.pl line 21, near "}" Execution of ./test.pl aborted due to compilation errors.
Re: my first attempt at a perl script (syntax error)
Alex Farber wrote: Hi Sam, Sam Carleton wrote: I have a few syntax error which I don't know how to resolve. One issue is how to declare a local variable, and the other is a problem with my open statement. maybe you should read some introductionary Perl books, like http://www.effectiveperl.com/toc.html or http://www.ebb.org/PickingUpPerl/pickingUpPerl.html A good place to ask is news:comp.lang.perl.misc (after you've read http://www.perl.com/pub/doc/manual/html/pod/perlfaq.html ) Maybe I have read things like "Programming Perl" from O'Reilly and "Writting Apache Modules in Perl and C", am tired of reading page after page and want to do some real coding. Maybe I thought that folks in the mod_perl mailing list would be understanding of someone who has spent many years in another language and needs a little help overcoming some syntax issues. One thing is for sure, I did not expect to get a responce such as your, one that says: "Go yourself, if you don't know the language we sure as aren't going to help your ___!!!" Live and learn, I guess... Sam
Re: my first attempt at a perl script (syntax error)
Sam Carleton wrote: Alex Farber wrote: A good place to ask is news:comp.lang.perl.misc (after you've read http://www.perl.com/pub/doc/manual/html/pod/perlfaq.html ) Maybe I have read things like "Programming Perl" from O'Reilly and "Writting Apache Modules in Perl and C", am tired of reading page after page and want to do some real coding. Maybe I thought that folks in the mod_perl mailing list would be understanding of someone who has spent many years in another language and needs a little help overcoming some syntax issues. One thing is for sure, I did not expect to get a responce such as your, one that says: "Go yourself, if you don't know the language we sure as aren't going to help your ___!!!" Live and learn, I guess... There where a number of people that did reply privately, I cheched my mod_perl folder firstg. I would like to thank eveyone that did reply kinding to my question. My question's where answered. Thank you, I knew that most participants of the mailing list where willing to help even when the subject was a bit off topic. Again, thank you all for the help! Sam
Re: problems with code in Writing Apache Modules with Perl and C
m m wrote: folks allow me, Im the other newbie who was grappling with Apache::NavBar the other day :-) Ged will be proud, I persevered as he advised ;-) Sam new to perl, welcome. This maynot be the canonically right answer but for a simple task like youre asking, you can just "warn" stuff to your error logs. so for example, (if I understood your initial request correctly) , this piece of code will show you the line you are reading from your configuration file and then the url,location match if any. while ($fh) { chomp; s/^\s+//; s/\s+$//; #fold leading and trailing whitespace next if /^#/ || /^$/; # skip comments and empty lines next unless my($url, $label) = /^(\S+)\s+(.+)/; warn "here is the line $_\n"; if ( my($url,$label) = /^(\S+)\s+(.+)/ ) { warn "here are the matches $url, $label\n"; } else { next; } push @c, $url; # keep the url in an ordered array $c{$url} = $label; # keep its label in a hash } Well, I took your if statement and put cut/paste it into my code, things still did not work. So I cut the NavBar object out of that file and put it into a normal perl file. It works and here it is: sub new { my ($class,$conf_file) = @_; my (@c,%c); my $url; my $label; print "filename = [$conf_file]\n"; open fh, $conf_file or return; while (fh) { chomp; s/^\s+//; s/\s+$//; #fold leading and trailing whitespace next if /^#/ || /^$/; # skip comments and empty lines # next unless my($url, $label) = /^(\S+)\s+(.+)/; print "here is the line $_\n"; if ( ($url,$label) = /^(\S+)\s+(.+)/ ) { print "here are the matches [$url], [$label]\n"; } else { next; } print "url = [$url], label = [$label]\n"; push @c, $url; # keep the url in an ordered array $c{$url} = $label; # keep its label in a hash } return bless {'urls' = \@c, 'labels' = \%c, 'modified' = (stat $conf_file)[9]}, $class; } Well, When I put a debug line right after the chomp of the mod_perl code, using Apache::File to open the conf_file, it displays the whole conf_file, not just one line. Any thoughs on how I read through the conf_file one line at a time? Sam
howto config apache to allow perl to filter php pages
I would like perl to process a php page before or after the php interpreter get's it hands on the file. I am trying to add a navbar to the PHP code. How would I go about doing that? Sam
getting mod_perl configured on FreeBSD
I have successfully gotten Apache/mod_perl to compile under Linux many a times. This is my first attempt at compiling it on FreeBSD and I am having problems. The problem is that when to do the "make test", apache never starts up. I had once run into this on Linux and that was because the .makepl_args.mod_perl was pointing to a non-existing layout file and I did not catch the error from the "perl Makefile.PL". But I have looked and look at the output of the "perl Makefile.PL" and see nothing wrong. I am going to post the output of "perl Makefile.PL", along with my .makepl_args.mod_perl and my layout file in hopes that one of you can find my error. Thanks output from "perl Makefile.PL" Will run tests as User: 'nobody' Group: 'wheel' Configuring for Apache, Version 1.3.12 + using installation path layout: maineville (/usr/src/apache.config.layout) + activated perl module (modules/perl/libperl.a) Creating Makefile Creating Configuration.apaci in src + enabling mod_so for DSO support + id: mod_perl/1.24 + id: Perl/5.00503 (freebsd) [perl] Creating Makefile in src + configured for FreeBSD 4.0 platform + setting C pre-processor to cc -E + checking for system header files + adding selected modules o rewrite_module uses ConfigStart/End enabling DBM support for mod_rewrite o dbm_auth_module uses ConfigStart/End o perl_module uses ConfigStart/End + mod_perl build type: DSO + setting up mod_perl build environment + adjusting Apache build environment ** Error: Cannot build mod_include with Perl support (USE_PERL_SSI) ** ** when mod_perl is compiled as DSO because of cross-module calls. ** ** Ignoring PERL_SSI flag now. ** + checking sizeof various data types + doing sanity check on compiler and options Creating Makefile in src/support Creating Makefile in src/os/unix Creating Makefile in src/ap Creating Makefile in src/main Creating Makefile in src/modules/standard Creating Makefile in src/modules/proxy Creating Makefile in src/modules/perl Reading Makefile.PL args from ../.makepl_args.mod_perl Will configure via APACI cp apaci/Makefile.libdir /usr/src/apache/src/modules/perl/Makefile.libdir cp apaci/Makefile.tmpl /usr/src/apache/src/modules/perl/Makefile.tmpl cp apaci/README /usr/src/apache/src/modules/perl/README cp apaci/configure /usr/src/apache/src/modules/perl/configure cp apaci/libperl.module /usr/src/apache/src/modules/perl/libperl.module cp apaci/mod_perl.config.sh /usr/src/apache/src/modules/perl/mod_perl.config.sh cp apaci/load_modules.pl.PL /usr/src/apache/src/modules/perl/load_modules.pl.PL cp apaci/find_source.PL /usr/src/apache/src/modules/perl/find_source.PL cp apaci/apxs_cflags.PL /usr/src/apache/src/modules/perl/apxs_cflags.PL cp apaci/mod_perl.exp /usr/src/apache/src/modules/perl/mod_perl.exp PerlDispatchHandler.enabled PerlChildInitHandlerenabled PerlChildExitHandlerenabled PerlPostReadRequestHandler..enabled PerlTransHandlerenabled PerlHeaderParserHandler.enabled PerlAccessHandler...enabled PerlAuthenHandler...enabled PerlAuthzHandlerenabled PerlTypeHandler.enabled PerlFixupHandlerenabled PerlHandler.enabled PerlLogHandler..enabled PerlInitHandler.enabled PerlCleanupHandler..enabled PerlRestartHandler..enabled PerlStackedHandlers.enabled PerlMethodHandlers..enabled PerlDirectiveHandlers...enabled PerlTableApienabled PerlLogApi..enabled PerlUriApi..enabled PerlUtilApi.enabled PerlFileApi.enabled PerlConnectionApi...enabled PerlServerApi...enabled PerlSectionsenabled PerlSSI.enabled (cd /usr/src/apache CC="cc" ./configure --activate-module=src/modules/perl/libperl.a --disable-rule=EXPAT --with-layout=/usr/src/apache.config.layout:maineville --server-uid=wwwrun --server-gid=daemon --enable-module=most --enable-shared=max --prefix=/data01/maineville) Checking CGI.pm VERSION..ok Checking for LWP::UserAgent..ok Checking for HTML::HeadParserok '-ADD_MODULE' is not a known MakeMaker parameter name. Writing Makefile for Apache Writing Makefile for Apache::Connection Writing Makefile for Apache::Constants Writing Makefile for Apache::File Writing Makefile for Apache::Leak Writing Makefile for Apache::Log Writing Makefile for Apache::ModuleConfig Writing Makefile for Apache::PerlRunXS Writing Makefile for Apache::Server Writing Makefile for Apache::Symbol Writing Makefile for Apache::Table Writing Makefile for Apache::URI Writing Makefile for Apache::Util Writing Makefile for mod_perl .makepl_args.mod_perl # File: .makepl_args.mod_erl # enable all phase callbacks, API modules and misc features EVERYTHING=1 # tell runtime diagnostics to
redirecting a domain
I have an apache question and I have NO idea where to post it. Is there a newsgroup or mailing list simply for apache? I have multipal domain names: domain.net domain.org. I would like to configure apache such that when someone goes to www.domain.org, they are "redirect" to www.domain.net. They are both the exact same web site, I simply want the domain name to show up as www.domain.net. Any thoughs on how to do that? Sam
Getting DB2U support
Folks, I have installed mod_perl and I would like to access a DB2 server. What perl modules do I need to install? Are there any tutorials out there to give me the basics of access DB2 from perl? Sam
Re: Most nonesense I've ever read about mod_perl
"Jason C. Leach" wrote: hi, There be truth to the reply. You can write all the C or ASM you like, but your algorithm is where it will count. Anyone who knows how to do BIG-O will know this. A good perl programmer will code a bad C programmer under the table with speed and eficiency. Jason, Your posting was the first one I saw. Your statement is 100% correct. On the other hand, if you put an outstanding Perl programmer up against an equally outstanding C programmer, the C programmer's code will run loops around the Perl programmer. The only question is: How much more time will it take the C program to write the code? Does the time justify the speed? I am a C/C++ programmer and love it for the power and the speed, but... I am working on putting together a web site. I have desided to learn Perl because I have desided that the time to do it right in C/C++ just isn't worth it. Every language has it use, the truly knowledgeable understand when to use each language:) Sam
Re: perl code to handle a multipart/form-data POST
"Jeffrey W. Baker" wrote: On Sat, 29 Apr 2000, Sam Carleton wrote: #! /usr/bin/perl #cgi-lib.pl was optained from http://cgi-lib.berkeley.edu/ require "cgi-lib.pl"; If we can erradicate polio and small pox, surely there must be a way to rid the world of cgi-lib.pl. Apparently it can still strike the young, elderly, and infirm. What a senseless waste. -jwb PS. If Mr. Carleton is not in too much of a hurry, I would advise him to look into the modern software available on CPAN, such as Apache.pm, which comes with mod_perl, and Apache::Request, which is available at http://www.perl.com/CPAN/modules/by-module/Apache/. Ok, So cgi-lib.pl isn't the greatest in the world, but it did help me get a big farther in my project:) Now I need something that works. I have "Writing Apache Modules with Perl and C", but have not read too deep into it and time is very short. Again, all I am trying to do is print out ALL the name/values that was on the form. The code I have so far does not display any of the name/values, Below is my code, could someone please show me what I am doing wrong and how do I fix it? package Apache::POSTDisplay; use strict; use Apache::Constants qw(:common); sub handler { my $r = shift; $r-content_type('text/html'); $r-send_http_header; $r-print(HTTP_HEADER); HTML TITLEPOSTDisplay/TITLE BODY H1POSTDisplay/H1 UL HTTP_HEADER my @args = ($r-args, $r-content); while(my($name,$value) = splice @args,0,2) { $r-print("li[$name]=[$value]/li\n"); } $r-print(HTTP_FOOTER); /UL /BODY/HTML HTTP_FOOTER return OK; } 1; __END__
where to find info on the Apache request object
I am learning perl/mod_perl right now and have some questions. I would like to see all the functions that I can call on the Apache request object. Can anyone point me to some documentation? I didn't see a listing in "Writing Apache Modules in Perl and C". Sam
Re: perl code to handle a multipart/form-data POST
Tobias Hoellrich wrote: Almost :-) Apache cannot be used for multipart/form-data, gotta use Apache::Request instead. Change the start of the handler to : sub handler { my $r = shift; my $apr = Apache::Request-new($r) and then get the params with @params=$apr-param; Tobias, I am looking into it right now, but you might be able to save me a lot of time. I want to display the name/values from the HTML form. How would I go about enumerating through the @params to do this? Sam
Apache::Request-new($r) does NOT work, why?
Tobias Hoellrich wrote: Almost :-) Apache cannot be used for multipart/form-data, gotta use Apache::Request instead. Change the start of the handler to : sub handler { my $r = shift; my $apr = Apache::Request-new($r) Tobias, The new is blowing up on me. This is the error message: null: Can't locate object method "new" via package "Apache::Request"
Re: where to find info on the Apache request object
Jeff Beard wrote: Or read chapter 9 in the Eagle book. --Jeff At 10:43 AM 4/30/00, Tobias Hoellrich wrote: At 01:34 PM 4/30/00 -0400, Sam Carleton wrote: I am learning perl/mod_perl right now and have some questions. I would like to see all the functions that I can call on the Apache request object. Can anyone point me to some documentation? I didn't see a listing in "Writing Apache Modules in Perl and C". Sam try 'perldoc Apache' Tobias and Jeff, Thanks for the pointer, but now I am looking for info on the Apache::Request object, I did not see it in Chapter 9 of the Eagle book. I tried a number of different ways of trying to get to it from perldoc, but failed. How do I go about bring up the doc on this in perldoc? Sam
perl code to handle a multipart/form-data POST
I am in a very tight spot right now. I need to have some C++ code posting data to a web browser vi 'multipart/form-data' by Monday. I would REALLY like to have either a normal perl CGI script or mod_perl script that will simply display all the information POSTed to it from my code. Is anyone up to the task, or able to give me some pointers on how I can do this myself? Sam Carleton
Re: perl code to handle a multipart/form-data POST
Sam Carleton wrote: I am in a very tight spot right now. I need to have some C++ code posting data to a web browser vi 'multipart/form-data' by Monday. I would REALLY like to have either a normal perl CGI script or mod_perl script that will simply display all the information POSTed to it from my code. Is anyone up to the task, or able to give me some pointers on how I can do this myself? I LOVE answering my own questions: #! /usr/bin/perl #cgi-lib.pl was optained from http://cgi-lib.berkeley.edu/ require "cgi-lib.pl"; ReadParse(); print PrintHeader(); print HtmlTop("POST/GET Display"); print PrintVariables(); print HtmlBot(); exit 0;
Re: Error compiling mod_perl
Doug MacEachern wrote: On Tue, 11 Apr 2000, Sam Carleton wrote: This is the error message I got when I compiled mod_perl: Perl lib version (5.00503) doesn't match executable version (5.006) at /usr/lib/perl5/5.00503/i586-linux/Config.pm line 7. you either installed a new Perl after running mod_perl's Makefile.PL or have a broken Perl installation. try building mod_perl from a fresh source tree. OK, I messed things up with CPAN, I believe that it installed 5.006 where my distribution came with 5.003. I decided to resolve the issue by installing 5.6. I am able to run perl Makefile.PL without error and compile without errors. When I run make test, I get this error: ---make test error--- Syntax error on line 30 of /usr/src/mod_perl-1.21_03/t/conf/httpd.conf: Invalid command '=pod', perhaps mis-spelled or defined by a module not included in the server configuration done /usr/local/bin/perl t/TEST 0 still waiting for server to warm up...not ok server failed to start! (please examine t/logs/error_log) at t/TEST line 95. make: *** [run_tests] Error 111 ---make test error--- I looked in t/logs for a error_log, but t/logs is empty. I think I might have issue with the way I am configuring apache and mod_perl. This is my .makepl_args.mod_perl: ---.makepl_args.mod_perl--- # File: .makepl_args.mod_erl # enable all phase callbacks, API modules and misc features EVERYTHING=1 # tell runtime diagnostics to active if MOD_PERL_TRACE environment # variable is set at runtime PERL_TRACE=1 # tell Makefile.pl where the Apache source tree is APACHE_SRC=/usr/src/apache/src # tell Makefile.PL where the Apache is to be isntalled APACHE_PREFIX=/data01/apache # disable Makefile.pl from compiling Apache #PREP_APACHED=1 # tell Makefile.PL to use the first source found, which will be the # path specified above by APACHE_SRC DO_HTTPD=1 # tell Makefile.PL to configure Apache using the apaci interface USE_APACI=1 # tell makefile.PL to configure ssl support, too # SSL_BASE=/usr/local/ssl # add mod_info, mod_status, mod_usertrack, and mod_unique_id ADD_MODULE=info,status,usertrack,unique_id # additional arguments to give Apache's configure script # aruments can be delimited by comma and/or specified with multipal # APACI_ARGS lines #APACI_ARGS=--includedir=/usr/src/php #APACI_ARGS=--activate-module=src/modules/php3/libphp3.a APACI_ARGS=--with-layout=apache.config.layout:Sam-Layout APACI_ARGS=--server-uid=wwwrun APACI_ARGS=--server-gid=dosemu APACI_ARGS=--enable-module=most APACI_ARGS=--enable-shared=max ---.makepl_args.mod_perl--- And the options I am using to make apache: ---apache options--- configure \ --with-layout=/root/apache.config.layout:Sam-Layout \ --with-perl=src/modules/perl \ --enable-module=most \ --server-uid=wwwrun \ --server-gid==dosemu \ --enable-shared=max ---apache options--- Any thoughts on what I have wrong? Sam P.S. Thanks a millon for having the .makepl_args.mod_perl idea!!! It is an outstanding one!
make test is bomming out
Doug MacEachern wrote: On Tue, 11 Apr 2000, Sam Carleton wrote: This is the error message I got when I compiled mod_perl: Perl lib version (5.00503) doesn't match executable version (5.006) at /usr/lib/perl5/5.00503/i586-linux/Config.pm line 7. you either installed a new Perl after running mod_perl's Makefile.PL or have a broken Perl installation. try building mod_perl from a fresh source tree. OK, I messed things up with CPAN, I believe that it installed 5.006 where my distribution came with 5.003. I decided to resolve the issue by installing 5.6. I am able to run perl Makefile.PL without error and compile without errors. When I run make test, I get this error: ---make test error--- Syntax error on line 30 of /usr/src/mod_perl-1.21_03/t/conf/httpd.conf: Invalid command '=pod', perhaps mis-spelled or defined by a module not included in the server configuration done /usr/local/bin/perl t/TEST 0 still waiting for server to warm up...not ok server failed to start! (please examine t/logs/error_log) at t/TEST line 95. make: *** [run_tests] Error 111 ---make test error--- I looked in t/logs for a error_log, but t/logs is empty. I think I might have issue with the way I am configuring apache and mod_perl. This is my .makepl_args.mod_perl: ---.makepl_args.mod_perl--- # File: .makepl_args.mod_erl # enable all phase callbacks, API modules and misc features EVERYTHING=1 # tell runtime diagnostics to active if MOD_PERL_TRACE environment # variable is set at runtime PERL_TRACE=1 # tell Makefile.pl where the Apache source tree is APACHE_SRC=/usr/src/apache/src # tell Makefile.PL where the Apache is to be isntalled APACHE_PREFIX=/data01/apache # disable Makefile.pl from compiling Apache #PREP_APACHED=1 # tell Makefile.PL to use the first source found, which will be the # path specified above by APACHE_SRC DO_HTTPD=1 # tell Makefile.PL to configure Apache using the apaci interface USE_APACI=1 # tell makefile.PL to configure ssl support, too # SSL_BASE=/usr/local/ssl # add mod_info, mod_status, mod_usertrack, and mod_unique_id ADD_MODULE=info,status,usertrack,unique_id # additional arguments to give Apache's configure script # aruments can be delimited by comma and/or specified with multipal # APACI_ARGS lines #APACI_ARGS=--includedir=/usr/src/php #APACI_ARGS=--activate-module=src/modules/php3/libphp3.a APACI_ARGS=--with-layout=apache.config.layout:Sam-Layout APACI_ARGS=--server-uid=wwwrun APACI_ARGS=--server-gid=dosemu APACI_ARGS=--enable-module=most APACI_ARGS=--enable-shared=max ---.makepl_args.mod_perl--- And the options I am using to make apache: ---apache options--- configure \ --with-layout=/root/apache.config.layout:Sam-Layout \ --with-perl=src/modules/perl \ --enable-module=most \ --server-uid=wwwrun \ --server-gid==dosemu \ --enable-shared=max ---apache options--- Any thoughts on what I have wrong? Sam P.S. Thanks a millon for having the .makepl_args.mod_perl idea!!! It is an outstanding one!
PLEASE HELP!!!!! I cannot get mod_perl/apache compiled
I simply cannot get mod_perl/apache to compile. My understanding is that I configure .makepl_args.mod_perl to compile both mod_perl. Then I do the following: perl Makefile.PL make make test make install Assuming there where no problems, all should be installed and ready to go. But all is not well. First some version info. I just downloaded mod_perl-1.22 and apache_1.3.12 and am working with fresh trees. I run the perl Makefile.PL and that seems to work well, I don't see any errors. When I try to run make, I get this error: # make (cd /usr/src/apache_1.3.12 make) make[1]: Entering directory `/usr/src/apache_1.3.12' make[1]: *** No targets. Stop. make[1]: Leaving directory `/usr/src/apache_1.3.12' make: *** [apaci_httpd] Error 2 My understanding is that the `perl Makefile.PL` WILL also run configure for apache. Just to make sure I was not mistaken, I have tried to first go into the apache tree and run configure with the same options that are in my .makepl_args.mod_perl. Then run `perl Makefile.PL`, run `make` (which works this time), and then run `make test`. It is `make test` that bombs out with this error: letting apache warm up...\c Syntax error on line 30 of /usr/src/mod_perl-1.22/t/conf/httpd.conf: Invalid command '=pod', perhaps mis-spelled or defined by a module not included in the server configuration done /usr/local/bin/perl t/TEST 0 still waiting for server to warm up...not ok server failed to start! (please examine t/logs/error_log) at t/TEST line 95. make: *** [run_tests] Error 111 Now, there is no 't/logs/error_log' file to examine. But I did notice an error in reading in the the httpd.conf file. I looked into line 30 of '/usr/src/mod_perl-1.22/t/conf/httpd.conf' and this is what I found: =pod =head1 NAME mod_perl test configuration file =head1 DESCRIPTION umm, we use this to test mod_perl =over to apache I am under the impression that the httpd.conf file is the conf file that httpd is reading in for the test. My understanding is that equals is not a valid beginning of an apache conf file. I have NO CLUE as to what is going on here. I would truly appreciate it if you know anything about this please let me know what is going on. At the bottom you will find my '.makepl_args.mod_perl' and the command line options I am using for apache. Sam --.makepl_args.mod_perl-- # File: .makepl_args.mod_erl # enable all phase callbacks, API modules and misc features EVERYTHING=1 # tell runtime diagnostics to active if MOD_PERL_TRACE environment # variable is set at runtime PERL_TRACE=1 # tell Makefile.pl where the Apache source tree is APACHE_SRC=/usr/src/apache_1.3.12/src # tell Makefile.PL where the Apache is to be isntalled APACHE_PREFIX=/data01/apache # disable Makefile.pl from compiling Apache #PREP_HTTPD=1 # tell Makefile.PL to use the first source found, which will be the # path specified above by APACHE_SRC DO_HTTPD=1 # tell Makefile.PL to configure Apache using the apaci interface USE_APACI=1 # tell makefile.PL to configure ssl support, too #-SSL_BASE=/usr/local/ssl # add mod_info, mod_status, mod_usertrack, and mod_unique_id #-ADD_MODULE=info,status,usertrack,unique_id # additional arguments to give Apache's configure script # aruments can be delimited by comma and/or specified with multipal # APACI_ARGS lines #APACI_ARGS=--includedir=/usr/src/php #APACI_ARGS=--activate-module=src/modules/php3/libphp3.a APACI_ARGS=--with-layout=apache.config.layout:Sam-Layout APACI_ARGS=--server-uid=wwwrun APACI_ARGS=--server-gid=dosemu APACI_ARGS=--enable-module=most APACI_ARGS=--enable-shared=max --.makepl_args.mod_perl-- --apache config script-- #! /bin/sh ROOT_DIR=/usr/src $ROOT_DIR/apache_1.3.12/configure \ --with-layout=/root/apache.config.layout:Sam-Layout \ --with-perl=src/modules/perl \ --enable-module=most \ --server-uid=wwwrun \ --server-gid==dosemu \ --enable-shared=max --apache config script--
Error compiling mod_perl
This is the error message I got when I compiled mod_perl: Perl lib version (5.00503) doesn't match executable version (5.006) at /usr/lib/perl5/5.00503/i586-linux/Config.pm line 7. Compilation failed in require at /usr/lib/perl5/5.00503/ExtUtils/MakeMaker.pm line 13. BEGIN failed--compilation aborted at /usr/lib/perl5/5.00503/ExtUtils/MakeMaker.pm line 13. Compilation failed in require. BEGIN failed--compilation aborted. make: *** [Version_check] Error 255 How do I fix this? Sam
best way to call traceroute
I want to call traceroute to the remote_host from within a mod_perl script, being a C/C++ programmer I don't the best way to do that. Is there a traceroute object I could use? If so, how? Otherwise how do I run traceroute from within a perl script? Sam
Re: best way to call traceroute
Steven Champeon wrote: On Fri, 7 Apr 2000, Sam Carleton wrote: I want to call traceroute to the remote_host from within a mod_perl script, being a C/C++ programmer I don't the best way to do that. Is there a traceroute object I could use? If so, how? Otherwise how do I run traceroute from within a perl script? I'm getting ready to port an old and somewhat clunky traceroute CGI script to mod_perl, mostly to avoid the horrid 'nph-' construction. If you'd like I can make the source available. That would be great! Any idea when it will be ready? Sam
getting server side includes to work server wide
I have followed the example in "Writing Apache Modules in Perl and C". The module Apache::ESSI is working fine for a virtual site (development site), but it does not work for the main (non-virutal) site. Here a bit of my httpd.conf: - ## ## httpd.conf -- Apache HTTP server configuration file ## [...snip...] ResourceConfig conf/perl.conf [...snip...] ServerAdmin [EMAIL PROTECTED] ServerName miltonstreet.tzo.com DocumentRoot "/data01/www/miltonstreet" Directory / Options FollowSymLinks AllowOverride None /Directory Directory "/data01/www/miltonstreet" Options FollowSymLinks MultiViews Includes ExecCGI AllowOverride None Order allow,deny Allow from all /Directory [...snip...] VirtualHost 192.168.0.5:80 DocumentRoot /data01/www/dev-collect-lure Directory "/data01/www/scripts/cgi-bin-dev" AllowOverride None Options None Order allow,deny Allow from all /Directory Location /images SetHandler perl-script PerlHandler Apache::Magick /Location /VirtualHost - Apache::ESSI works fine on the 192.168.0.5 web site, but does not work on the miltonstreet web site. Here is the perl.conf: - # perl.conf PerlRequire /data01/www/scripts/startup.pl PerlFreshRestart On Location /hello/world SetHandler perl-script PerlHandler Apache::Hello /Location Files ~ "\.ehtml$" SetHandler perl-script Perlhandler Apache::ESSI PerlSetVar ESSIDefs conf/essi.defs /Files AddType text/html .ehtml Location /image SetHandler perl-script PerlHandler Apache::Magick /Location - Any thoughts on what I am doing wrong? Sam P.S. the miltonstreet site is: http://miltonstreet.tzo.com/index.ehtml
getting server side includes to work server wide
I have followed the example in "Writing Apache Modules in Perl and C". The module Apache::ESSI is working fine for a virtual site (development site), but it does not work for the main (non-virutal) site. Here a bit of my httpd.conf: - ## ## httpd.conf -- Apache HTTP server configuration file ## [...snip...] ResourceConfig conf/perl.conf [...snip...] ServerAdmin [EMAIL PROTECTED] ServerName miltonstreet.tzo.com DocumentRoot "/data01/www/miltonstreet" Directory / Options FollowSymLinks AllowOverride None /Directory Directory "/data01/www/miltonstreet" Options FollowSymLinks MultiViews Includes ExecCGI AllowOverride None Order allow,deny Allow from all /Directory [...snip...] VirtualHost 192.168.0.5:80 DocumentRoot /data01/www/dev-collect-lure Directory "/data01/www/scripts/cgi-bin-dev" AllowOverride None Options None Order allow,deny Allow from all /Directory Location /images SetHandler perl-script PerlHandler Apache::Magick /Location /VirtualHost - Apache::ESSI works fine on the 192.168.0.5 web site, but does not work on the miltonstreet web site. Here is the perl.conf: - # perl.conf PerlRequire /data01/www/scripts/startup.pl PerlFreshRestart On Location /hello/world SetHandler perl-script PerlHandler Apache::Hello /Location Files ~ "\.ehtml$" SetHandler perl-script Perlhandler Apache::ESSI PerlSetVar ESSIDefs conf/essi.defs /Files AddType text/html .ehtml Location /image SetHandler perl-script PerlHandler Apache::Magick /Location - Any thoughts on what I am doing wrong? Sam P.S. the miltonstreet site is: http://miltonstreet.tzo.com/index.ehtml
Can't locate object method OPEN via package Apache
I am trying to get the Apache::Magick module from the O'Reilly book "Writing Apache Modules with Perl and C" to work. The error I am running into is: Can't locate object method "OPEN" via package "Apache" (line 80) The looks real simply: open(STDOUT, "=" . fileno($fh)); Any thoughts on what is going wrong? Sam P.S. The whole Apache::Magick is attached, in case you want to look at it. package Apache::Magick; use strict; use Apache::Constants qw(:common); use Image::Magick (); use Apache::File (); use File::Basename qw(fileparse); use DirHandle (); my %LegalArguments = map { $_ = 1 } qw (adjoin background bordercolor colormap colorspace colors compress density dispose delay dither display font format iterations interlace loop magick mattecolor monochrome page pointsize preview_type quality scene subimage subrange size tile texture treedepth undercolor); my %LegalFilters = map { $_ = 1 } qw(AddNoise Blur Border Charcoal Chop Contrast Crop Colorize Comment CycleColormap Despeckle Draw Edge Emboss Enhance Equalize Flip Flop Frame Gamma Implode Label Layer Magnify Map Minify Modulate Negate Normalize OilPaint Opaque Quantize Raise ReduceNoise Rotate Sample Scale Segment Shade Sharpen Shear Solarize Spread Swirl Texture Transparent Threshold Trim Wave Zoom); sub handler { my $r = shift; # get the name of the requested file my $file = $r-filename; # If the file exists and there are no transformation arguments # just decline the transaction. It will be handled as usual. return DECLINED unless $r-args || $r-path_info || !-r $r-finfo; my $source; my ($base, $directory, $extension) = fileparse($file, '\.\w+'); if (-r $r-finfo) { # file exists, so it becomes the source $source = $file; } else { # file doesn't exist, so we search for it return DECLINED unless -r $directory; $source = find_image($r, $directory, $base); } unless ($source) { $r-log_error("Couldn't find a replacement for $file"); return NOT_FOUND; } $r-send_http_header; return OK if $r-header_only; # Read the image my $q = Image::Magick-new; my $err = $q-Read($source); # Conversion arguments are kept in the query string, and the # image filter operations are kept in the path info my(%arguments) = $r-args; # Run the filters foreach (split '/', $r-path_info) { my $filter = ucfirst $_; next unless $LegalFilters{$filter}; $err ||= $q-$filter(%arguments); } # Remove invalid arguments before the conversion foreach (keys %arguments) { delete $arguments{$_} unless $LegalArguments{$_}; } # Create a temporary file name to use for conversion my($tmpnam, $fh) = Apache::File-tmpfile; # Write out the modified image open(STDOUT, "=" . fileno($fh)); $extension =~ s/^\.//; $err ||= $q-Write('filename' = "\U$extension\L:-", %arguments); if ($err) { unlink $tmpnam; $r-log_error($err); return SERVER_ERROR; } close $fh; # At this point the conversion is all done! # reopen for reading $fh = Apache::File-new($tmpnam); unless ($fh) { $r-log_error("Couldn't open $tmpnam: $!"); return SERVER_ERROR; } # send the file $r-send_fd($fh); # clean up and go unlink $tmpnam; return OK; } sub find_image { my ($r, $directory, $base) = @_; my $dh = DirHandle-new($directory) or return; my $source; for my $entry ($dh-read) { my $candidate = fileparse($entry, '\.\w+'); if ($base eq $candidate) { # determine whether this is an image file $source = join '', $directory, $entry; my $subr = $r-lookup_file($source); last if $subr-content_type =~ m:^image/:; $source = ""; } } $dh-close; return $source; } 1; __END__
Re: Can't locate object method OPEN via package Apache
darren chamberlain wrote: Try using CORE::open to be sure that the default open is being called. tried it, I am getting the same error, any more ideas? Sam
Re: [admin] NO HTML posts please!
Stas Bekman wrote: Folks, please refrain from posting in HTML. Some of us use email clients that post and read email in the old good text mode. When I don't have enough time on my hands I delete such emails since I cannot read them right away. Probably others too. Please don't tell me to get more _sophisticated_ email client, my pine does everything for me. HTML should NOT be used for posting emails. And then there are those of us that do have sophisticated email clients that simply don't care for HTML posting. I agree 100%, keep it simple, keep it TEXT! Sam
adding Server-Side Includes to default files
I would like to have server-side includes to be parsed on DirectoryIndex files. I have followed the example in "Writing Apache Modules in Perl and C" and have my Apache::ESSI and this is what is in my perl.conf: Files ~ "\.ehtml$" SetHandler perl-script PerlHandler Appache::ESSI PerlSetVar ESSIDefs conf/essi.defs /Files AddType text/html .ehtml What type of directive to I need to put into perl.conf so that the code gets called on a directory index file? Sam
getting Image::Magick
I am trying to get Image::Magick compiled and installed. I am using CPAN and am getting this error: --- AutoSplitting blib/lib/Image/Magick.pm (blib/lib/auto/Image/Magick) /usr/local/bin/perl -I/usr/local/lib/perl5/5.6.0/i686-linux -I/usr/local/lib/perl5/5.6.0 /usr/local/lib/perl5/5.6.0/ExtUtils/xsubpp -typemap /usr/local/lib/perl5/5.6.0/ExtUtils/typemap Magick.xs Magick.xsc mv Magick.xsc Magick.c cc -c -I.. -I/usr/local/include -I/usr/openwin/include -I/usr/openwin/include/X11 -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"4.28\" -DXS_VERSION=\"4.28\" -fpic -I/usr/local/lib/perl5/5.6.0/i686-linux/CORE Magick.c In file included from /usr/local/include/magick/magick.h:45, from Magick.xs:78: /usr/include/assert.h:79: warning: `assert' redefined /usr/local/lib/perl5/5.6.0/i686-linux/CORE/perl.h:2054: warning: this is the location of the previous definition Magick.xs:79: magick/defines.h: No such file or directory make: *** [Magick.o] Error 1 /usr/bin/make -- NOT OK Running make test Oops, make had returned bad status Running make install Oops, make had returned bad status --- Has anyone seen this error before? Any thoughts on how to fix it? Sam Carleton