Apache2 HellowWorld question
Hi, I just downloaded Randy's win32 build of Apache2. I do not understand in httpd.conf: PerlSwitches -Mblib=C:\Apache2 PerlModule Apache2 PerlResponseHandler Apache::HelloWorld SetHandler modperl But in the directory, HellowWorld.pm is under C:/Apache2/blib/lib/Apache2/Apache I thought it should be under C:/Apache2/blib/lib/Apache??? Thanks. Steve Lihn FIS Database Support, Merck & Co., Inc. Tel: (908) 423 - 4441 -- Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it. ==
Re: [ANNOUNCE] The New "mod_perl" logo - results now in...
Mark Fowler wrote: > > On Fri, 15 Mar 2002, Jonathan M. Hollin wrote: > > > However, I request your comments on this idea: should we have just one > > button (helping to develop a distinct identity for mod_perl) or should > > we have several (for choice)? It's up to you... > > I think that we need one "theme" of buttons, to ensure consistent > branding. As per my comments when I voted stated, I'd love to see some > buttons/logos based on the winning logo. In particular: > > - A square button that's just made up of the square cog logo > - A square button that's just made up of a grey m and a blue p > - A small rectangle version of the words modperl without the cog > > ...you get the idea, variations around a central design > > Also, we could do with both a monochrome and a black and white version of > the logo (for print.) > > Is the logo available in a vector file format so that we can easily make > scaled copies of it? Or are we restricted to the pixel banners that > currently exist? > > Later. > > Mark. > > -- > s'' Mark Fowler London.pm Bath.pm > http://www.twoshortplanks.com/ [EMAIL PROTECTED] > ';use Term'Cap;$t=Tgetent Term'Cap{};print$t->Tputs(cl);for$w(split/ +/ > ){for(0..30){$|=print$t->Tgoto(cm,$_,$y)." $w";select$k,$k,$k,.03}$y+=2} I definitely agree with this. I'd like to see some more colour variations (maybe just background colours even) to allow it to fit into a site's design better. Jonathan asked whether we should have just one button, or several. I'd say just one theme, with several variations as mentioned above. Others have suggested several buttons and I'm assuming they mean with differing themes. I'm against that, as the point of a logo is to reinforce the branding of mod_perl. Of course, if people don't want to use this theme, they won't. That's fine. That's no worse than the current situation. Finally, I think the mod_perl/modperl/ModPerl/Mod_perl thing is a non-issue. We all know what is being talked about, right? It's nowhere near as bad as the .gif "hard 'G' or soft 'G'" or the vi "V.I. versus 'vie'" problems. Steve -- Steve Piner Web Applications Developer Marketview Limited http://www.marketview.co.nz
Re: [OT] RE: Installing Perl::Magick
"Jonathan M. Hollin" <[EMAIL PROTECTED]> wrote: > I appreciate that. This is part of a mod_perl project, however I forgot > to include "[OT]" in the subject line. The only reason I post here is > that the quality of help, and accuracy of reply that I have experienced > in the past is exactly what I need to get over my initial Linux > confusion. However, if anyone knows of a _good_ Linux list... isp-linux? See http://isp-lists.isp-planet.com/isp-linux/ for mailing list subscription. The ImageMagick mailing list, magick-users is also problably a good resource for your problem. mailto:[EMAIL PROTECTED]?subject=subscribe Both lists are what I consider medium volume. You may also want to check for a list related to your Linux distro. A good place to find archives of hundreds of mailing lists which have a nice search interface is http://marc.theaimsgroup.com/. HTH, -- Steve Werby President, Befriend Internet Services LLC http://www.befriend.com/
Re: Question...
Do you need to expire the cookie when you leave the page? How about the following. When they login, you send down a cookie. when they go to that page, you check the cookie they sent, but send out a new value for that cookie, invalidating it. So when they leave that page they send back your invalid cookie. When they go back to the page, they'll send the invalid cookie, and you can then prompt them to log in or whatever. You'll get the invalid cookie sent back for images on that page, but that usually isn't a problem. Steve Piner Ryan Parr wrote: > > I think I'm missing something... > > If you set a session cookie (i.e. one with no expiry time) then the cookie > will be deleted immediately upon browser close, forcing the user to login > again if they've closed their browser instance. > > If you don't use cookies and allow basic auth then the exact same behavior > is called, forcing the user to re-login only if they've closed that browser > instance. > > Is there someway to expire cookies on page leave, or is this the smartass > thing you were referring to? :) > > -- Ryan Parr > > - Original Message - > From: "Jon Robison" <[EMAIL PROTECTED]> > To: "Ron Beck" <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Tuesday, February 12, 2002 12:28 PM > Subject: Re: Question... > > > Cookies! > > > > /me is in smartass mode today. > > > > --Jon > > > > Ron Beck wrote: > > > > > > Hello all, > > > I need to know how to clear the $ENV variables. For example, I use a > > > .htaccess file for specific directories which requires the user to enter > > > userID and password. When they exit the page, I want them to have to > > > re-enter userID and passwd if they enter the page again. Does anyone > > > know how this is accomplished? > > > > > > TIA, > > > Ron
Re: Single login/sign-on for different web apps?
Vsevolod Ilyushchenko wrote: > Yes, but I still should be able to propely handle people who go to any of > the protected sites first thing in the morning. I don't think I can get > away with only exit-point authentication that you propose. If the > entrance-point authentication works well, there should be no need for this > additional level. (Please correct me if I am wrong. :) Do cookies get set if returned via an image? If so, once the user has logged in, you could return a page with invisible images on it, where each image is from each site that the user needs to be authenticated to. Each image is unimportant. The important bit is that an authentication cookie is set for each domain the image is returned from. This leaves one tricky point as far as I can see: you need to securely identify which image request comes from each user. The obvious/easy way would be to put some sort of unique identifier in the path or query string, but this may not be secure enough for your purposes. Oh yeah, it'd break if they didn't have images on. :-( Steve -- Steve Piner Web Applications Developer Marketview Limited http://www.marketview.co.nz
Re: Apache::AuthCookie login faliure reason
>I am having some trouble getting Apache::AuthCookie (version 3 which i >believe is the latest version) to do what want: >What i want is: >* To be able to give the user a reson if login fails > - eg reason: * "No such username" >* "Your password was incorrect" >Has anyone else come across the same requirement/issue, and how have you >solved it? I banged my head up against this same wall for awhile until, by reading AuthCookie's source, I was able to figure out the key to making it all work. In authen_cred (stripped-down example below), you need to set a cookie with a value that your ticket-checking code will know is invalid when you are given invalid credentials. But, in the interest of security, you don't want to say things like "no such username" and "incorrect password" - that just gives extra information to someone trying to hack their way in. sub authen_cred ($$\@) { my $self = shift; my $r = shift; my ($user,$pass) = @_; if ( check_creds($user,$pass) ) { # user's credentials are good, so generate ticket, log session, etc return "$user:$ticket"; } else { # Modify this (and the code above) if you want more shades of # meaning here. return "oops"; } } Then, in authen_ses_key: sub authen_ses_key ($$$) { my $self = shift; my $r = shift; my($user,$ticket) = split(/:/,shift,2); my $retval; return undef unless $user && $ticket; if ( # ticket is good... $retval = # something indicating ticket is good... } else { # ticket is bad, so tell the login program/form about it... $r->subprocess_env('LocalAuthFailure','mumble') if ...; } # I also detect an expired session and indicate it like this: $r->subprocess_env('LocalAuthFailure','expired') unless $retval; if ( $retval ) { my $auth_name = $r->auth_name; # etc... } } After all that, your login program/form just reads "LocalAuthFailure" and acts appropriately: my ($reason,$detail); if ( $r->prev ) { $reason = $r->prev->subprocess_env("AuthCookieReason"); $detail = $r->prev->subprocess_env("LocalAuthFailure"); } #... # Possibly set an error string: my $error; $error = "Authentication error. Please try again." if $reason =~ /bad/; $error = "Your session has expired. Please reauthenticate." if $reason =~ /bad/ && $detail =~ /expire/; # Now interpolate $error into the HTML we send to the browser my $form = < ... $error ... I hope that these code snippets are enough to get you started. ...Steve -- Steve van der Burg Information Services London Health Sciences Centre (519) 685-8300 ext 35559 [EMAIL PROTECTED]
Re: Install problems
John Michael wrote: > Checking if your kit is complete. > Looks good > Writing Makefile for libapreq > mkdir blib/lib > mkdir blib/lib/auto > mkdir blib/lib/auto/libapreq > mkdir blib/man3 > cp libapreq.pod blib/lib/libapreq.pod > cp lib/Apache/libapreq.pm blib/lib/Apache/libapreq.pm > make[1]: Entering directory `/usr/local/etc/libapreq-0.33/c' > gcc -c -I/usr/lib/perl5/site_perl/5.6.0/i386-linux/auto/Apache/include > -I/us > r/lib/ > perl5/site_perl/5.6.0/i386-linux/auto/Apache/include/modules/perl > -fno-stric > t- > aliasing -02 -march=i386 -mcpu=i386 -DVERSION=\"0.10\" > -DXS_VERSION=\"0.10\ > " > -fPIC -I/usr/lib/perl5/5.6.0/i386-linux/CORE apache_request.c > In file included from apache_request.c:58: > apache_request.h:5:19: httpd.h: No such file or directory > apache_request.h:6:25: http_config.h: No such file or directory > apache_request.h:7:23: http_core.h: No such file or directory > apache_request.h:8:22: http_log.h: No such file or directory > apache_request.h:9:23: http_main.h: No such file or directory > apache_request.h:10:27: http_portocol.h: No such file or directory > apache_request.h:11:25: util_script.h: No such file or directory > make[1]: *** [apache_request.o] Error 1 > make[1]: Leaving directory `/usr/local/etc/libapreq-0.33/c' > make[1]: *** [subdirs] Error 2 > > I'm confused. It looks like you might not have the 'apache-devel' package installed. (You did say you were on RedHat, didn't you?) Try installing that. Steve -- Steve Piner Web Applications Developer Marketview Limited http://www.marketview.co.nz
Re: Installing modules
John Michael wrote: > Where can I find information on how to install modules like: > Apache::Request libapreq-0.33.tar.gz > Apache::DBIApacheDBI-0.88.tar.gz > > Would I install these as regular perl modules or are they installed as > apache modules? They are regular perl modules. They only run under mod_perl though. :-) If you can, use the CPAN shell to install modules, (see 'perldoc CPAN') Otherwise, download and extract the module then change into its directory. Read the README and INSTALL files. Then - assuming those files don't say differently - type perl Makefile.PL make make test And if you're happy with the results, su to root and type make install Hope this helps. Steve -- Steve Piner Web Applications Developer Marketview Limited http://www.marketview.co.nz
RE: [OT] pdf creation
simran writes: > I believe there is also a Content-disposition tag you can use to > tell the browser what to name the file... As mentioned below in my original post, it doesn't work in all browsers. Steve
Re: Apache 1.3.22 and modperl 1.26.
Brad Dameron wrote: > I installed mod perl and php 4 into along with apache 1.3.22. When I add the > following: > > > > AddHandler perl-script .cgi > PerlHandler HTML::Mason > > > require "/var/conf/apache/handler.pl"; > > > > and then try to start apache I get this error: > > Syntax error on line 338 of /var/conf/apache/httpd.conf: > Invalid command '', perhaps mis-spelled or defined by a module not > include > d in the server configuration [trimmed] It sounds to me that when you recompiled mod_perl, you forgot to add PERL_SECTIONS=1 on the command line. Steve -- Steve Piner Web Applications Developer Marketview Limited http://www.marketview.co.nz
PerlInitHandler w/o PerlPostReadRequestHandler.
I came across an unexpected feature of PerlInitHandler today. In the distant past, for whatever reason, I configured mod_perl to have PerlInitHandler, but not PerlPostReadRequestHandler. Today I tried to hook a handler to PerlPostReadRequestHandler, and got an error on start up, saying that I hadn't compiled it in. Rather than recompile Apache, I dug out the Eagle book to find another suitable handler. I discovered PerlInitHandler. The Eagle says that PerlInitHandler is an alias for PerlPostReadRequestHandler when used at the 'top-level' of a configuration file. Great, I thought. I'll try it. Apache started quite happily. But my handler wasn't being called. Hmm, I thought. So I had a closer read of the PerlInitHandler section, and noted it said *alias*. To cut the story short, I recompiled apache, adding the 'PERL_POST_READ_REQUEST=1' necessary. It worked perfectly first time. My question is this: should PerlInitHandler have given me an error message? Steve -- Steve Piner Web Applications Developer Marketview Limited http://www.marketview.co.nz
Re: [OT] pdf creation
> Does anyone have success/horror stories generating pdf files under > mod_perl? Recommendations? I recently built a customer billing system system that generated PDF invoices using Latex + Template-Toolkit. See http://template-toolkit.org/docs/blue/Manual/Filters.html This was an backend system, but the files could easily be generated online by simply wrapping the template processor in a handler with the appropriate Content-Type: headers. Tip: Although the Content-Disposition: header is supposed to tell the browser the appropriate filename for the file, this doesn't actually work in most browsers. The solution is to extend the URL past the handler/script, e.g. : http://server/perl/pdfgen.pl/MYPDFFILE.pdf Apache will dispatch this to pdfgen.pl, but the browser will assume the default filename is MYPDFFILE.pdf. Hope this helps, Steve
Re: When to use 'use' for accessing modules?
Perrin Harkins wrote: > Chris Allen wrote: [...] > > Is $ENV{foo}='bar'; in startup.pl equivalent to PerlSetEnv foo bar > > in httpd.conf? > > Yes. Are you sure? I experimented a few months ago, and found that $ENV{foo}='bar'; would only last in each child until the first request of the child completed. Steve -- Steve Piner Web Applications Developer Marketview Limited http://www.marketview.co.nz
Re: mod_info.c and others via libexec?
Sounds like you did a static compile, read the docs regarding the DSO mechanism. Also, Apache 1.3.20 and mod_perl 1.26 are available. Steve. - Original Message - From: "El Capitan" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, October 03, 2001 4:03 PM Subject: mod_info.c and others via libexec? > Hi folks, > I'm new to the list as well as mod_perl and have just recently loaded > Apache/mod_perl (Server Version: Apache/1.3.19 (Unix) mod_perl/1.25) and > cant find any of the modules such as mod_info.c and others which are > supposed to be in ../libexec. In fact ../libexec is empty! Did I do > something wrong or do I need to load them separately... > Any help would be appreciated. > > Kirk > > >
Embperl, modules, cleanup and the stop button
Hi, I realise this is covered in part in the modperl guide, but I'd to ask for a bit of clarification/confirmation ... I have pages generated with embperl, with each page having it's own module to pull data from the database and pass it back to page in a hash, the first line of the embperl page being the call to the module (a pipeline/callback hybrid, if you like). This module in turn creates the appropriate database object. As the database routines may create table locks, and as I'm using Apache::DBI, the DB object constructor registers a cleanup handler that will unlock the tables if an abort has occured ($r->connection->aborted). My feeling that this cleanup is infact unnecessary (all though worth having regardless), as the pipeline nature of the request (call database for *all* data required, *then* output), any database calls (and corresponding locks) will have completed before the abort (SIGPIPE) is recognised. This should go double for embperl, which executes all perl code before outputting any headers and data. So I'd like to ask the group, am I right in this analysis, or am I missing anything here? Thanks, Steve
Re: AuthCookie access denied messages
>you can set these in yourself by overwriting >the AuthCookie Response method > >you should catch these in your >own subs and send back messages > >for instance >in my Auth.pm authen_ses_key sub [ snip ] In addition to that, what I found confusing was actually getting authen_ses_key to be called in the first place, after a failed login attempt. The stock authen_cred returns data that will be loaded into a cookie only if authentication is successful. To get authen_ses_key to be called after an unsuccessful attempt, your authen_cred needs to do this: if ( check_creds() ) { # make a ticket, start a session, etc return $valid_ticket_data; } else { return "oops"; # make sure we never accept this as a valid cookie! } Now authen_ses_key gets called and AuthCookie will set AuthCookieReason to bad_cookie if you return undef. Also, you now have a chance to set other environment variables. ...Steve -- Steve van der Burg Information Services London Health Sciences Centre (519) 685-8300 ext 35559 [EMAIL PROTECTED]
Re: Problem with arrayrefs in PSections
Geoffrey Young wrote: > > without having an environment to test on or the Eagle book to reference... > > I seem to recall something in the Eagle book about arguments to Allow and > Deny - that "from 10.3.4.1" is really a single argument and not two (in the > TAKE2 sense), so maybe your approach is wrong and you need to make each of > those entries in your array a single string. Thanks, but that's not it. Allow => ['from 1.2.3.0/24', 'from 192.168.1.0/24'], is treated as the directive 'Allow from 1.2.3.0/24 from 192.168.1.0/24' which of course doesn't work. Allow => [['from 1.2.3.0/24'], ['from 192.168.1.0/24']], gives me the following error: [Mon Jul 30 09:55:21 2001] [error] : allow requires at least two arguments, 'from' followed by hostnames or IP-address wildcards The Eagle says that directives that occur multiple times should be an array of arrays. And it works when I'm not using a single arrayref for the configuration. Steve > -Original Message- > From: Steve Piner > To: [EMAIL PROTECTED] > Sent: 7/27/01 12:26 AM > Subject: Problem with arrayrefs in PSections > > I've come across an oddity in configuring Apache through Perl sections. > > If I have a local as follows, > > my %access = ( > Order => 'deny,allow', > Deny => 'from all', > Allow => [['from', '1.2.3.0/24'], > ['from', '192.168.1.0/24']], > ); > > then set up locations (or directorys) as follows > > %Location = ( > '/server-status' => { > SetHandler => 'server-status', > %access, > }, > '/server-info' => { > SetHandler => 'server-info', > %access, > }, > ); > > Then only one of the locations will let me access it. > > http://servername/server-status will let me in, > http://servername/server-info won't. > > The problem seems to be with the shared reference: changing the 'Allow' > line above to > Allow => 'from all' works - though without the desired restriction of > course, as does > changing the code above to the following. > > %Location = ( > '/server-status' => { > SetHandler => 'server-status', > %access, > Allow => [['from', '1.2.3.0/24'], > ['from', '192.168.1.0/24']], > }, > '/server-info' => { > SetHandler => 'server-info', > %access, > Allow => [['from', '1.2.3.0/24'], > ['from', '192.168.1.0/24']], > }, > ); > > Is this a bug, a stupid-user problem, or something else? > > I'm using Apache/1.3.20, mod_perl/1.25 and 1.26, and Perl v5.6.1 > > Steve > > -- > Steve Piner > Web Applications Developer > Marketview Limited > http://www.marketview.co.nz -- Steve Piner Web Applications Developer Marketview Limited http://www.marketview.co.nz
Problem with arrayrefs in PSections
I've come across an oddity in configuring Apache through Perl sections. If I have a local as follows, my %access = ( Order => 'deny,allow', Deny => 'from all', Allow => [['from', '1.2.3.0/24'], ['from', '192.168.1.0/24']], ); then set up locations (or directorys) as follows %Location = ( '/server-status' => { SetHandler => 'server-status', %access, }, '/server-info' => { SetHandler => 'server-info', %access, }, ); Then only one of the locations will let me access it. http://servername/server-status will let me in, http://servername/server-info won't. The problem seems to be with the shared reference: changing the 'Allow' line above to Allow => 'from all' works - though without the desired restriction of course, as does changing the code above to the following. %Location = ( '/server-status' => { SetHandler => 'server-status', %access, Allow => [['from', '1.2.3.0/24'], ['from', '192.168.1.0/24']], }, '/server-info' => { SetHandler => 'server-info', %access, Allow => [['from', '1.2.3.0/24'], ['from', '192.168.1.0/24']], }, ); Is this a bug, a stupid-user problem, or something else? I'm using Apache/1.3.20, mod_perl/1.25 and 1.26, and Perl v5.6.1 Steve -- Steve Piner Web Applications Developer Marketview Limited http://www.marketview.co.nz
Capturing CGI output
I have a mod_perl library that utilizes the Tempate Toolkit so that html files are parsed through the toolkit before being sent back to the browser. It works great but now they require that the library be upgraded to include support for CGI's. In other words I need to capture the output of the CGI as though it were a template and parse it as well. I can use $r->lookup_uri('/cgifile.cgi') to gather up the subrequest and run it using the run() command. However, the information from the CGI is passed back to the browser instead of handed off to me for processing. Is there some way to capture that information? Thanks, STEVE
Re: comparison of templating methods?
> HTML::Embperl For me, this has one major win over the other toolkits: auto form population from a hash. The online mortgage application system I wrote has about 1,800 form fields, which have to be populated with data from a database. By making the form fields match DB column names, I can reduce the code to do this to: my $data = $dbh->fetchrow_hashref($query); %fdat = (%fdat, %$data); Embperl then parses the form and populates it with the matching name=>value pairs in %fdat, including select options. Beautiful! Steve
RE: Trying to find correct format for PerlSetVar's -- or get Apache::AuthNetLDAP working.
Hi, (btw threading broken because I'm replying from a digest) I do multiple "PerlSetVar"s from inside a Location (itself inside a VirtualHost) like this: PerlSetVar => [['User', $user], ['Locale', $locale], ... ] I've also had some wierdness happen with mod_perl not reporting syntax errors and other problems in sections that I'm now unable to reproduce :| SRH -- + Steve Haslam |W: +44-20-7447-1839+ + /excite/intl/uk/softeng|M: +44-7775-645618 + .Spare a thought for me because I see the things that you don't see.
Re: Content-Disposition to change type and action?
"Steve" == Steve Piner <[EMAIL PROTECTED]> writes: > So going to <http://www.mysite.com/reports/foo.csv?param1=val1> > would be the same as going to > <http://www.mysite.com/bin/report.pl?param1=val1> except if the page > is to be downloaded, the browser will use the name foo.csv. This also works : http://www.mysite.com/bin/report.pl/foo.csv?param1=val1 report.pl gets called with param1=val1, but if you set the appropriate Content-Type the browser prompt to save it to foo.csv. Works in Netscape and IE. Of course, this is what Content-Disposition is *supposed* to do; ho hum. Cheers, Steve
Re: Content-Disposition to change type and action?
Jay Jacobs wrote: > I've got a form that will (should) send various formats back to the client > depending on form values. They may want the results back in csv, pdf or > plain html. The form always submits to a .html, and the browser usually > expects an html. My suggestion is to use mod_rewrite to create a mapping so that the actual file name doesn't matter. I have a rule in the Apache conf file: RewriteRule ^/reports/ /bin/report.pl [PT] So going to <http://www.mysite.com/reports/foo.csv?param1=val1> would be the same as going to <http://www.mysite.com/bin/report.pl?param1=val1> except if the page is to be downloaded, the browser will use the name foo.csv. There's another parameter which gets passed to /reports/whatever.csv to indicate that it should generate a csv, and send a suitable Content-Type, but getting the 'name' right solves half the problem. Steve -- Steve Piner Web Applications Developer Marketview Limited http://www.marketview.co.nz
Re: Reverse engineered HTML
>>Does a package exist that will read an HTML document and generate an = >>Apache::Registry cgi script? Even better if it accepts an
Re: Reading the environment in block
On Mon, 7 May 2001, Benoit Caron wrote: > The way I've setup whole thing is like that : a script name restart is > called with some parameters telling him to reload one or all the > developpers environment, or the "testing" copy. This script would have some > environments variables called SITE_USER and SITE_USER_PORT that will give > me the value (read in a file defining the different users) of the username > (and by the same way the files path) and the port where the user should work. > > My problem is that my envirnoment variables are not set. If I do a > Dumper(\%ENV), I only got values for the variables TZ, GATEWAY_INTERFACE, > MOD_PERL and PATH. (I do double-check that my variables where well setup). You could try PerlPassEnv: PerlPassEnv SITE_USER PerlPassEnv SITE_USER_PORT ...but the solution I've used is to have the startup script dynamically build a configuration based on a configuration "template". In fact, the script doesn't even live in /etc anywhere -- it's part of the CVS checked out area that each developer has individually. The config template is just a standard Apache config file with special @@ tokens in it like the Apache *.orig files: ServerRoot @@SERVERROOT@@ Port @@SERVERPORT@@ The script changes these tokens when (re)starting Apache, and runs "apache -f /tmp/httpd-[user]-[port].conf". It also takes things a step further in that it automatically calculates a port number based on the value of the "server root", by running it through "sum". This way, you don't need to decide on a port for everybody -- they just check out a copy of the website and start it. If they want to have another copy of the website, let's say under ~/website-hacking, that's fine -- it'll decide on a different port automatically. I can send the startup script and config template if you want to see what I mean. > The only way I still see to make it work is having my "restart" script > saving the current user/port in a file and letting the section read > it's configuration from there. But it look so patchy... Eyuuc
RE: Exception modules
Title: RE: Exception modules unsubscribe please- thanks -Original Message- From: Matt Sergeant [mailto:[EMAIL PROTECTED]] Sent: Monday, April 30, 2001 4:29 PM To: Jeffrey W. Baker Cc: [EMAIL PROTECTED] Subject: Re: Exception modules On Mon, 30 Apr 2001, Jeffrey W. Baker wrote: > > > On Mon, 30 Apr 2001, Matt Sergeant wrote: > > > > > > [1] for my Perl exception package (yes, another one :) which, in its > > > development version, now mostly does the Right Thing for mod_perl. See > > > http://sourceforge.net/projects/perlexception/ for the curious. > > > > Since I'm doing the mod_perl exception handling talk at TPC, I feel > > obligated to ask about this... > > > > It doesn't seem any different from Error.pm to me, except in syntax. Maybe > > you could expand on why/where it is different? > > I tried using some different exception packages in the past. What I > realized is, die() and eval {} ARE Perl's exception handling mechanism. > die() and eval {}, together, have complete exception throwing and handling > functionality. As a bonus, they lack Java's exception bondage and > discipline. > > So, what's wrong with die() and eval {}? Nothing, IMHO. In fact I've now switched away from using Error.pm's try/catch syntax, because it creates closures and it's really easy to generate memory leaks that way with mod_perl. But I still use Error.pm's exception object structure... Without some sort of structured exception handling, you don't know exactly what type of exception was thrown. For example, in AxKit I need to know in certain places if an IO exception occured, or if it was some other kind of exception. I could do this with regexps, but then I'm relying on people using the right strings in their error messages. Plus exception objects can give you a stack trace, which eval catching a string can't (well, it kinda can in a few ways, but not in quite as clean a manner). Try it though, you might be surprised you like it. (unless by die() and eval{} you mean you're already using exception objects, in which case I'm preaching to the choir ;-) -- /|| ** Founder and CTO ** ** http://axkit.com/ ** //|| ** AxKit.com Ltd ** ** XML Application Serving ** // || ** http://axkit.org ** ** XSLT, XPathScript, XSP ** // \\| // ** mod_perl news and resources: http://take23.org ** \\// //\\ // \\
Must restart Apache when any .pm changes?
I'm experimenting with using Perl modules (.pm files) underneath Mason components. As far as I can see, the only way to guarantee that changes made in the .pm are seen by the Mason code is to restart Apache whever the .pm file changes. This is true whether the "use" statement is in handler.pl or in the component. I believe the way this works is that the first time any Apache child process sees "use Foo" that is the version of Foo.pm that will be used by that process. No subsequent "use Foo" within components will have any effect during the life of that Apache process. Am I understanding this correctly?
Question and problem with graphics and Apache:ASP running.
When I turn on Apache:ASP and try to load a few html files it messes up the graphics at the top. Now if I turn off the ASP, graphics load fine... Page with banner graphics split up: http://www.clark.cc.oh.us/asp/student.html page with one banner graphic...: http://www.clark.cc.oh.us/asp/student2.html in http.conf: SetHandler perl-script PerlHandler Apache::ASP PerlSetVar Global /tmp The split up version will work but the one banner will be distorted. Now if I save as on the graphic and view it, it looks fine Any ideas??? Thanks, Steve
Re: Shared memory between child processes
At 5:30 PM -0800 3/30/01, Randy J. Ray wrote: >I understand the forking model of Apache, and what that means in terms of >data initialized in the start-up phase being ready-to-go in each child >process. But what I need to do is manage it so that a particular value is >shared between all children, such that changes made by one are recognized >by the others. In a simple case, imagine wanting to count how many times >total the given handler is invoked. Bumping a global counter will still be >local to the given child process, and if part of the handler's interface is >to report this counter value, then the reported number is going to be >dependent upon which child answers the request. > >I'm needing to implement a handler that uses a true Singleton pattern for >the class instance. One per server, not just one per process (or thread). > You'll need to use some form of persistance mechanism such as a database, file, or perhaps (assuming you're on a Unix system) something like System V shared memory or semaphores. One quick 'n cheap way to implement mutual exclusion between Unix processes (executing on the same processor) is to use mkdir, which is atomic (ie once a process requests a mkdir, the mkdir will either be done or rejected before the requesting process is preempted by any other process). So you can do mkdir "xyz" if "xyz" already exists, wait or return an error read or write shared variable on disc rmdir "xyz" to guarantee that only one process at a time can be trying to access a disc file. There are many possible variations on this theme.
Re: /dev/null problems
Not answering your mod_perl question here, but I believe this suggestion in the guide isn't useful advice in any event -- this isn't 'echo'ing to /dev/null as su (root); rather it's 'echo'ing a line as su, and you (normal user) are redirecting that output to /dev/null. I.e., the grouping of that command is like so (yeah, I know, this is in no way intended to be real shell syntax, just to show the semantics...): (sudo echo) > /dev/null rather than: sudo (echo >/dev/null) Not sure what is trying to be accomplished by either of these, but in the interests of clarity in the guide, I think this ought to be either corrected or removed entirely. I'll volunteer to make the changes, if someone can clarify exactly what the intended result is. Stas? What do you say? Am I missing something here? On 28 Mar 2001, Matthew Kennedy wrote: > Hello, > > >From the mod_perl guide: > > syntax error at /dev/null line 1, near "line arguments:" > Execution of /dev/null aborted due to compilation errors. > parse: Undefined error: 0 > There is a chance that your /dev/null device is broken. Try: > % sudo echo > /dev/null > > This is exactly the problem I have been getting when starting Apache > mod_perl, however the suggested fix does not work for me. We're on a > HPUX 11 machine. Is there another way to solve this problem? As I > understand it, if /dev/null is being used as the $0 argument to the > handler, perhaps I could somehow explicitly set it to another (empty) > file? How would I go about that? > > Does anyone have any suggestions? > > Thanks, > > Matt > -- =-=-=-=-=-=-=-=-=-=- My God! What have I done? -=-=-=-=-=-=-=-=-=-= Steve Reppucci [EMAIL PROTECTED] | Logical Choice Software http://logsoft.com/ |
Re: [OT] ApacheCon BOF
Well, I've been resisting any replies here, especially since I've *never* been accused of being "politically correct", but since we're tossing in pennies, here are my two: I agree that the use of *any* symbols of a race or religion to represent a sports team (or anything else of that ilk) is at least distasteful, and probably even downright insulting given way those symbols are used in a typical sports setting -- see the Atlanta Braves and their idiot fans' "Tomahawk Chop". However, IMHO, the use of the name "Apache" shouldn't in any way be interpreted as demeaning here. We're using it for something that we all hold in the highest respect -- well written, open, highly useable software that's the most popular in the world for its task. I don't believe I've ever seen any representation of the Apache logos used in any way that connoted anything but respect and admiration. Yes, I'm an *not* of Native American descent (I'd love to hear the viewpoint of someone who *is*...), so maybe there's something that I don't understand here. But I don't think I'd be personally offended if we were calling this "the Italian server", or "the French-Canadian server", or "the American server" (which covers my ethnic backgrounds...;^) In fact, I think I'd feel some pride in having a quality product associated with what I identify with. (And in a little tangent to give folks something to flame, I've never understood why people get so offended about sports teams using "warrior" in their names. My home town recently changed their team names from "The Golden Warriors" to "The Golden Eagles", because of a discussion like the one we're involved in here. Isn't "warriors" a generic term? Weren't there Amazon warriors? The Vikings? The Romans? etc.?) Some folks spend way too much time looking for something to be offended by, again IMHO. That's my 2 (or 3) cents... On Wed, 21 Mar 2001, Bakki Kudva wrote: > > I am not trolling here nor am I particularly trying to be 'politically > correct' but after seeing Sherman Alexie's award winning movie "Smoke > Signals" and listening to him (just yesterday on 60 Minutes II) I have a > developed a new understanding and respect for Native American symbologies > and their relegious significance to them. > > To quote Alexie:(http://www.fallsapart.com/art-side.html) > > "Alexie: It's part of the national consciousness. If people start dealing > with Indian culture and Indian peoples truthfully in this country, we're > going to have to start dealing with the genocide that happened here. In > order to start dealing truthfully with our cultures, they have to start > dealing truthfully with that great sin, the original sin of this country, > and that's not going to happen. > > Just look at the sports teams. You couldn't have a team called the > Washington Kikes or the Washington Micks. But yet you can have the > Washington Redskins and this Indian with a big nose and big lips running > around. How would you feel if it was the Washington Rabbis and you had a > guy with braids running around throwing bagels? Or the Washington Jesuits > with some guy handing out communion wafers. It wouldn't happen. So, it's > an insult. It's proof of the ways in which we get ignored." > > So it MIGHT be distasteful to use these Native American metaphors no > matter how innocuous they might seem to us. > > My 2cents worth, -- =-=-=-=-=-=-=-=-=-=- My God! What have I done? -=-=-=-=-=-=-=-=-=-= Steve Reppucci [EMAIL PROTECTED] | Logical Choice Software http://logsoft.com/ |
Shared variables, inner subs and "our"
Hi, I was just tidying up an old mod_perl script which had some ugly "use vars qw(...);" lines in it which I thought I'd replace with "our ...;". I realise this isn't always a good idea since "our" is not intended as a replacement for "use vars", but its often OK and I thought it would be in my case. I was only half right: The script still works fine, but emits warnings which it previously didn't about "variable will not stay shared". The mod_perl Guide (1.28) refers to such problems in section 3.5: It gives as an example the following program: use strict; use warnings; sub print_power_of_2 { my $x = shift; sub power_of_2 { return $x ** 2; } my $result = power_of_2(); print "$x^2 = $result\n"; } print_power_of_2(5); print_power_of_2(6); This prints: Variable "$x" will not stay shared at ./nested.pl line 7. 5^2 = 25 6^2 = 25 The solution is to use a package-global $x which won't get deep-bound into power_of_2(): use strict; use warnings; sub print_power_of_2 { use vars qw($x); $x = shift; sub power_of_2 { return $x ** 2; } my $result = power_of_2(); print "$x^2 = $result\n"; } print_power_of_2(5); print_power_of_2(6); This prints: 5^2 = 25 6^2 = 36 However, if you change the ugly "use vars" to the sexier-although-not-quite-the-same "our": use strict; use warnings; sub print_power_of_2 { our $x = shift; sub power_of_2 { return $x ** 2; } my $result = power_of_2(); print "$x^2 = $result\n"; } print_power_of_2(5); print_power_of_2(6); then it prints: Variable "$x" will not stay shared at ./nested.pl line 7. 5^2 = 25 6^2 = 36 !!! In other words, we get a bizarre cross between the two: the warning about $x not staying shared is emitted, but of course its nonsense (?) because package-globals don't get deep-bound into subroutines anyway, and the program actually works fine! The eagle-eyed will have noticed that the above "use vars" solution is not *exactly* as presented in the mod_perl Guide: the solution there puts the "use vars" *outside" of the declaration of print_power_of_2(), not *inside* as above. This, of course, makes no difference to "use vars" which affects the package, not a lexical scope. But it *does* make a big difference to "our", which applies to a lexical scope, not a package: If we move the "our" *outside* of the declaration of print_power_of_2(): use strict; use warnings; our $x; sub print_power_of_2 { $x = shift; sub power_of_2 { return $x ** 2; } my $result = power_of_2(); print "$x^2 = $result\n"; } print_power_of_2(5); print_power_of_2(6); then the confusing warning goes away: 5^2 = 25 6^2 = 36 Why am I bringing this up? (a) because I think the mod_perl Guide needs to mention the use of "our" as well as "use vars" (they're only very briefly mentioned, regarding something else, in section 10.6.5); (b) because I can't actually do what I just did above in my mod_perl script! I run my mod_perl script under Apache::Registry, which (as we all know) makes the script into a subroutine, and therefore any subroutines into inner subroutines. In the example above, print_power_of_2() is like my script, power_of_2() is like a subroutine in my script, and the two calls to print_power_of_2() are like my script being run twice. Obviously I can't move the "our" declaration *outside* my script like I did above (unless Apache::Registry did this for me when it does its stuff with my script), so I'm stuck with the warning (or else "use vars"). Is there some reason why the warning gets emitted with "our" inside print_power_of_2()? Was I just lucky that this particular example worked and I should really heed the warning, or is the warning actually bogus? Is there any way I can use "our" rather than "use vars" and not get these warnings? - Steve Hay
Re: incompat. with apache/mod_perl upgrade
At 12:26 PM -0500 3/12/01, Khachaturov, Vassilii wrote: >When I upgraded from >Solaris Apache/1.3.14 (Unix) mod_perl/1.24_01 >to >Solaris Apache/1.3.17 (Unix) mod_perl/1.25 > >the following code in my debugging httpd.conf broke: > > >sub WWW_DIR () { $ENV{'HOME'} . '/www' ; } # this sub will persist to next > >... more code, using WWW_DIR sometimes > When I built Apache 1.3.17 with mod_perl 1.2.5 and numerous other mods, the resulting httpd was unable to read its usual configuration file. When I upgraded to Apache 1.3.19 the problem went away. I'd try 1.3.19.
Re: Stop button (was: Re: General Question)
Bill Moseley wrote: > At 02:02 PM 02/26/01 +0000, Steve Hay wrote: > >I have a script which I wish to run under either mod_perl or CGI which does > >little more than display content and I would like it to stop when the user > >presses Stop, but I can't get it working. > > You need to do different things under mod_perl and mod_cgi. Refer to the > Guide for running under mod_perl -- you probably should check explicitly > for an aborted connection as the guide shows. Oh dear. The program has to run on various different machines around the place, some of which run Apache/mod_perl and some of which run Microsoft IIS/CGI, so I really want one solution which works in both environments if at all possible. > [This is all from my memory, so I hope I have the details correct] > > Under mod_cgi Apache will receive the SIGPIPE when it tries to print to the > socket. Since your CGI script is running as a subprocess (that has been > marked "kill_after_timeout", I believe), apache will first close the pipe > from your CGI program, send it a SIGTERM, wait three seconds, then send a > SIGKILL, and then reap. This all happens in alloc.c, IIRC. > > This is basically the same thing that happens when you have a timeout. > > So, you can catch SIGTERM and then have three seconds to clean up. You > won't see a SIGPIPE unless you try to print in that three second gap. I'm fairly sure the program does print in any given three second gap -- I see the "x"s appearing in my browser window (since output is "unbuffered") at the rate of two or three per second, so I really should get the SIGPIPE. I've also tried adding in a similar handler to try and catch a SIGTERM and exit(), but that doesn't seem to work either. Has anybody else had any luck responding to "Stop" on NT? Cheers, Steve Hay
Re: Stop button (was: Re: General Question)
Hi, Stas Bekman wrote: > Apache 1.3.6 and up -- STOP pressed: > > the code keeps on running until it tries to read from or write to the > socket. the moment this happens, the script will stop the execution, and > run cleanup phase. > > I think it's the same under mod_perl and mod_cgi. Am I right? I have a script which I wish to run under either mod_perl or CGI which does little more than display content and I would like it to stop when the user presses Stop, but I can't get it working. I've been trying to figure things out with the following test program: --- use strict; use warnings; $SIG{PIPE} = \&handler; $| = 1; print "Content-Type: text/plain\n\n"; for (;;) { for (1 .. 100) { ; } print "x\n"; } sub handler { # Unreliable signals on NT:- $SIG{PIPE} = \&handler; exit; } --- (The pointless time-wasting loop just before each print() is so that I can easily see whether the program actually has exited or not -- I'm running on NT (groan!) and I can see in my "Task Manager" display that the Apache child process is flat out 100% CPU while its running.) I would expect that when the user presses Stop and the script next tries a print() it'll get a SIGPIPE, call the handler(), and exit(). But it doesn't -- the Apache child process just carries on at 100% CPU. It makes no difference whether I run it under mod_perl or mod_cgi (except that, of course, I get a Perl process at 100% CPU instead of the Apache child), and it also makes no difference if I take out the first "$SIG{PIPE} = \&handler;" line (and rely on mod_perl to handle the SIGPIPE for me as Stas described above) and/or put the "PerlFixupHandler Apache::SIG" directive in my httpd.conf. Can anybody help/explain? I'm running Apache/1.3.17 and mod_perl/1.25 on Windows NT 4. Cheers, Steve Hay
Re: possible solution for "exec cgi SSI" in mod_perl
If you build modperl with 'perl Makefile.PL EVERYTHING=1' (or, at least with 'PERL_SSI=1', then your server side includes will have an additional option that looks like this: This will invoke routine 'DoSomething' when this page is expanded. You'll need to pre-load your module with a PerlRequire or PerlModule directive. You could also use Apache::SSI as the handler to do the same type of thing. Many details of how this works in the Eagle book. One warning: mod_perl *must* be built statically for PerlSSI stuff to work -- if you try to build it dynamically, the build tool prints a warning that "PerlSSI disabled in DSO build", or something like that. HTH, On Sun, 25 Feb 2001, Surat Singh Bhati wrote: > Hi, > > I am using lots of exec cgi SSI in my site, all the > CGI called using exec are written in perl. > > > I want to take advantage of mod_perl for performance, > but as I know "exec" will run as mod_cgi , not as mod_perl. > > Can I use ? > If above will run, will be run as a sub request.. ? > > Any other better solution to server the page included mod_perl scripts > SSI in it, without running the subrequest/new process? > > Regards, > > -Surat Singh Bhati > > > > > > =-=-=-=-=-=-=-=-=-=- My God! What have I done? -=-=-=-=-=-=-=-=-=-= Steve Reppucci [EMAIL PROTECTED] | Logical Choice Software http://logsoft.com/ |
[OT] Re: Just learning, and a little stuck...
Yes, this doesn't belong on this list. But: Couple of immediate problems: - If you pass a hash in an argument list, it gets inserted into the list as just a sequence of key,value pairs -- there's no way in the subroutine to determine that a hash was passed, as opposed to a simple list, or an array. You *can* pass it the way you're doing in your first example (since the final thing you're taking off the argument list in the subroutine is the hash), but I think most perl folks would agree that the second example (passing a hash reference) is better form. Obviously, this depends upon the semantics of the function you're writing. - 'shift' shifts one item off a list. You seem to be inferring that it will shift off as many as needed -- you can just use a list assignment, if that's what you want to do. I think you want one of these options: &join( $db, \%post); sub join { my ($db, $post_ref) = @_; foreach $key (keys %$post_ref) { or: &join( $db, %post); sub join { my ($db, %post) = @_; foreach $key (keys %post) { No, you definitely want to limit yourself from using 'local' until you understand the semantic differences between it and 'my'. 'Effective Perl Programming', by Joseph Hall has a nice description of this. HTH, On Fri, 23 Feb 2001, Alec Smith wrote: > This isn't specifically a mod_perl question, but something I'm having > trouble doing within mod_perl code. I'm far from a Perl expert, but I > try... > > I've got a hash called %post which contains submitted form info and a > variable $db which is the result of a DBI->connect call. I need to take > these 2 values and pass them into a subroutine. I've tried something like > > &join($db, %post); > > sub join > { >my ($db, %post) = shift (@_); >... > >foreach $key (keys(%post)) >{ > ... >} > } > > and > > &join ($db, \%post); > > sub join > { > my ($db, $post) = shift (@_); > > foreach $key (keys(%$post)) > { > %$post{$key} = $db->quote("%$post{$key}"); > } > } > > Using CGI-based Perl I suppose I could just use local() instead of my() > to avoid having to pass arguments, but didn't think this would be > advisable in mod_perl code. > > How can I manage to do what I'm trying to do? > > > Alec > > =-=-=-=-=-=-=-=-=-=- My God! What have I done? -=-=-=-=-=-=-=-=-=-= Steve Reppucci [EMAIL PROTECTED] | Logical Choice Software http://logsoft.com/ |
[OT] Re: Rotating Apache logs
This is definitely off topic for this list, however... I'm not exactly sure what you're asking here, but if what you're asking is "how do I rotate logfiles without doing a hard stop/start cycle?", then the answer is (from the command line...) rename the open logfiles, then send the server either a SIGHUP or a SIGUSR1, which will cause it to reopen its logfiles. SIGHUP does it "forcefully" (existing requests will aborted), while SIGUSR1 does it "gracefully", allowing each child server currently handling requests to complete the request before restarting it. If you use the 'apachectl' control script included in the apache distribution, these options correspond to 'apachectl restart' and 'apachectl graceful', respectively (although, if I remember right, the 'graceful' option wasn't added until around release 1.3.0). So, something like this is what you want to do: root# cd /usr/local/apache root# mv logs/access_log logs/access_log.21-feb-2001 root# mv logs/error_log logs/error_log.21-feb-2001 root# ./apachectl graceful At this point, new logs will be opened in the logs directory, and you can safely do whatever (gzip, archive, analyze, etc...) you want with the rotated logs. HTH, On Thu, 22 Feb 2001, Terry Newnham wrote: > I've found out how to edit httpd.conf so that it will rotate the error > and access logs. But you have to restart apache to read that which I'd > rather not do. Is there a command-line use or the rotatelogs by means of > which you can rotate the logs on the fly ? =-=-=-=-=-=-=-=-=-=- My God! What have I done? -=-=-=-=-=-=-=-=-=-= Steve Reppucci [EMAIL PROTECTED] | Logical Choice Software http://logsoft.com/ |
Re: mod_vhost_alias / ProxyPassReverse problem
I was going to suggest having the backend server listen on localhost:80, with the proxying server listening on :80, then the redirects from either would be to port 80. This suggestion of Tony's certainly seems like a cleaner solution though. (Plus, I learned something I didn't know about this interaction of Listen and Port directives -- always "a good thing" (tm) ;^) On Mon, 12 Feb 2001, Ime Smits wrote: > | Use the following config: > | Listen 81 > | Port 80 > | In the presence of a Listen directive, the Port directive acts like > | ServerName, i.e. it's what the server calls itself regardless of the > | name that other people use to get to it. > > OK, thanks a lot, that does the trick. I tried that earlier today, but I > overlooked an explicit ServerName directive somewhere else in httpd.conf, > overruling mod_vhost_alias... > > Thanks again! > > Ime > =-=-=-=-=-=-=-=-=-=- My God! What have I done? -=-=-=-=-=-=-=-=-=-= Steve Reppucci [EMAIL PROTECTED] | Logical Choice Software http://logsoft.com/ |
Re: Apache::SubProcess failures
Are you certain that your problem is in the output redirection? That message seems to indicate that the problem is in exec'ing /usr/bin/ls. Are you sure that it (ls) exists at that path, rather than just /bin/ls? On Sat, 10 Feb 2001, Aaron Kennedy wrote: > Hi all, > > I'm having some issues involving directing the output of system() to the > client. I'm trying to use Apache::Subprocess to over-ride > system(). However, whenever I use it, I get the following errors in my > Apache error log: > > --- test.pl --- > > use strict; > use Apache::SubProcess qw(system); > > select STDOUT; $| = 1; > print "Content-type: text/html\n\n"; > system ("/usr/bin/ls"); > > --- error.log --- > > [Sat Feb 10 22:54:29 2001] [error] fdopen failed! at > /usr/local/lib/perl5/site_perl/5.6.0/i586-linux/Apache/SubProcess.pm line > 36. > > [Sat Feb 10 22:54:29 2001] [error] (2)No such file or > directory: Apache::SubProcess exec of /usr/bin/ls failed > > I'm using Apache version 1.3.17, mod_perl version 1.25 and > Apache::SubProcess version 0.02. Any help would be greatly appreciated! > > Cheers, > > Aaron > =-=-=-=-=-=-=-=-=-=- My God! What have I done? -=-=-=-=-=-=-=-=-=-= Steve Reppucci [EMAIL PROTECTED] | Logical Choice Software http://logsoft.com/ |
Using Filter Module under mod_perl
Hi, I'm having trouble trying to use the Filter module under mod_perl. The attached script + module correctly outputs "Goodbye, world." under Apache/CGI, but says "Hello, world." under Apache/mod_perl (with Apache::Registry), i.e. the filter is not being applied. I looked into this once before, but got nowhere with it. Doug MacEachern had a *very* quick look last time and suggested maybe: "... the filter mechanism is tied into the perl_parse() and/or perl_run() functions, which are only called once by the perl (command line) binary, and only once by mod_perl. So it could be the case that Apache::Registry is simply too late in the game to use Perl filters." I e-mailed the module's author (Paul Marquess) recently. He is not familiar with the internals of mod_perl (neither am I), but he said: "If mod_perl calls perl_parse, I'm not sure why the filters aren't working. The filters hooks all live in yylex, which get called indirectly by perl_parse." Is there anyone familiar with both Filter and mod_perl who could shed any more light on what's going on here? Thanks, Steve Hay Hello2Goodbye.pm filtertest.pl
Re: Send a cookie, AND a redirect ?
I believe you want to use 'err_header_out' rather than 'header_out' if you're returning a status other than OK. HTH, On Thu, 8 Feb 2001, Harrison wrote: > Dear All. > > I can set a cooke fine using: > > $r->content_type('text/html'); > $r->header_out('Set-Cookie' =>$cookie); > $r->send_http_header; > > And i can also send a redirect fine using: > > $r->content_type('text/html'); > $r->header_out('Location'=>$the_url); > return REDIRECT; > > BUT! > > how do i do both? if i use my redirect code, and add an extra header_out , the >cookie is not sent (because i have not called send_http_header ? ). > > If i add send_http_header, i see the full sent http_header in my browser. > > My idea was to have something like > > $r->content_type('text/html'); > $r->header_out('Location'=>$the_url); > $r->header_out('Set-Cookie' =>$cookie); > $r->send_http_header; > return REDIRECT; > > > Which does not work. > > Thinking about it whilst typing this email, does header_out have a field where i can >set the REDIRECT status? > > Thanks in advance, > > Richard Harrison. > =-=-=-=-=-=-=-=-=-=- My God! What have I done? -=-=-=-=-=-=-=-=-=-= Steve Reppucci [EMAIL PROTECTED] | Logical Choice Software http://logsoft.com/ |
Re: Best GCC compiler options for Intel (perl & apache)
Tim Bunce wrote: > > Can anyone recommend extra gcc options to squeeze the last ounce of > performance out of code (perl and apache in this case) on Intel? > > I don't mind tying the code down to one cpu type or loosing the ability > to debug etc. We're already doing -O6 and are looking for more. > > I recall Malcom Beattie (CC'd, Hi Malcolm!) experimenting in this area, > something about not wasting a register for the frame pointer. That particular option would be gcc -fomit-frame-pointer. You might try -ffast-math -fexpensive-optimizations (never played with the latter, though, and it's probably on with -O6 anyway). If you really want to go crazy, you could try -fbranch-probabilities (requires more than just turning it on; read the gcc man page.) I doubt it's worth the trouble. And you'd probably want -march=i686 (or whatever CPU you're using). I don't know the state of pentium-specific optimizations, but does Cygnus's Code Fusion still have a gcc with Pentium-specific optimizations that aren't in the main tree? I just remember the numbers saying that they'd slightly overtaken Intel's compiler, but that was a year and a half ago. Unrelated to the compiler, if you're throwing around significant chunks of data, you might want to try tuning your drives. Especially if they're IDE, since UDMA is often disabled for safety by default. I don't know much about SCSI tuning, but whichever interface you're using, make sure the heads are able to go around in circles really fast. You can also play tricks with RAM disks, or solid-state hard drives like the ones from platypustechnologies.com. But this gets too far afield.
Re: [RFC] mod_perl Digest path...
My vote is to keep a plain text version available. I don't use an html-capable mail reader, so sending a link normally means "I'll save this and read it later when I have time", which often means I'll delete it three weeks later in cleaning out my 'READ' mail file... I like the text version because I can quickly scan it to see if there are any interesting topics that I missed during the week. My 2 cents... On Tue, 30 Jan 2001, Geoffrey Young wrote: > sorry again for all the confusion with this morning's digest (I do code more > carefully than I write, really I do...) > > this does present the opportune time to ask the list about the future of > this digest... > > currently, the digest does not have a HTML home. Matt at take23.org has > graciously agreed to host it and work on the XML stylesheets required for > the site. This is a very good thing - but unfortunately, there is no easy > way to derive a decent plain text version from an XML base... > > thus, the move to take23.org may mean that the digest no longer appears on > the list in plaintext, but merely as a posting with a link to the current > version... > > how does this strike everyone? > > --Geoff > =-=-=-=-=-=-=-=-=-=- My God! What have I done? -=-=-=-=-=-=-=-=-=-= Steve Reppucci [EMAIL PROTECTED] | Logical Choice Software http://logsoft.com/ |
Re: Runaways
On Mon, 29 Jan 2001, Robert Landrum wrote: > I did the exact same thing... But the kill(-9,$pid) didn't work, even > when run as root. Unfortunatly, Apache::Watchdog::RunAway is just as > lame as our solutions (Sorry Stas), in that it relies on an external > process that checks the apache scoreboard and kills anything that's > been running for "X" amount of time. Yep, we've had a few of these too -- but it seems I can avoid these if I kill the runaways early enough before they become too brain dead. > You could, in theory just reduce the "Timeout" option in apache to > "X" above to achieve the same result, and avoid the external process > altogether. Hmmm, are you sure about that? According to the apache manual: The TimeOut directive currently defines the amount of time Apache will wait for three things: 1.The total amount of time it takes to receive a GET request. 2.The amount of time between receipt of TCP packets on a POST or PUT request. 3.The amount of time between ACKs on transmissions of TCP packets in responses. I've never known 'Timeout' to affect the amount of time a child process takes to service a request though... > The problem, I'm afraid, is that I start hemorrhaging memory at the > rate about 4 megs per second, and after 300 seconds, I have a process > with just over 1200 megs of memory. The machine itself handles this > fine, but if the user stops and does whatever it is they're doing > again, I end up with two of those 1200 meg processes... which the > machine cannot handle. > > I'm hoping someone else has a more sophisticated solution to tracing > runaway processes to their source. If not, I'll have to write some > internal stuff to do the job... Afraid I can't offer anything better than what it sounds like you already have... =-=-=-=-=-=-=-=-=-=- My God! What have I done? -=-=-=-=-=-=-=-=-=-= Steve Reppucci [EMAIL PROTECTED] | Logical Choice Software http://logsoft.com/ |
Re: Runaways
Yes, I've seen this happen often, maybe once a day on a relatively heavily used site running mod_perl, where a child process goes into a state where it consumes lots of memory and cpu cycles. I did some investigation, but (like you, it sounds) couldn't garner any useful info from gdb traces. I solved (?) this by writing a little perl script to run from cron and watch for and kill these runaways, but it's an admittedly lame solution. I've meant for a while to look into Stas' Apache::Watchdog::RunAway module to handle these more cleanly, but never did get around to doing this. Let us know if you do get to the bottom of this. On Mon, 29 Jan 2001, Robert Landrum wrote: > I have some very large httpd processes (35 MB) running our > application software. Every so often, one of the processes will grow > infinitly large, consuming all available system resources. After 300 > seconds the process dies (as specified in the config file), and the > system usually returns to normal. Is there any way to determine what > is eating up all the memory? I need to pinpoint this to a particular > module. I've tried coredumping during the incident, but gdb has yet > to tell me anything useful. > > I was actually playing around with the idea of hacking the perl > source so that it will change $0 to whatever the current package > name, but I don't know that this will translate back to mod perl > correctly, as $0 is the name of the configuration from within mod > perl. > > Has anyone had to deal with this sort of problem in the past? > > Robert Landrum > =-=-=-=-=-=-=-=-=-=- My God! What have I done? -=-=-=-=-=-=-=-=-=-= Steve Reppucci [EMAIL PROTECTED] | Logical Choice Software http://logsoft.com/ |
Re: Upgrading mod_perl on production machine (again)
Not that I have an answer to this complete problem, but I have had similar situation, so I'll also be interested in the solutions you uncover. I've always handled the support of multiple perl versions by installing new versions of perl using a prefix like /usr/local/perl/5.6.0, etc., (I also place CPAN's build directory under that tree.) This makes it easy to install and test new versions of perl without affecting running applications that have been built against a previous perl version, as well as making it possible to test with specific versions just by referencing the appropriate version in the script's shebang line (or by setting my PATH appropriately when building mod_perl.) Using this method, I symlink the "current default" version of perl and its tools in the standard public directory (/usr/bin or /usr/local/bin). Upgrading mod_perl versions has been a headache though, as I'm similarly hesitant to simply 'make install' new mod_perl releases without being able to test that all of my running applications work correctly. I suppose your idea of archiving the lib tree (/usr/local/perl/5.6.0/lib in my setup) before running the 'make install' so that it's easy to roll back should something fail is prudent. But it still doesn't solve the problem of being able to fully install (in its real final location, not in a private directory...) new versions of mod_perl without affecting stuff that's already running. (Maybe I'm just tilting at windmills in worrying about testing modperl from a private directory install...) So how *do* others handle this upgrade situation? On Tue, 16 Jan 2001, Bill Moseley wrote: > This is a revisit of a question last September where I asked about > upgrading mod_perl and Perl on a busy machine. > > IIRC, Greg, Stas, and Perrin offered suggestions such as installing from > RPMs or tarballs, and using symlinks. The RPM/tarball option worries me a > bit, since if I do forget a file, then I'll be down for a while, plus I > don't have another machine of the same type where I can create the tarball. > Sym-linking works great for moving my test application into live action, > but it seems trickier to do this with the entire Perl tree. > > Here's the problem: this client only has this one machine, yet I need to > setup a test copy of the application on the same machine running on a > different port for the client and myself to test. And I'd like to know > that when the test code gets moved live, that all the exact same code is > running (modules and all). > > What to do in this situation? > > a) not worry about it, and just make install mod_perl and restart the server > and hope all goes well? > > b) cp -rp /usr/local/lib/perl5 and use symlinks to move between the two? > When ready to move, kill httpd, change the perl symlinks for the binary, > perl lib, and httpd, and restart? > > c) setup a new set of perl, httpd, and my application and when ready to go > live just change the port number? > > Or simply put - how would you do this: > > With one machine I want to upgrade perl to 5.6.0, upgrade your application > code, new version of mod_perl, and allow for testing of the new setup for a > few weeks, yet only require a few seconds of downtime to switch live (and > back again if needed)? > > Then I wonder which CPAN module I'll forget to install... > > > > Bill Moseley > mailto:[EMAIL PROTECTED] > =-=-=-=-=-=-=-=-=-=- My God! What have I done? -=-=-=-=-=-=-=-=-=-= Steve Reppucci [EMAIL PROTECTED] | Logical Choice Software http://logsoft.com/ |
Re: [OT] Availability of Jobs -- was Re: [SOLICITATION] Programmer available for contracting..
> The most important thing I learned from fuckedcompany.com is the > term "Javateer". So what does it mean? The fuckedcompany search isn't very forthcoming :(
[JOB WANTED]: Boston area modperl contract
I'm looking for Boston area companies, or possibly something that can be done on a telecommuting basis, requiring expertise with perl (modperl) and apache in a large-scale environment. I've got some pretty good experience using modperl, please email me for a resume. I'm mainly targeting contract work, but would be interested in talking about a full time position if an interesting opportunity arises. Interested parties please email me off list. =-=-=-=-=-=-=-=-=-=- My God! What have I done? -=-=-=-=-=-=-=-=-=-= Steve Reppucci [EMAIL PROTECTED] | Logical Choice Software http://logsoft.com/ |
Configuration File for Apache
Can someone send me a Configuration File for Apache please? THX winmail.dat
Mod Perl v1.24_01
I want to configure my apache server (1.3.14) with mod_perl (1.24_01) But when I configure mod_perl with the following command * perl Makefile.PL APACHE_SRC=/usr/src/http/apache_1.3.14/src DO_HTTPD=1 USE_APACI=1 PREP_HTTPD=1 EVERYTHING=1 * make * make test --> Gives the following error : Syntax error in Line 3 .../t/conf/http.conf Invalid Command POD I am quite new with Apache && Mod_Perl. Is it also possible to receive a configuration file for Apache from someone. I use a SuSE Linux 7.0 system THX winmail.dat
Re: recommendation for image server with modperl
I'll second Perrin's remarks on using apache for this -- we run a stripped down apache to serve image files, and have been extremely happy with the performance. I've casually investigated thttpd and a couple of others, but ended up sticking with Apache mainly because it's well documented and we already know how to do the care and feeding of it. On Tue, 19 Dec 2000, Perrin Harkins wrote: > On Tue, 19 Dec 2000, Justin wrote: > > I've been catching up on the modperl list archives, and would > > just like to recommend "mathopd" as an image web server. > > I think you'll find thttpd (http://www.acme.com/software/thttpd/) faster > and somewhat better documented. However, I'd like to point out that we've > had no problems using Apache as an image server. We need the ability to > serve HTTPS images, which mathopd and thttpd can't do, but more than that > we've found the performance to be more than good enough with a stripped > down Apache server. > > > After having difficulties with the sheer number of front end apache > > processes necessary to handle 10 backend modperls, (difficulties: high > > load average and load spikes, kernel time wasted scheduling lots of > > httpds, higher than expected latency on simple requests) > > Load averages are tricky beasts. The load can get high on our machines > when many processes are running, but it doesn't seem to mean much: almost > no CPU is being used, the network is not saturated, the disk is quiet, > response is zippy, etc. This leads me to think that these load numbers > are not significant. > > Select-based servers are very cool though, and a good option for people > who don't need SSL and want to squeeze great performance out of budget > hardware. > > - Perrin > =-=-=-=-=-=-=-=-=-=- My God! What have I done? -=-=-=-=-=-=-=-=-=-= Steve Reppucci [EMAIL PROTECTED] | Logical Choice Software http://logsoft.com/ |
Re: session expiration
>So basically I want to set a cookie that will allow them to enter the site >under their userid, but I can't allow them to enter if they are currently >logged in from elsewhere. > >Any ideas? I use cookie-based auth in a few places, with a "can be logged in only once" restriction, but I duck the "don't allow them to enter" scenario by letting each new session supercede the old one. I use a database that maps logged-in user IDs to cookies, and once authentication is done (which happens if the user doesn't send a cookie, or doesn't send the right cookie), the new cookie simply overwrites the old one, and the new session becomes the "allowed" one. ...Steve -- Steve van der Burg Information Services London Health Sciences Centre (519) 685-8300 ext 35559 [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re:Tempfile and send_fd()
"Steve" == Steve Smith <[EMAIL PROTECTED]> writes: > Hi, Could somebody tell me why the following testcase doesn't work? Nevermind, I got it from the archives eventually : seek $f, 0, 0; $r->send_fd($f); Cheers, Steve
Tempfile and send_fd()
Hi, Could somebody tell me why the following testcase doesn't work? use Apache (); use Apache::File (); my $r = Apache->request(); $r->content_type('text/plain'); $r->send_http_header(); my $f = Apache::File->tmpfile(); print $f "test\ntest\n"; $r->send_fd($f); $f->close; All I get is an empty document. My understanding is that the data written to the tmpfile should be available immediately through the filehandle even if it hasn't been flushed. This is running under Registry, on Linux. Thanks, Steve
Subject Matter Expert- Web Performance & Reliability
Good Afternoon: I am seeking an expert in the field of Web Performance and Reliability. The responsibilities include having subject matter expertise in performance and web assessment. This is to help an emerging product company focusing on back-end infrastructure of the web. Our goal is to provide a full assessment of a company's web infrastructure across seven different attributes: security, performance, reliability, scalability, manageability, flexibility and long term viability. While other companies in this space are primarily niche players, we provide an end to end web assessment tool. Headquartered in Wakefield, MA, we will be expanding to the seacoast of NH (Portsmouth) after the first of the year. Currently we are still in stealth mode while we are completing our initial product development and develop a formal marketing campaign. This person would own the metrics around performance and reliability and serve in multiple roles (Client assessment, product development, customer delivery, etc). I am not sure if anyone on this list would know of interested parties, but please feel free to contact me or pass this info along. I appreciate the time. Best, Stephen L. Coco Emerging Markets Associate Darwin Partners 100 Quannapowitt Parkway Wakefield, MA 01880 Office 800-274-1174 x7842 Direct 781-213-7842 Mobile 617-233-9900 Email [EMAIL PROTECTED] Web www.darwinpartners.com
Re: a web interface to visualize tables
Hi Guys, The technology called Datilink has just been bought out by a new company called Inshift Technologies. If you are interested I can get you a killer price on a copy right now since I have connections with both companies. We have been using it for several years now and really like its flexibility and ease of use. Let me know and I will send you a win32 demo version. Steve Lloyd 801 318-0591 Tim Harsch wrote: > As a part of further research into this area I am going to seriously look > into Oracle WebDB. Other users in my shop have had great success with it. > And the output is *very* high quality. I would appreciate hearing more > about it from any users here that have experience with it. > > Also there is a product that seems to be a cross platform version of what > you want called "DatiLink". It hooks up natively to all the major > databases. It's a bit pricy but the output seems to be high quality. > http://datigen.com > > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On > > Behalf Of Louis-David Mitterrand > > Sent: Wednesday, November 01, 2000 7:58 AM > > To: dbi-users; [EMAIL PROTECTED] > > Subject: a web interface to visualize tables > > > > > > > > Hello, > > > > I need a tool to interactively visualize DB tables from a web interface. > > Ideally this tool would let me: > > > > - rename column headers, > > - set cell alignments, widths, background colors, > > - reorder columns, > > - save all these visualisation settings in a DB, > > - it would be written in perl (even better: mod_perl), > > > > Does such a beast exist? I am in the process of writing one, so I > > thought I'd check first... > > > > Thanks in advance, > > > > -- > > Louis-David Mitterrand - [EMAIL PROTECTED] - http://www.apartia.org > > > > "Kill a man, and you are an assassin. Kill millions of men, and you > > are a conqueror. Kill everyone, and you are a god." -- Jean Rostand > > > > > > -- > > > > DBI HOME PAGE AND ARCHIVES: > http://www.symbolstone.org/technology/perl/DBI/ > To unsubscribe from this list, please visit: > http://www.isc.org/dbi-lists.html > If you are without web access, or if you are having trouble with the web > page, > please send mail to [EMAIL PROTECTED] with the subject line of: > 'unsubscribe'. > > -- > > -- > DBI HOME PAGE AND ARCHIVES: http://www.symbolstone.org/technology/perl/DBI/ > To unsubscribe from this list, please visit: http://www.isc.org/dbi-lists.html > If you are without web access, or if you are having trouble with the web page, > please send mail to [EMAIL PROTECTED] with the subject line of: > 'unsubscribe'. > --
RE: a web interface to visualize tables
Title: RE: a web interface to visualize tables I saved this bit on WDBI. I downloaded it but it didn't support Oracle out of the box. Adding that seemed pretty straight forward (well documented anyway) but I was sidetracked before completing it. There is support for some other common DB's. Here's a bit from the original thread. I am currently using "WDBI", Web Database Interface. A set of perl scripts that seem to work real nicely, at least for me. It took me about 3-days to figure it all out, but now have it tuned for just what I need. And you can definately control the mucking, and what tables and/or fields that may be read only as well. You can get it at: http://www.wdbi.net - There is also a working sample available there which is what sold me on it. Good Luck! Tim Harsch wrote: > > Thanks guys, > I guess what I'm looking for is a web based GUI that allows a user to login > to the database, choose some table that the user has rights to and enter > data in some spreadsheet like format. I could go with TK but would prefer a > cross-platform solution. Steve Sapovits Global Sports Interactive Work Email: [EMAIL PROTECTED] Home Email: [EMAIL PROTECTED] Work Phone: 610-491-7087 Cell: 610-574-7706 Pager: 877-239-4003 -Original Message- From: Andy Duncan [SMTP:[EMAIL PROTECTED]] Sent: Wednesday, November 01, 2000 12:06 PM To: [EMAIL PROTECTED]; dbi-users; [EMAIL PROTECTED] Subject: Re: a web interface to visualize tables Hi Louis-David, > I need a tool to interactively visualize DB tables from a web interface. > Ideally this tool would let me: > - rename column headers, > - set cell alignments, widths, background colors, > - reorder columns, > - save all these visualisation settings in a DB, > - it would be written in perl (even better: mod_perl), > Does such a beast exist? I am in the process of writing one, so I > thought I'd check first... You might want to take a look at OracleTool for some ideas, particularly if you're working with Oracle: => http://www.oracletool.com/ Alternatively Thomas Eibner's idea of adapting PhpMyAdmin sounds good. You can find out more about that here: => http://phpwizard.net/projects/phpMyAdmin/index.html There is a Sybase version too, here: => http://kenny.itlab.musc.edu/phpSybaseAdmin/ If you do write an Oracle driver and create phpOracleAdmin, can you let me know! :-) You can find some interesting stuff on connecting php to Oracle here: => http://www.php.net/manual/ref.oracle.php HTH a bit 8-) Rgds, AndyD __ Do You Yahoo!? From homework help to love advice, Yahoo! Experts has your answer. http://experts.yahoo.com/ -- DBI HOME PAGE AND ARCHIVES: http://www.symbolstone.org/technology/perl/DBI/ To unsubscribe from this list, please visit: http://www.isc.org/dbi-lists.html If you are without web access, or if you are having trouble with the web page, please send mail to [EMAIL PROTECTED] with the subject line of: 'unsubscribe'. --
Re: PUT handling (somewhat off-topic)
>When I send Apache a PUT request using 'telnet', the request is >received. However, my PUT script does not run. Instead, Apache >fabricates a 200 response that looks like this: I just added Script PUT /cgi-bin/put-handler to my Apache config (apache 1.3.12 & mod_perl 1.24 on Solaris 8 SPARC), copied http://www.apacheweek.com/issues/put1 to put-handler, added some more logging code, and tried uploading something from Netscape Composer. It worked like a charm, the first time, and the request was handled by the script (the script's own log says what I expected it to say) which means I've been of almost no help! If it hadn't worked, I probably would've trussed Apache while I made the request to see what was going on. ...Steve -- Steve van der Burg Information Services London Health Sciences Centre (519) 685-8300 ext 35559 [EMAIL PROTECTED]
Re: HTML Template Comparison Sheet ETA
At 11:26 AM 9/4/00 -0300, Nelson Correa de Toledo Ferraz wrote: >I agree that one shouldn't put lots of code inside of a template, but >variables and loops are better expressed in Perl than in a "little >crippled language". Your example makes perfect sense to me. But that's why I'm in "Tech" and not "Creative". I wrote my own quick 'n nasty templating package a few years ago that allowed Perl code to be embedded inside brackets. So long as I was coding the pages, it worked great, if not as efficiently as embperl or mason. But in the real world of NYC new media, Creative typically drives the project. It's more common for the site to be built by artists and HTML sitebuilders, not programmers. The first time I see the pages is when they get handed off to Tech to glue it all together. This usually happens sometime past Tech's scheduled hand-off date, i.e. five days to do fifteen budgeted days' work in order to make the launch date. I had more success with Sam's HTML::Template package. The sitebuilders seemed to better understand how to work with its simpler concept, although I had to stay away from HTML::Template's looping constructs for the same reason. No doubt, if there had been better communications and coordination between Tech and Creative and I'd had more hands-on input on what Creative was doing to those templates I could have eliminated most of the screwups. But in practice, I've found turf warfare to be status quo between Tech and Creative in larger agencies. My favorite anecdote with embedded Perl templates: after a 100-page creative update to an existing site, nothing worked. Turned out that some funky HTML editor had HTML-escaped the Perl code. That was a fun all-nighter. ---[ http://www.magpie.com ]---=o&>o--- Steve Manes Brooklyn, N'Yawk
Re: Getting data from external URL
Hmmm Looking at _trivial_http_get: if ($code =~ /^30[1237]/ && $buf =~ /\012Location:\s*(\S+)/) { # redirect So it certainly seems like it's *trying to handle it. As I recall (it was a late night when I had an application that wasn't working), I had single stepped down into the guts of LWP::Simple and realized that it was returning a failure indicator when encountering a 302 status. I had assumed that this was intended behavior, but now that I look at the pod of what we've currently got installed (1.32), it sure seems like it should work. I'll look into this a bit to see if I can recreate it, but for now, let's chalk it up to either (1) something that's been fixed since the version that I was using at the time, or (2) I'm just out of my head. More likely the latter... Sorry for the confusion. On 29 Aug 2000, Gisle Aas wrote: > Steve Reppucci <[EMAIL PROTECTED]> writes: > > > Just a word of warning: LWP::Simple doesn't follow redirects (at least, > > the last I checked, not sure if it's been changed in the 3 or 4 > > months since I've last used it...), > > If it does not follow redirects then that is a bug. Do you have a > test case? > > Not much has changed in the last 3 or 4 months either. > > Regards, > Gisle > =-=-=-=-=-=-=-=-=-=- My God! What have I done? -=-=-=-=-=-=-=-=-=-= Steve Reppucci [EMAIL PROTECTED] | Logical Choice Software http://logsoft.com/ | 508/958-0183 Be Open |
Re: Getting data from external URL
Just a word of warning: LWP::Simple doesn't follow redirects (at least, the last I checked, not sure if it's been changed in the 3 or 4 months since I've last used it...), so you need to be certain that you're using it in a context where you're fetching something that won't return a redirect. HTH... On Sat, 26 Aug 2000, Stas Bekman wrote: > On Sat, 26 Aug 2000, Rodney Broom wrote: > > > OK, lots of banter... > > > > Hey V, if you are on a *NIX system, then this is a fast way: > > > > open U, "lynx -source www.some.url.dom |"; > > $data = join '', ; > > > > There, you're finished. Admittedly, this isn't terribly efficiant, but it works > > just fine and has short devel time. > > This one is much more efficient and requires even less coding: > > use LWP::Simple; > $content = get("http://www.sn.no/") > > And it doesn't require you to be on any particular OS, as far as I know. > > see perldoc LWP::Simple and as advised by many others LWP::UserAgent for > more advanced uses. =-=-=-=-=-=-=-=-=-=- My God! What have I done? -=-=-=-=-=-=-=-=-=-= Steve Reppucci [EMAIL PROTECTED] | Logical Choice Software http://logsoft.com/ | 508/958-0183 Be Open |
Re: PerlAuthenHandler -- doesn't get there...? SOLVED
[ previous discussion snipped ] >httpd.conf or .htaccess (PerlModule hasta be in httpd.conf, >from my experience)-- > PerlAccessHandler My::Auth::access_handler > PerlSetVar Intranet "10.10.10.1 => userA, 10.10.10.2 => userB" > PerlAuthenHandler My::Auth::authen_handler > AuthName realm > AuthType Basic > Require valid-user > > order deny,allow > deny from all > # > # add 'order/deny', and we're done (as far as i can tell) > # > Before any changes to the Guide solidify out of this, I'd like to know that we're not pushing bad information into it. - order, deny, allow are all handled by mod_access, which worries about hostname- and IP address-based restrictions. - AuthType Basic is handled right in the core Apache code, where it, along with digest, is special-cased for in http_request and elsewhere. You aren't really doing Basic auth with your module, are you? That is, you're not putting the Auth-Required headers into your responses (to cause the browser to prompt for credentials) if you don't see the Basic auth headers in the requests, right? I'm using Apache::AuthCookie, not doing this from scratch, so that clouds things a bit for me, but I've been looking at Apache's behaviour a lot. Here's my test config (for Apache::AuthCookie): AllowOverride None Options +ExecCGI SetHandler cgi-script AuthType Site::AuthCookieHandler AuthName Testing PerlAuthenHandler Site::AuthCookieHandler->authenticate PerlAuthzHandler Site::AuthCookieHandler->authorize require valid-user Notice that there are no order, allow, deny directives in sight, and this works as it should. If I truss apache while I hit this spot with a request, I see the results of the handlers being invoked, which in AuthCookie's case is a redirection to a login form. If I replace "AuthType Site::AuthCookieHandler" with "AuthType Basic", the handlers don't get invoked, and I instead see this error from apache: configuration error: couldn't check user. No user file?: /some/where This comes from http_request.c, which is responding to "AuthType Basic". It's giving an error because I haven't told it where to find a user file (AuthUserFile) or database (AuthDBMUserFile) to check requests against, but I've requested Basic auth. ...Steve -- Steve van der Burg Information Services London Health Sciences Centre (519) 685-8300 ext 35559 [EMAIL PROTECTED]
Re: PerlAuthenHandler -- doesn't get there...?
>> i canna get the PerlAuthenHandler to do ANYTHING. first >> line of code after $r = shift is $r->warn() but nothing >> shows up in the log. aaugh! [snip] >> >> PerlAccessHandler Serensoft::Auth::access_handler >> PerlSetVar Intranet "this => that" >> PerlAuthenHandler Serensoft::Auth::authen_handler >> AuthName "dontUthink subscriber" >> AuthType Basic >> Require valid-user >> [snip] After looking at my own configuration for Apache::AuthCookie, and snooping in the Apache source a bit, I think that your "AuthType Basic" needs to be changed to "AuthType Serensoft::Auth". ...Steve -- Steve van der Burg Information Services London Health Sciences Centre (519) 685-8300 ext 35559 [EMAIL PROTECTED]
Win32: system() calls with STDOUT re-directed
I've finally solved a problem which I've had for a long time which may be of interest. I know some people looked at it for me at the time, including Randy Kobes. The problem was that the following script did not correctly execute it's system() call. The ip.txt file was never written and the status was set to 256. Running under CGI the file was written and the status was 0. (The problem never occurred if STDOUT from the ipconfig program is not re-directed to a file.) $| = 1; $pg = "Content-Type: text/plain\n\n"; $status = system "D:\\WINNT\\system32\\ipconfig.exe > D:\\Temp\\ip.txt"; $pg .= "The system call exited with status $status.\n"; print $pg; I've found that since re-building everything with the inclusion of mod_ssl (2.6.5) the problem goes away! I kept everything else the same (Perl 5.6.0, Apache 1.3.12, mod_perl 1.24 on NT4 SP6). I wonder if this is anything to do with the EAPI (extended API) which mod_ssl patches the Apache core code with, since I don't actually need to *use* mod_ssl, just build with it - i.e. I don't even need to have a "LoadModule ssl_module modules/ApacheModuleSSL.dll" line in my httpd.conf file! It could also explain why other people were unable to re-produce my problem. Randy: I think you looked at this for me around the beginning of April and couldn't re-produce it. Do you think you had mod_ssl included in your build? Does this have any other implications for mod_perl??? Does mod_perl need the EAPI like mod_ssl does (at least on Win32)??? Steve Hay
Full-time web programmer needed.
Full-time web programmer needed. Denver-based firm is looking to add an additional full-time web programmer to our staff. Main responsibility is working with development team to develop web applications for client projects. Fluency in developing web-based applications in PERL/mod_perl/apache/mySQL on BSD/LINUX a must. Additional experience in jscript/java a plus as well as experience with Oracle or additional web-development technologies. CONTACT: -- STEVE CHITWOOD Summit Communication Design, Inc. 6065 South Quebec Street, Suite 202 Englewood, CO 80111 303/290-1898 voice 303/265-9379 fax http://www.SummitDesign.net
Re: can't get unbuffered output to work
>Hi, unbuffered output in a handler just doesn't work for me: [ details of setup and handler snipped ] > >If I 'GET /unbuffered' in Netscape nothing is printed until I stop the >server. Setting $|++ does not help. Something is still buffering. This >is modperl 1.21 and Apache 1.3.12. > >Any clues? Netscape is waiting for an HTML visual break of some kind before showing any output - if you modify your test handler to spew "Hello!" before sleeping, you should see it. ...Steve -- Steve van der Burg Information Services London Health Sciences Centre (519) 685-8300 ext 35559 [EMAIL PROTECTED]
HTTP Headers
My mod_perl configuration seems to automatically send a header everytime (Content-type: text/html) I know this because, Perl scripts that print back out do not get a malformed header error This is causing big problems b/c I cannot det the header myself (for cookies and redirects). In my httpd.conf, I made sure to have: -PerlSendHeader Off -comment out the DefaultType directive Does anybody have any idea where I might look in my configuration for the cause of this? Any help is very greatly appreciated. Thanks, steve
Re: Simple program _setting_ REMOTE_ADDR
>> Ack! That was pretty stupid of me. It doesn't explain why >> SetEnvIf Request_URI "/cgi-bin/VENDOR" REMOTE_ADDR=1.2.3.4 >> didn't work, but I can take that to the Apache folks. > >It's because mod_cgi sets the environment variable just before it >runs the program (and thus overriding whatever you set before). > >A fixup handler to set the fake ip address (as you figured out) and >possibly a loghandler to set remote_ip to the right address again is >the way to go. Thanks. Between the help I got on the list, and a quick reading of some of the Apache source (esp. mod_cgi), I had a working solution up and running 90 minutes (!) after first deciding to attack the problem from that angle. ...Steve -- Steve van der Burg Information Services London Health Sciences Centre (519) 685-8300 ext 35559 [EMAIL PROTECTED]
Re: Simple program _setting_ REMOTE_ADDR - SOLUTION
>> In httpd.conf: >> >> >> PerlAccessHandler LHSC::FakeRemoteIP >> > >Why an Access handler? I realize it works, but a more appropriate >phase would be PerlFixupHandler, since you aren't doing any access >control in your module. A couple other nitpicky points: you probably >should return 'DECLINED' at the end, not 'OK', in case there are more >handlers that want to do something during that phase and it also probably >would be a good idea to restore the "real" address after so your logs >show the actual client IP. Something like this: Good points. This is my first real foray outside of content handlers, so I chose something early on in the request phase. I'll give the code you've provided a try this afternoon. ...Steve -- Steve van der Burg Information Services London Health Sciences Centre (519) 685-8300 ext 35559 [EMAIL PROTECTED]
Re: Simple program _setting_ REMOTE_ADDR - SOLUTION
>Like that but work-around earlier today for Apache::Request to work >around a MIME formatting but in IE on the Mac. Lame. Taking your remote_ip hint, and reading the Eagle a bit more closely, I came up with this: In httpd.conf: PerlAccessHandler LHSC::FakeRemoteIP Here's the handler: #!/bin/perl package LHSC::FakeRemoteIP; use Apache::Constants qw /:common/; use strict; sub handler { my $r = shift; $r->connection->remote_ip("1.2.3.4"); return OK; } 1; I've tested it and it works perfectly. ...Steve -- Steve van der Burg Information Services London Health Sciences Centre (519) 685-8300 ext 35559 [EMAIL PROTECTED]
Re: Simple program _setting_ REMOTE_ADDR
>>>>>> Vivek Khera <[EMAIL PROTECTED]> wrote: >>>>> "SvdB" == Steve van der Burg <[EMAIL PROTECTED]> wrote: >SvdB> That is, I'd like to set REMOTE_ADDR like so: >SvdB> >SvdB> # Feed vendor's crappy CGI code a fake address that won't change: >SvdB> PerlSetEnv REMOTE_ADDR 1.2.3.4 >SvdB> > >But is /cgi-bin running under Perl? Ack! That was pretty stupid of me. It doesn't explain why SetEnvIf Request_URI "/cgi-bin/VENDOR" REMOTE_ADDR=1.2.3.4 didn't work, but I can take that to the Apache folks. >I think what you have to do is make a handler that calls Apache's >remote_ip() method with the proper value, then runs a sub-request for >your CGI program, taking care not to recurse on itself. How about an access handler that just sets it? As long as I can get to it before mod_cgi launches the vendor's code, I should be okay. Of course, that's what SetEnvIf is supposed to do... >If they don't understand how an IP address can change on a client, do >they understand that clients can share the same IP? They're fine that way. A couple of LWP tests confirmed that. >These people should be taken out and shot if they don't understand >that their app fails this way. Really. Just shoot 'em. I agree. How a major vendor with lots of staff and billions of dollars can get the basics wrong, I don't know. Thanks for your help. ...Steve -- Steve van der Burg Information Services London Health Sciences Centre (519) 685-8300 ext 35559 [EMAIL PROTECTED]
Simple program _setting_ REMOTE_ADDR
In order to get a certain buggy, poorly-designed application from a well-known vendor to maintain its sessions in the face of the user's IP address changing (vendor doesn't understand that addresses may change between requests), I'd like to have Apache lie to the vendor's canned CGI app about it. That is, I'd like to set REMOTE_ADDR like so: # Feed vendor's crappy CGI code a fake address that won't change: PerlSetEnv REMOTE_ADDR 1.2.3.4 When I test this with a simple dump-the-environment script (/cgi-bin/VENDOR/test) still shows my real IP address! I've tried doing it with Apache's SetEnvIf (OT here, I know), and that doesn't do it either. A quick check of the Eagle book, and a search through dejanews didn't turn up anything, and this should be easy... Help! ...Steve -- Steve van der Burg Information Services London Health Sciences Centre (519) 685-8300 ext 35559 [EMAIL PROTECTED]
mod_perl caches compiled quotes?
Hi, I'm seeing some very disturbing behavior while running mod_perl. I'm sure there must be a workaround for this. Sorry if this is a FAQ, but I haven't seen anything discussing this. I use mod_perl to generate pages based on a user from cookies and a database (DBI/MySql). Use strict is in effect everywhere (I've checked). I print this data using syntax of the form: print qq( Your personal details are $name $salary); (Simplified obviously, but you get the idea). This works fine the first time, but the person who accesses the page frequently gets the details of the last person to access the server. Needless to say this is a Bad Thing. Is it the case that the results of the string interpolation are cached and used in the next run of the script? This would seem to be the case, as touching the script or restarting the server seems to remove the problem, until the next run. I've attached some version info below. Apache/1.3.12 (Unix) mod_perl/1.23 mod_ssl/2.6.3 OpenSSL/0.9.5 Perl: 5.005_03 Redhat6.1 However, I tried compiling up to the latest versions (including perl 5.6.0) on a development machine and saw the same behavior. What am I doing wrong? Thanks, Steve
Re: Apache children hanging
o.1...done. > Reading symbols from /lib/libdl.so.2...done. > Reading symbols from /lib/libc.so.6...done. > Reading symbols from /lib/ld-linux.so.2...done. > Reading symbols from /lib/libnss_files.so.2...done. > Reading symbols from > /usr/lib/perl5/site_perl/5.005/i586-linux/auto/Sybase/DBlib/DBlib.none...done. > > Reading symbols from /opt/sybase/lib/libsybdb.so...done. > Reading symbols from /opt/sybase/lib/libinsck.so...done. > Reading symbols from /lib/libnss_nisplus.so.2...done. > Reading symbols from /lib/libnss_nis.so.2...done. > 0x80a7407 in free_blocks () > > => let's see what the stack tells us... > > (gdb) i s > #0 0x80a7407 in free_blocks () > #1 0x80a7660 in ap_clear_pool () > #2 0x80a76a1 in ap_destroy_pool () > #3 0x80be71a in ap_destroy_sub_req () > #4 0x8070d8a in XS_Apache__SubRequest_DESTROY () > #5 0x400d0f45 in Perl_pp_entersub () at pp_hot.c:1965 > #6 0x4007aa8d in perl_call_sv () at perl.c:1008 > #7 0x400d9d4c in Perl_sv_clear () at sv.c:2418 > #8 0x400da451 in Perl_sv_free () at sv.c:2418 > #9 0x400d24ab in do_clean_objs (sv=0x8385744) at sv.c:338 > #10 0x400d237c in visit (f=0x400d2410 ) at sv.c:306 > #11 0x400d263f in Perl_sv_clean_objs () at sv.c:359 > #12 0x40077fa5 in perl_destruct () at perl.c:1008 > #13 0x80635a3 in perl_shutdown () > #14 0x80645c5 in perl_child_exit () > #15 0x8064430 in perl_child_exit_cleanup () > #16 0x80a8dd6 in run_cleanups () > #17 0x80a762c in ap_clear_pool () > #18 0x80a76a1 in ap_destroy_pool () > #19 0x80b3b03 in clean_child_exit () > #20 0x80b6773 in child_main () > #21 0x80b6e14 in make_child () > #22 0x80b716e in perform_idle_server_maintenance () > #23 0x80b7665 in standalone_main () > #24 0x80b7cd3 in main () > > => registers have: > > (gdb) i r > eax0x8a3e408144958472 > ecx0x8608414140542996 > edx0x8a3e408144958472 > ebx0x8239208136548872 > esp0xb90c 0xb90c > ebp0xb910 0xb910 > esi0x1 1 > edi0x -1 > eip0x80a74070x80a7407 > eflags 0x202514 > cs 0x23 35 > ss 0x2b 43 > ds 0x2b 43 > es 0x2b 43 > fs 0x0 0 > gs 0x0 0 > > => this is a dump of the running function > > (gdb) disas > Dump of assembler code for function free_blocks: > 0x80a73e0 :push %ebp > 0x80a73e1 : mov%esp,%ebp > 0x80a73e3 : sub$0x4,%esp > 0x80a73e6 : cmpl $0x0,0x8(%ebp) > 0x80a73ea : jne0x80a73f0 > 0x80a73ec : jmp0x80a7439 > 0x80a73ee : mov%esi,%esi > 0x80a73f0 : mov0x8146b88,%eax > 0x80a73f5 : mov%eax,0xfffc(%ebp) > 0x80a73f8 : mov0x8(%ebp),%eax > 0x80a73fb : mov%eax,0x8146b88 > 0x80a7400 : mov0x8(%ebp),%eax > 0x80a7403 : cmpl $0x0,0x4(%eax) > 0x80a7407 : jne0x80a740c > 0x80a7409 : jmp0x80a7424 > 0x80a740b : nop > 0x80a740c : mov0x8(%ebp),%eax > 0x80a740f : mov0x8(%ebp),%ecx > 0x80a7412 : add$0xc,%ecx > 0x80a7415 : mov%ecx,0x8(%eax) > 0x80a7418 : mov0x8(%ebp),%eax > 0x80a741b : mov0x4(%eax),%edx > 0x80a741e : mov%edx,0x8(%ebp) > 0x80a7421 : jmp0x80a7400 > 0x80a7423 : nop > 0x80a7424 : mov0x8(%ebp),%eax > 0x80a7427 : mov0x8(%ebp),%ecx > 0x80a742a : add$0xc,%ecx > 0x80a742d : mov%ecx,0x8(%eax) > 0x80a7430 : mov0x8(%ebp),%eax > 0x80a7433 : mov0xfffc(%ebp),%edx > 0x80a7436 : mov%edx,0x4(%eax) > 0x80a7439 : leave > 0x80a743a : ret > > => strace doesn't show any system calls going on, which makes sense, > since we don't ever leave free_blocks() > > .EOF. > =-=-=-=-=-=-=-=-=-=- My God! What have I done? -=-=-=-=-=-=-=-=-=-= Steve Reppucci [EMAIL PROTECTED] | Logical Choice Software http://logsoft.com/ | 508/958-0183 Be Open |
RE: Bugs 5.6.0 modperl use?
Well, I haven't used it for long (obviously, I suppose...;), but our digitalmass.com domain is currently running a 5.6.0/1.24/1.3.12 combination, and seems to be holding up well. We *do* have a periodic problem with a child process going haywire and twisting itself into a tight 'sbrk' loop, but we've seen this on our 5.00503/1.23 setups too, it's just something odd that we haven't been able to trace down as of yet. I've been using a simple monitoring script to watch for these and kill them off when needed, and I get 2 or three a day. So I guess my answer is, "seems ok to us..."! On Thu, 25 May 2000, Jeff Stuart wrote: > That's a GOOD question. Is there anyone at the moment using perl 5.6.0 in > production? Is it ready for production yet? > > -- > Jeff (FurBall) > WebOverdrive Newbie Tech Board > http://www.topniche.com/tech/ > [EMAIL PROTECTED] > =-=-=-=-=-=-=-=-=-=- My God! What have I done? -=-=-=-=-=-=-=-=-=-= Steve Reppucci [EMAIL PROTECTED] | Logical Choice Software http://logsoft.com/ | 508/958-0183 Be Open |
Re: REPOST: Limiting Resources
>>>>>> Steve van der Burg <[EMAIL PROTECTED]> writes: > >>> I am trying to limit the execution of a mod_perl script by setting the >>> limit of RLimitCPU. But >>> this does not seem to work. I am using apache 1.3.12 , mod_perl. I >>> tired using the module >>> Apache::Resource but even that did not work. >>> >>> Does any body know why this is or am i missing something. >>> > >SvdB> The RLimit stuff only affects processes forked from the httpd >SvdB> children (ie. CGI processes). mod_perl code is part of the >SvdB> webserver child, so the limits don't apply. You'll need to look > >No; you are wrong. They do apply to the httpd child process when >using Apache::Resource. > >Here's how I set it up: > ># limit CPU usage in seconds >PerlSetEnv PERL_RLIMIT_CPU 90:600 ># limit DATA segment in MB >PerlSetEnv PERL_RLIMIT_DATA 32:64 >PerlChildInitHandler Apache::Resource > >Then in my startup.perl script I "use Apache::Resource". > >The CPU time is indeed enforced on the mod_perl code. Thanks for the info, although I'd file this under "other methods", since it's not using Apache's RLimitCPU directive. I'll definitely start doing this myself now. I'm not sure how I missed it before! ...Steve -- Steve van der Burg Information Services London Health Sciences Centre (519) 685-8300 ext 35559 [EMAIL PROTECTED]
Re: REPOST: Limiting Resources
>I am trying to limit the execution of a mod_perl script by setting the >limit of RLimitCPU. But >this does not seem to work. I am using apache 1.3.12 , mod_perl. I >tired using the module >Apache::Resource but even that did not work. > >Does any body know why this is or am i missing something. > The RLimit stuff only affects processes forked from the httpd children (ie. CGI processes). mod_perl code is part of the webserver child, so the limits don't apply. You'll need to look into limiting the httpd processes using another method (like in the shell that's used to launch the httpd parent). ...Steve -- Steve van der Burg Information Services London Health Sciences Centre (519) 685-8300 ext 35559 [EMAIL PROTECTED]
Re: "make test" fails, httpd fails to start
The file t/logs/error_log is never created. httpd fails because /t/conf/httpd.conf looks more like a pod file than a httpd.conf. How is the correct httpd.conf file supposed to be created? What can I do to determine why the creation is not happening?? Steve Bauer Stas Bekman wrote: > > On Mon, 8 May 2000, Steve Bauer wrote: > > > I have apache 1.3.12, and mod_perl 1.23. both apache and mod_perl build > > successfully, but make test fails. the output from "make test" is: > > > > cp t/conf/mod_perl_srm.conf t/conf/srm.conf httpd fails to start because of the following. > > will write error_log to: t/logs/error_log > > Syntax error on line 3 of /tmp/mod_perl-1.23/t/conf/httpd.conf: > > Invalid command '=pod', perhaps mis-spelled or defined by a module not > > included in the server configuration > > letting apache warm up...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. > > *** Error code 146 > > make: Fatal error: Command failed for target `run_tests' > > Yeah, how about: > > server failed to start! (please examine t/logs/error_log) at t/TEST line >^^^ > > 95. > > > > > > > The file /t/httpd.conf contain several pod commands. > > > > Anybody have any ideas of where to look or how to fix this?? > > > > Steve Bauer > > Cyber Database Solutions. > > > > __ > Stas Bekman | JAm_pH--Just Another mod_perl Hacker > http://stason.org/ | mod_perl Guide http://perl.apache.org/guide > mailto:[EMAIL PROTECTED] | http://perl.orghttp://stason.org/TULARC/ > http://singlesheaven.com| http://perlmonth.com http://sourcegarden.org > --
"make test" fails, httpd fails to start
I have apache 1.3.12, and mod_perl 1.23. both apache and mod_perl build successfully, but make test fails. the output from "make test" is: cp t/conf/mod_perl_srm.conf t/conf/srm.conf ../apache_1.3.12/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 Syntax error on line 3 of /tmp/mod_perl-1.23/t/conf/httpd.conf: Invalid command '=pod', perhaps mis-spelled or defined by a module not included in the server configuration letting apache warm up...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. *** Error code 146 make: Fatal error: Command failed for target `run_tests' The file /t/httpd.conf contain several pod commands. Anybody have any ideas of where to look or how to fix this?? Steve Bauer Cyber Database Solutions.
Re: Problem compiling mod_perl 1.23 on Solaris 2.4
John D Groenveld wrote: > -Xa is a Sun WorkShop Compiler C 4.2 option, > -X[a|c|s|t] > Specifies the degree of conformance to the ANSI C stan- > dard. Specifies one of the following: > > a (ANSI) >ANSI C plus K&R C compatibility extensions, with >semantic changes required by ANSI C. Where K&R C >and ANSI C specify different semantics for the >same construct, the compiler will issue warnings >about the conflict and use the ANSI C interpreta- >tion. This is the default compiler mode. The machine I was building on was Solaris 2.4 with the Sun Compiler v3.0 in which the cc manpage says "-Xt" ('transition') is the default. I also have a Solaris 2.6 machine with the Sun Compiler v4.0 which says, like the snippet above, that "-Xa" is the default. Steve Hay
Re: Problem compiling mod_perl 1.23 on Solaris 2.4
Steve Hay wrote: > I'm having a problem compiling mod_perl 1.23 (with Apache 1.3.12 / Perl > 5.6.0) as a DSO using APXS on Solaris 2.4. In case anyone is interested... I've solved my own problem (just as well, really). If I re-compile everything with the -Xa compiler flag then it all works out fine.
Problem compiling mod_perl 1.23 on Solaris 2.4
Hi, I'm having a problem compiling mod_perl 1.23 (with Apache 1.3.12 / Perl 5.6.0) as a DSO using APXS on Solaris 2.4. This worked fine using Apache 1.3.6 / Perl 5.005_03 / mod_perl 1.22. Can anybody help? I built the Perl with "-Uusemymalloc" which I had found was necessary under the previous setup. Here's the output:- radsun2-4% perl Makefile.PL USE_APXS=1 WITH_APXS=/usr/local/apache/bin/apxs EVERYTHING=1 Will configure via APXS (apxs=/usr/local/apache/bin/apxs) 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 Will run tests as User: 'radan' Group: 'usr' Configuring mod_perl for building via APXS + Creating a local mod_perl source tree + Setting up mod_perl build environment (Makefile) + id: mod_perl/1.23 + id: Perl/v5.6.0 (solaris) [perl] Now please type 'make' to build libperl.so Checking CGI.pm VERSION..ok Checking for LWP::UserAgent..ok Checking for HTML::HeadParserok Checking if your kit is complete... Looks good 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 radsun2-4% make (cd ./apaci && make) cc -KPIC -O -I/usr/local/lib/perl5/5.6.0/sun4-solaris/CORE -DMOD_PERL_VERSION=\"1.23\" -DMOD_PERL_STRING_VERSION=\"mod_perl/1.23\" -I/usr/local/apache/include -DMOD_PERL -DSOLARIS2=240 -DUSE_HSREGEX -DUSE_EXPAT -I../lib/expat-lite -c mod_perl.c && mv mod_perl.o mod_perl.lo "/usr/local/lib/perl5/5.6.0/sun4-solaris/CORE/perl.h", line 1929: warning: operand treated as unsigned: 0x87654321 "./mod_perl.h", line 584: warning: macro replacement within a string literal "./mod_perl.h", line 587: warning: macro replacement within a string literal "./mod_perl.h", line 590: warning: macro replacement within a string literal "./mod_perl.h", line 593: warning: macro replacement within a string literal "mod_perl.c", line 344: fatal: macro recursion cc: acomp failed for mod_perl.c *** Error code 2 make: Fatal error: Command failed for target `mod_perl.lo' Current working directory /tmp/mod_perl-1.23/apaci *** Error code 1 make: Fatal error: Command failed for target `apxs_libperl' radsun2-4%
Compiling mod_perl on Windows NT
Hi, I've just been building Perl 5.6.0 / mod_perl 1.23 / Apache 1.3.12 on Windows NT and found something which may be of some use. The Apache installation does not seem to copy the headers and library files from the build directory into the install directory (which it DOES on Unix), so to build mod_perl you need to keep that Apache build build directory handy. I found that manually copying apache_1.3.12\src\include apache_1.3.12\src\os\win32\*.h apache_1.3.12\src\CoreR\ApacheCore.lib into the install directory and then pointing the DevStudio include/library paths at these locations in the install directory works fine, thus removing the need to keep the build directory floating about. This presumably means that I can now ditch the build directory and still be able to build mod_perl 1.24 when it comes using only my Apache install directory. - Steve Hay
Re: Problem with CGI::Carp under mod_perl
Gunther Birznieks wrote: > At 02:02 PM 4/18/00 +0100, Steve Hay wrote: > > >I'm having problems using "CGI::Carp qw(fatalsToBrowser);" in modperl > >scripts. > > Sorry for the late reply. I was actually trying to figure out why you were > experiencing this problem. I rarely use Perl 5.005 specific features, and > so I actually received reasonable results where you were not. > > It turns out that CGI::Carp does a specific check for Perl 5.005 and above > and uses a different mechanism that asks whether it is in an eval block. > Unfortunately the $^S variable gives information that is not precisely the > same as the error string parsing (for "eval") technique in it's > effectiveness under mod_perl. > > [snip] > > Go into your CGI::Carp.pm file and look for the > ineval() method. Manually edit it to remove the 5.005 check and just > compile an ineval() routine that is dependent on longmess() instead of $^S. Thanks very much for your reply, this works a treat under 5.005_03 and also my new Perl 5.6.0 / mod_perl 1.23 / Apache 1.3.12 setup which I'm testing out. This is a great help to me. I hope the change makes it into CGI::Carp -- have you heard anything from the author yet? > >error_syntax.pl > >--- > > > > use CGI::Carp qw(fatalsToBrowser); > > $| = 1; > > print "Content-Type: text/html\n\n"; > > print "Syntax error at the end of this line ...\n" > > print "blah blah blah.\n"; > > > >Apache/CGI: > > > >Software error: > >Execution of d:/inetpub/cgi-bin/error_syntax.pl aborted due to > >compilation errors. > >For help, please send mail to the webmaster ([EMAIL PROTECTED]), > >giving this error message and the time and date of > >the error. > > > >Apache/modperl: > > > >Internal Server Error > >The server encountered an internal error or misconfiguration and was > >unable to complete your request. > >Please contact the server administrator, [EMAIL PROTECTED] and > >inform them of the time the error occurred, and > >anything you might have done that may have caused the error. > >More information about this error may be available in the server error > >log. > > This you cannot solve. Although CGI::Carp can catch fatal errors at script > startup because compile errors are fatal at that point. When a stirng is > eval'ed to compile the string into a set of data, though, those errors are > NOT fatal. They are warnings. > > Unfortunately, to get around this you would need to modify Apache::Registry > to trap warnings before compiling code and then die with a fatal error if > one of those warnings was a compile error. I can live without this, but it seems like an excellent idea. Any takers for doing it (I don't think I'm quite up to it myself...)? - Steve Hay
Re: Problem with CGI::Carp under mod_perl
Perrin Harkins wrote: > On Tue, 18 Apr 2000, Steve Hay wrote: > > > The first one calls die() itself. > [...] > > Sounds like a difference in the way CGI scripts and mod_perl buffer. I > fyou really want CGI::Carp to work, you need to make sure you don't send > any output before it gets called. Maybe you have PerlSendHeader on? I did have PerlSendHeader On: turning it off causes a DOS Prompt to pop up briefly, the die() message still goes to error.log and no output appears in the browser at all! > > The second one has a syntax error. > [...] > > CGI::Carp can't catch compile errors. Oh. The CGI::Carp manpage says (regarding the use of "set_message()" to control the output message): "In order to correctly intercept compile-time errors, you should call set_message() from within a BEGIN{} block. ", which suggests it does catch compile errors? I've tried both with "BEGIN {set_message('...')}" and without a set_message() at all, but to no avail. - Steve Hay
Problem with CGI::Carp under mod_perl
Sorry! Here it is again in text/plain this time... (My mail client doesn't ask whether I want to send in text or HTML, hence the slip. Maybe *I* should get a new one!) --- I'm having problems using "CGI::Carp qw(fatalsToBrowser);" in modperl scripts. Below are three short scripts and their output under Apache/CGI and Apache/modperl. All three of them produce (more or less) useful output under Apache/CGI, but only the last one does under Apache/modperl. The first one calls die() itself. Under Apache/CGI the die() message appears in the web browser (albeit preceded by a spurious Content-Type line), but under Apache/modperl the message goes to the error.log and a bizarre message appears in the web browser consisting of some output from the script, followed by a "200 OK" HTTP header, followed by a message suggesting that all was not OK after all (all the same as if CGI::Carp was not being used). The second one has a syntax error. Under Apache/CGI a message about a compilation error appears in the web browser (but not the detail of the syntax error itself, which disappears completely - not even going to error.log!); under Apache/modperl an "Internal Server Error" message appears in the web browser (again just like CGI::Carp was not being used) and (curiously) the detail of the syntax error does now at least appear in error.log! The third one attempts a division by zero and correctly says so in the web browser under both Apache/CGI and Apache/modperl. Can anybody explain what's going on here??? The first script is closest to the problem I've really got. I'm using DBI/DBD::mysql and I want SQL syntax errors (which I keep making) to appear in the web browser instead of having to keep opening the error.log. Running under Apache/CGI I get useful messages like: Software error: DBD::mysql::st execute failed: You have an error in your SQL syntax near 'BINARY USER_NAME LIKE 'mk-%' LIMIT 10' at line 1 at d:/inetpub/cgi-bin/mysql.pl line 300. but under Apache/modperl I just get useless garbage like the error_die.pl below produces. I'm running Perl 5.005_03 / Apache 1.3.6 / mod_perl 1.22 on NT 4. error_die.pl use CGI::Carp qw(fatalsToBrowser); $| = 1; print "Content-Type: text/html\n\n"; print "I'm about to die() ...\n"; die "I'm dead.\n"; Apache/CGI: I'm about to die() ... Content-type: text/html Software error: I'm dead. For help, please send mail to the webmaster ([EMAIL PROTECTED]), giving this error message and the time and date of the error. Apache/modperl: I'm about to die() ... HTTP/1.1 200 OK Date: Tue, 18 Apr 2000 11:09:35 GMT Server: Apache/1.3.6 (Win32) mod_perl/1.22 Connection: close Content-Type: text/html OK The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, [EMAIL PROTECTED] and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. error_syntax.pl --- use CGI::Carp qw(fatalsToBrowser); $| = 1; print "Content-Type: text/html\n\n"; print "Syntax error at the end of this line ...\n" print "blah blah blah.\n"; Apache/CGI: Software error: Execution of d:/inetpub/cgi-bin/error_syntax.pl aborted due to compilation errors. For help, please send mail to the webmaster ([EMAIL PROTECTED]), giving this error message and the time and date of the error. Apache/modperl: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, [EMAIL PROTECTED] and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. error_divide.pl --- use CGI::Carp qw(fatalsToBrowser); $| = 1; print "Content-Type: text/html\n\n"; print "I'm about to divide by zero ...\n"; my $x = 1 / 0; Apache/CGI: Software error: Illegal division by zero at d:/inetpub/cgi-bin/error_divide.pl line 5. For help, please send mail to the webmaster ([EMAIL PROTECTED]), giving this error message and the time and date of the error. Apache/modperl: Software error: Illegal division by zero at d:/inetpub/cgi-bin/error_divide.pl line 5. For help, please send mail to the webmaster ([EMAIL PROTECTED]), giving this error message and the time and date of the error.
Problem with CGI::Carp under mod_perl
I'm having problems using "CGI::Carp qw(fatalsToBrowser);" in modperl scripts. Below are three short scripts and their output under Apache/CGI and Apache/modperl. All three of them produce (more or less) useful output under Apache/CGI, but only the last one does under Apache/modperl. The first one calls die() itself. Under Apache/CGI the die() message appears in the web browser (albeit preceded by a spurious Content-Type line), but under Apache/modperl the message goes to the error.log and a bizarre message appears in the web browser consisting of some output from the script, followed by a "200 OK" HTTP header, followed by a message suggesting that all was not OK after all (all the same as if CGI::Carp was not being used). The second one has a syntax error. Under Apache/CGI a message about a compilation error appears in the web browser (but not the detail of the syntax error itself, which disappears completely - not even going to error.log!); under Apache/modperl an "Internal Server Error" message appears in the web browser (again just like CGI::Carp was not being used) and (curiously) the detail of the syntax error does now at least appear in error.log! The third one attempts a division by zero and correctly says so in the web browser under both Apache/CGI and Apache/modperl. Can anybody explain what's going on here??? The first script is closest to the problem I've really got. I'm using DBI/DBD::mysql and I want SQL syntax errors (which I keep making) to appear in the web browser instead of having to keep opening the error.log. Running under Apache/CGI I get useful messages like: Software error: DBD::mysql::st execute failed: You have an error in your SQL syntax near 'BINARY USER_NAME LIKE 'mk-%' LIMIT 10' at line 1 at d:/inetpub/cgi-bin/mysql.pl line 300. but under Apache/modperl I just get useless garbage like the error_die.pl below produces. I'm running Perl 5.005_03 / Apache 1.3.6 / mod_perl 1.22 on NT 4. error_die.pl use CGI::Carp qw(fatalsToBrowser); $| = 1; print "Content-Type: text/html\n\n"; print "I'm about to die() ...\n"; die "I'm dead.\n"; Apache/CGI: I'm about to die() ... Content-type: text/html Software error: I'm dead. For help, please send mail to the webmaster ([EMAIL PROTECTED]), giving this error message and the time and date of the error. Apache/modperl: I'm about to die() ... HTTP/1.1 200 OK Date: Tue, 18 Apr 2000 11:09:35 GMT Server: Apache/1.3.6 (Win32) mod_perl/1.22 Connection: close Content-Type: text/html OK The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, [EMAIL PROTECTED] and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. error_syntax.pl --- use CGI::Carp qw(fatalsToBrowser); $| = 1; print "Content-Type: text/html\n\n"; print "Syntax error at the end of this line ...\n" print "blah blah blah.\n"; Apache/CGI: Software error: Execution of d:/inetpub/cgi-bin/error_syntax.pl aborted due to compilation errors. For help, please send mail to the webmaster ([EMAIL PROTECTED]), giving this error message and the time and date of the error. Apache/modperl: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, [EMAIL PROTECTED] and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. error_divide.pl --- use CGI::Carp qw(fatalsToBrowser); $| = 1; print "Content-Type: text/html\n\n"; print "I'm about to divide by zero ...\n"; my $x = 1 / 0; Apache/CGI: Software error: Illegal division by zero at d:/inetpub/cgi-bin/error_divide.pl line 5. For help, please send mail to the webmaster ([EMAIL PROTECTED]), giving this error message and the time and date of the error. Apache/modperl: Software error: Illegal division by zero at d:/inetpub/cgi-bin/error_divide.pl line 5. For help, please send mail to the webmaster ([EMAIL PROTECTED]), giving this error message and the time and date of the error.
Re: [OT] mysql-modules for Win32 platform
Erich Markert wrote: > I've been trying to get the msql-mysql-modules compiled and installed on > my Win98 machine for a couple weeks without much luck. I managed to get these working on NT4 with both 5.005_03 and 5.6.0 (both built myself from the standard distribution, not the ActiveState build) after a bit of hacking... > I tried using the latest version of perl 5.6 from active state but ran > into nothing but problems. Basically running perl Makefile.PL for > Data::ShowTable (a required module) failed because the version of perl > couldn't be determined - even after reinstalling. I also had trouble with this when I had mSQL installed. It said "Unable to find a perl 5" and then proceeded to name the files it was looking for (including perl.exe!) and the directories where it was looking (including D:\perl5\bin, which is where it was!). To my surprise, I found that uninstalling mSQL and then trying to build Data::ShowTable again worked fine! Weird. Anyway, I've now ditched mSQL in favour of the much better MySQL which doesn't suffer this problem. I don't know if this is the same problem you had -- you might have a different problem because you're using the ActiveState build? I never had much luck building any CPAN modules with that, which is why I never use it... I do still get 17/17 tests failed when running "nmake test" (!!!), but its enough to stop msql-mysql-modules complaining that a pre-requisite is missing. > I finally reverted back the a previous version of perl (Gurusamy > Sarathy's version 5.004_02) and was able to get Data::ShowTable and DBI > installed but now when I run perl Makefile.PL for Msql-Mysql-modules I > receive these errors: > > Note (probably harmless): No library found for 'm.lib' I got a similar message regarding "-lm" which I just ignored (!!!... well, it said it was probably harmless :-) I also found that I had to hack the Makefile generated by "perl Makefile.PL" to change the two lines which say: -e ppp '...' '...' '...' to: -e "ppp('...', '...', '...')" and I hacked the Makefile in the mysql sub-directory to change: OTHERLDFLAGS = -LD:\mysql/lib/opt to: OTHERLDFLAGS = -LIBPATH:D:\mysql/lib/opt None of this was necessary on my Solaris 2.6 box, however, where everything went like a dream... - Steve Hay
Re: Problem Compiling with Perl 5.6.0
> > $status = system "D:\\WINNT\\system32\\ipconfig.exe > > D:\\Temp\\ip.txt"; > > > > then it carries on fine under Apache (now re-directing the output to the > "ip.txt" > > file), but under Apache+mod_perl the $status gets set to 256, the "ip.txt" > file is > > not created and I get the error > > > > The handle could not be opened > > during redirection of handle 1. > > > > in error.log > > > > What is it that changed between Apache 1.3.6 (which doesn't have this > problem) and > > Apache 1.3.12 which causes this to happen, and can mod_perl be changed to > cope > > with it? > > Hi Steve, > I've tried this with the latest cvs mod_perl snapshot, like you > use, with Perl 5.6.0 and Apache_1.3.12. I'm using Win98, with the > 4DOS tools. As a cgi-bin script, > my $status = "ipconfig > C:\\test.txt" [I take it you meant 'my $status = system "ipconfig > C:\\test.txt";' here?!] > > returns $status = 0, and C:\test.txt capturing the output. > As an Apache::Registry script, the same thing returns > a status of 256 (with a DOS window briefly opening and > closing), but I get C:\test.txt still capturing the output. So it > may have something to do with the different DOS "shells"? Eh? I don't believe the DOS "shell" changed between Apache 1.3.6 and Apache 1.3.12!! The fact that you're running a different DOS "shell" to me does not explain the problem: it only explains why your experience of the problem it slightly different to mine. It was changing from Apache 1.3.6 to Apache 1.3.12 which broke it -- my DOS "shell" didn't change! And did you get the line in the error.log? Steve Hay
Re: Problem Compiling with Perl 5.6.0
Doug MacEachern wrote: > lemme guess, Perl_rsignal? somehow i managed not to commit this > yesterday, it's in cvs now. i don't have a win32 system to test on at the > moment, so any feeback from you, Randy K and others helps a great deal, > thanks. Great! I've just given the latest cvs another try, and for the first time that I've seen ApacheModulePerl.dll compiled and linked with 0 errors and 0 warnings. What's more, it even seems to work too after having given it a quick bashing. Unfortunately (for me, at least), I've still got the same problem which I had with Perl 5.005_03, namely that I can't re-direct STDOUT in system() calls. The following program works fine: $| = 1; print "Content-Type: text/plain\n\n"; $status = system "D:\\WINNT\\system32\\ipconfig.exe"; print "The system() call exited with status $status.\n"; (under Apache the output from IPCONFIG.EXE appears in the browser, under Apache+mod_perl it disappears somewhere, like the mod_perl Guide says it will, and $status is 0 both times). But, if I change: $status = system "D:\\WINNT\\system32\\ipconfig.exe"; to: $status = system "D:\\WINNT\\system32\\ipconfig.exe > D:\\Temp\\ip.txt"; then it carries on fine under Apache (now re-directing the output to the "ip.txt" file), but under Apache+mod_perl the $status gets set to 256, the "ip.txt" file is not created and I get the error The handle could not be opened during redirection of handle 1. in error.log What is it that changed between Apache 1.3.6 (which doesn't have this problem) and Apache 1.3.12 which causes this to happen, and can mod_perl be changed to cope with it? Steve Hay
Re: Problem Compiling with Perl 5.6.0
Thanks for this! I tried it with the latest mod_perl cvs: mine now compiles perfectly too (_never_ seen that before!!!), and there's now only 1 unresolved external symbol instead of 7. Looks like it could be nearly there - I'll try another one some time. I look forward to mod_perl 1.23 ... Steve Hay Randy Kobes wrote: > On Thu, 30 Mar 2000, Steve Hay wrote: > > > Has anyone else got 5.6.0 / 1.3.12 / 1.22 going on NT 4? > > Hi, > There's a couple things you can do - > > - add the flag /D "WIN32IOP_H" - this handles the win32_opendir > and similar errors. > - for the mode_t error, in apache/src/os/win32/os.h, change > the typedef of mode_t from 'int' to 'unsigned short', so as > to agree with the mode_t typedef of perl in perl/lib/core/win32.h. > In the same apache os.h file, if you change the typedef of > uid_t and gid_t from 'int' to 'long', again so as to agree > with Perl's typedefs, then the compilation, at least for me, > proceeeds without warnings. > > Unfortunately, there's some problems in the linking phase - some > symbols that were present in perl.lib of 5.005_03 have been > removed from perl56.lib of 5.6.0. Doug has worked on this - you > may want to get the latest mod_perl cvs snapshot from > http://perl.apache.org/ and try that.
Re: Problem Compiling with Perl 5.6.0
"G.W. Haywood" wrote: > Come to think of it, NT probably wasn't the best idea you ever had > either. I agree, but we're selling a web application and most of our customers want it on NT. > > Unfortunately, now I can't get (the Apache side of) mod_perl to > > compile. > > You aren't alone. You really are on the bleeding edge with that lot. > My advice would be ro try Linux, and stick with Perl 5.005_03 and > mod_perl 1.21/Apache 1.3.11 (or .12) for a few weeks. Well, I got mod_perl 1.22 going on NT with Perl 5.005_03 / Apache 1.3.12 (apart from the problem with system() calls...) after two quick hacks (one to lib\Apache\src.pm and one to src\modules\perl\Util.xs) so it just seems a shame I can't get it to go with Perl 5.6.0. I just wondered if anyone out there new of any more hacks to help...
Problem Compiling with Perl 5.6.0
Since I had no reply to my previous problem (re-directing STDOUT in system() calls), I thought I would try using Perl 5.6.0 instead of 5.005_03 (probably a good idea anyway) to see if that helped. Unfortunately, now I can't get (the Apache side of) mod_perl to compile. I'm using MSVC++ 6.0 on Windows NT 4. Perl 5.6.0 and Apache 1.3.12 compiled fine, as does the Perl side of mod_perl 1.22, but when I go into Dev Studio to compile the Apache side I get the following output for each file: D:\Temp\apache_1.3.12\src\include\../os/win32/os.h(87) : warning C4005: 'crypt' : macro redefinition D:\perl5\lib\CORE\win32iop.h(301) : see previous definition of 'crypt' D:\Temp\apache_1.3.12\src\include\../os/win32/os.h(109) : warning C4142: benign redefinition of type D:\Temp\apache_1.3.12\src\include\../os/win32/os.h(110) : warning C4142: benign redefinition of type D:\Temp\apache_1.3.12\src\include\../os/win32/os.h(112) : error C2371: 'mode_t' : redefinition; different basic types D:\perl5\lib\CORE\win32.h(197) : see declaration of 'mode_t' D:\Temp\apache_1.3.12\src\include\../os/win32/os.h(146) : warning C4005: 'sleep' : macro redefinition D:\perl5\lib\CORE\win32iop.h(279) : see previous definition of 'sleep' D:\Program Files\Microsoft Visual Studio\VC98\Include\stddef.h(78) : warning C4005: 'errno' : macro redefinition D:\perl5\lib\CORE\win32iop.h(188) : see previous definition of 'errno' D:\Temp\apache_1.3.12\src\include\../os/win32/os.h(165) : warning C4005: 'stat' : macro redefinition D:\perl5\lib\CORE\win32iop.h(223) : see previous definition of 'stat' D:\Temp\apache_1.3.12\src\include\../os/win32/readdir.h(34) : error C2373: 'win32_opendir' : redefinition; different type modifiers D:\perl5\lib\CORE\win32iop.h(116) : see declaration of 'win32_opendir' D:\Temp\apache_1.3.12\src\include\../os/win32/readdir.h(35) : error C2373: 'win32_readdir' : redefinition; different type modifiers D:\perl5\lib\CORE\win32iop.h(117) : see declaration of 'win32_readdir' D:\Temp\apache_1.3.12\src\include\../os/win32/readdir.h(36) : error C2373: 'win32_closedir' : redefinition; different type modifiers D:\perl5\lib\CORE\win32iop.h(121) : see declaration of 'win32_closedir' Any ideas, anyone? Has anyone else got 5.6.0 / 1.3.12 / 1.22 going on NT 4? Steve Hay
Re: Problem re-directing STDOUT in system() calls
"Andrei A. Voropaev" wrote: > See the guide. Under modperl the output from system will not go to the > user unless your perl was compiled with sfio. The reason for that I > guess is that under modperl STDOUT is tied to a package, while system > commands expect file descriptor. The easiest way to overcome it is to > use `` (backtics) and capture all output into variable and then print > it out. > > Andrei The guide actually says: 3.5.5 Output from system calls Output of system(), exec(), and open(PIPE,"|program") calls will not be sent to the browser unless your Perl was configured with sfio. which is fair enough, but does it explain the problem I've got? It DOES explain why the following script prints the output of IPCONFIG in the browser when running under Apache and doesn't when running under Apache + mod_perl: $| = 1; print "Content-Type: text/plain\n\n"; $status = system "D:\\WINNT\\system32\\ipconfig.exe"; print "The system() call exited with status $status.\n"; but that isn't my problem. How does it explain why the following works under Apache 1.3.6 + mod_perl and not under Apache 1.3.12 + mod_perl: print "Content-Type: text/plain\n\n"; $status = system "D:\\WINNT\\system32\\ipconfig.exe > D:\\Temp\\ip.txt"; print "The system() call exited with status $status.\n"; ? I'm not trying to get the output of the system() call into the browser - I want to re-direct it to a file - and the difference between the one which works and the one which doesn't work is not mod_perl: it's the Apache version! Am I also correct in thinking that configuring Perl with sfio is only an option on Unix (which, BTW, doesn't have my problem anyway!)? Help! Steve Hay
Problem re-directing STDOUT in system() calls
Hi, I've had this problem before, but never got to the bottom of it. I'm cursed with a situation in which I need to run some .exe file from a (mod)perl script. The program concerned is a console application so it just writes its output on STDOUT. I need to re-direct that output to a temporary file, and then read the file in to process in the perl script. Sounds simple enough, and it works fine running Apache without mod_perl. But as soon as I put mod_perl into the equation I find that I can't re-direct STDOUT in the system() call. The following script illustrates the problem: print "Content-Type: text/html\n\n"; $status = system "D:\\WINNT\\system32\\ipconfig.exe > D:\\Temp\\ip.txt"; print "The system() call exited with status $status.\n"; Without mod_perl this works fine: "ip.txt" is created and $status is 0. But with mod_perl "ip.txt" is not created, $status is 256 and the following line appears in error.log: The handle could not be opened during redirection of handle 1. Can anyone help? My setup is as follows: - NT 4 Workstation, Service Pack 6 - Perl 5.005_03 built with VC++ 6 and the Makefile options: CFG = Optimize USE_PERLCRT PERL_MALLOC - Apache 1.3.12 built with VC++ 6 - mod_perl 1.22 built with VC++ 6 - D: is a local disk which I have full access to I've found that the problem goes away if I downgrade to Apache 1.3.6 and keep everything else the same! Steve Hay
RE: ANNOUNCE: HTML::Embperl 1.3b2
On Mon, 14 Feb 2000, Gerald Richter wrote: > If you really like to do so, we have to compile the perl (of every object) > for every namepsace it will run into. Currently I think more of a feature > like exporting variables (like Perl modules can do), so that they are > visible in all object during the request. What do you think? Yes, that makes sense. Perhaps an optional argument for Execute that lists the variables to export? Actually, there has to be a way to get variables in both directions. Perhaps an export list and an import list in the params to Execute? Or maybe if you just make sure we can export hashes like %fdat, %cdat and %errors, then that would take care of the bidirectional need. > Currently you can get $ENV{SCRIPT_NAME} that contains /x/y/z.html and > $ENV{PATH_TRANSLATED} will contain the filename of page your are in at the > moment. Everything else you have strip out of these two at the moment. Yep. I'm kinda thinking of making templates easy to use for newbie engineers. Although specialized variables tend to duplicate things that are in other variables, they are useful for making things easier to use. I don't know if there's an elegant way to do it, though -- after all my meetings, I don't have a lot of brainpower left right now for design. > > This is useful in situations where I want to have nav bars that > > are page-specific, then directory-specific, then site-default. > > In this example, for the top nav, I would look for y/z_top.html, > > then y/_top.html, then _top.html. > > Anyway, that's what I do. I don't know that my solution is the > > most elegant, though. > > If you do an Execute ("_top.html") then it will look in the same directories > for _top.html, as it looked for the _template.html. In your example this > means Embperl will automaticly look for /x/y/_top.html and /x/_top.html, but > not /_top.html. Maybe it would be usefull to search for /_top.html also, but > I am not sure how it is the best to determinate where to stop the serach for > such sub-objects. The current solution would be to have a /_template.html > which that calls a _another_template.html and _another_template.html is the > one that is overwritten (and calls _top.html). In that way EmbperlObject > will always serach "/x/y", "/x", "/". I realized this, and I definitely like the way you did it. The only thing it doesn't give me is _per page_ "_top.html" files. If you see my example at the top, you see it looks for y/z_top.html first. This functionality isn't supported in the path right now. Just a thought: What if the path somehow supported a prefix on filenames? Like if it was "y/z:y/:./", then you tack on the filename after each element in the path. The only problem is that this would require a trailing "/" on true directory names, but if you changed EmbperlObject to generate conforming paths it wouldn't be so much of a problem (I think). > But this could be easily done with a Perl regex and I don't want to setup to > much globals, because they pollute your namespace and it takes time to set > them up. Both are bad in cases you don't need them. When we have the export > feature (I decribed above, or something which serve the same purpose), you > could simple set them up at the top of your template. Yes. I may do this, since there's typically only one template per website. Or perhaps in a single function each template calls (which is what I'm currently doing). > > The reason I ask is that we use these things called "actions", > > where the filename in the URL doesn't usually exist. The "action" > > is a library object referenced by $fdat{AID}. The library object > > is executed, and depending on error or success state, it returns > > back different names for the object that should be loaded. > > *Then* we load the object. This very useful for form handlers that > > have different states, as it avoids redirects or big [$if$] > > blocks in html files. > > Any ideas? > > I think we can make Embperl here more smart/configurable it is able to > handle this case also in your way I really liked this "action" idea when I found out about it, as it solves multi-state responses to forms (error state, success state, etc.) very elegantly. Out of curiosity, what do you typically do for forms? An example might be a registration form where there are required fields. How does your page flow work? > > Okay, so I'm a little verbose. Now I'll report a bug I've found lately: > > Remember, I run templates and objects in the same namespace? I've found > > that variables declared in the template often are not cleaned up at the > > end of the request. The next page load goes to the same template, of > > course, and the variable is still there. > > I guess this is because you call the object from different pages (with > different namespaces). As mentioned above Perl can only compile them for one > namespace, so the object is compiled for namespace A, but
Slight performance enhancement for dynamic sites.
Here's a tiny performance tweak that I stumbled across that I don't believe I've seen in any of the other online docs. (Stas, maybe you can suck this into the guide if you think it's something new...) In doing some tweaking on one of our modperl servers earlier this week, I noticed via 'truss' that a bunch of 'stat's were being done for non-existent files. The fact that they are non-existent is cool, because it's a site that has no document root, its sole purpose is to dynamically generate and cache date bar images in a bunch of different styles (http://date.boston.com/, BTW.) But I didn't like the thought that these stat calls were happening for each request. So, my solution was to add the following to the VirtualHost section for that host: . . PerlTransHandler "sub { return OK; }" . . This has the effect of short circuiting the normal TransHandler processing of trying to find a filesystem component that matches the given URI -- no more 'stat's! For this vhost, I was able to apply this globally, but I can imagine cases where others have portions of a document tree that are static along with portions that are dynamic, and needing to supply a bit more sophisticated TransHandler routine to only return OK if the requested URI matches the dynamic portions of the document tree. If anyone has a better way of handling this, or a pointer to somewhere in the book or online where this is discussed, I'll be happy to hear of it. -=-=-=-=-=-=-=-=-=- My God! What have I done? =-=-=-=-=-=-=-=-=-= Steve Reppucci 617/929-7003 Director of Software Development [EMAIL PROTECTED] Boston.com (Times Company Digital) Be Open
As long as we're at it...
As long as we're on the job thread: Boston.com is looking to hire another programmer, preferably one with modperl experience, but we're extremely willing to hire someone who's just a good, solid web programmer, with an interest in learning about apache and modperl. Requirements are a strong knowledge of perl and a desire explore new ways to use it to help drive site traffic. We'd be willing to hire someone on a contract basis, but would prefer a fulltime employee. Database background would be nice. Other stuff: We're in Boston, MA (USA) near the Children's Museum, about 3 blocks from South Station. A good, young, fun group of people, who are committed to writing clean, fast code. (You'll be hard pressed to find stuff without 'use strict' here...) We're all Unix, all the time (Solaris, Linux), so please, MSCE me no MSCEs. mailto:[EMAIL PROTECTED] Thanks. -=-=-=-=-=-=-=-=-=- My God! What have I done? =-=-=-=-=-=-=-=-=-= Steve Reppucci 617/929-7003 Director of Software Development [EMAIL PROTECTED] Boston.com (Times Company Digital) Be Open
Re: Using network appliance Filer with modperl
Hi John, This is exactly the approach we use at boston.com, a large regional news site, serving roughly 3 million pages/day. For historical reasons, most of our web servers for serving static content are Netscape Enterprise servers, but we use modperl for all of our new development of dynamic sites (see http://mp3.boston.com/, the code for which we're planning on releasing as open source "real soon now".) We typically run the server root off of a local disk, to keep log traffic and other server accesses off the network. We have a shared document root that lives on the NetApp, all of the web servers read this. (The document root is mounted read/write, mostly because I didn't set it up originally. If I were setting this up from scratch, I'd probably try to have the web servers mount it readonly, with only the content upload hosts having write access.) We're running our perl include tree off of the NFS device also, which may or may not be a good idea, but it sure makes it easy to keep CPAN modules up to date. We've been extremely happy with the convenience and reliability of this setup. You *do* need to be aware of the differences in locking semantics across NFS devices. We're running mostly Solaris, and while I don't have any proof that it doesn't work, I have seen some strange conditions that lead me to believe that 'flock' doesn't always behave correctly across the NFS device. (Anyone who can provide proof otherwise, I'm all ears...) Atomic renames seem to behave as expected, so you can roll your own lockfile based mechanism if that's an issue, but we lately have taken to using MySQL to store shared data so that normal DB semantics can be used to coordinate distributed processes. Also, you need to worry a bit about OS versions of the hosts running your web servers -- binaries on the NFS device compiled for Solaris 7 aren't going to behave well if one of your web servers is running 2.51 (or even Linux!), for example. Good luck. On Mon, 31 Jan 2000, siberian wrote: > Hi All- > I am building a pretty in depth architecture for our new service > using ModPerl. I've done a lot of large scale/high traffic apps in modperl > before but never in conjunction with a network attached file server. I am > thinking that it would really make my life easy to have one central > repository of code, databases and sundry files that all the servers share > ( making it easy to swap out servers, add servers etc since its a central > file repository that everyone just hooks into ). > > My question is : Has anyone experienced any 'gotchas' in putting perl code > that modperl handlers use on a Network Attached file server like a network > appliance box ( www.netapp.com )? I am assuming that there are no real > issues but before i go blow a ton of cash on this thing I wanted to be > sure that no one had found a problem. > > Thanks for any pointers. > John Armstrong > =-=-=-=-=-=-=-=-=-=- My God! What have I done? -=-=-=-=-=-=-=-=-=-= Steve Reppucci [EMAIL PROTECTED] | Logical Choice Software http://logsoft.com/ | 508/958-0183 Be Open |