Re: mod_perl: Configuration info at run-time

2000-06-13 Thread Matt Sergeant

On Mon, 12 Jun 2000, Richard L. Goerwitz wrote:

 In response to my query about how to get a list of virtual
 servers, Matt Sergeant wrote:
 
  It's server-next():
  
  for (my $s = Apache-server; $s; $s = $s-next()) {
  print "Virtual host: ", $s-server_hostname, "\n";
  }
 
 Here's a followup:
 
 Is there any reasonable way to use the list of servers (successive
 values of $s above) to determine what mod_perl PerlSetVar directives
 have been issued for each virtual host?
 
 E.g., is there some clever way to use Apache::ModuleConfig-get ()
 to do this?

$s-dir_config() should work.

-- 
Matt/

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org http://xml.sergeant.org




Where do I put my code?

2000-06-13 Thread Ariel Manzur

Hi..

I need apache to do this: always ask for authentication, accept any
username/password as valid, and set an enviroment variable with the
password, so I can retrieve it on a CGI script later. I wrote this code:

Perl
my $r = Apache-request;
my $username = $r-connection-user;
my($ret, $password) = $r-get_basic_auth_pw;

if ($username and $password) {
   @SetEnv = ("PASSWORD", $password);
} else {
   print "HTTP/1.1 401 Authentication required\n";
   print "WWW-Authenticate: Basic realm=\"Protected stuff\"\n";
   print "Content-type: text/html\n\n";
   print "Authorization required";
};
/Perl

I need to do this on /auth/ on one of the sites, so I put this code on a
.htaccess file, and then I tryed on httpd.conf, inside Location /auth
inside the Virtualhost for that site, but on all cases I get "Perl not
allowed here".

Is my code correct? where should I put it?

Thanks.. Bye.

Ariel.





Re: mod_perl, Perl 5.6 .0 DBI

2000-06-13 Thread Rolf Stoll

On Mon, Jun 12, 2000 at 09:48:25AM +0200, Rolf Stoll wrote:
  With mod_perl I get a:   [notice] child pid 652 exit signal
Segmentation fault (11)
  as soon as i try to make a $dbh = DBI-connect(...);

 For me, I solved the problem by configuring PHP4
 with --with-mysql=/usr/local, which forced it to use the
 libmysqlclient
 in /usr/local/lib/mysql, and things were much happier.
 -- Jake Buchholz

Thank You for solving the Problem. With Your advices mod_perl works for
me fine with DBI on my MySQL-database. That PHP 4.0 is the reason for my
problems I had never thought. Great.




Re: Apache::Session weirdness

2000-06-13 Thread Jure Simsic

I see. That explains it..
Perhaps it would be nice just to put a note about this in the
Apache::Session documentation..

Jure


Ken Miller wrote:
 
 At 03:13 AM 6/10/00 +0200, Jure Simsic wrote:
 I'm tryng to use Apache::Session and store a bunch of data into a
 (complex) hash (using FileStore). The weirdest thing, that made me
 banging my head for a while was, that when i first initialised the
 session, everything was stored fine. But after restoring it and trying
 to update it, nothing got updated..
 
 At first it seemed thar it was some weird kind of perl/Apache::Session
 thing, that it didn't get updated because i was working on a refference
 on the hash
 (~ $ref=\$session{key1}; $$ref{foo}="bar";..)
 And I put it all back to lengthy writing ($session{key1}{foo}="bar"),
 hoping that it will help but of course, it didn't. It did seem a bit odd
 in the first place..
 
 Then i was going nowhere for a while, until i put at the end, just
 before untie-ing the hash, $session{TIMESTAMP} = time(); and magically
 everything got updated and back to normal!!???
 
 Hello? Is there something I'm missing?? Isn't that just plain weird or
 is there something deeper?
 
 The session hash reference is a tied var.  When you follow a reference past
 the first level, the tied methods don't get invoked.  When you update the
 top level (as you did with the time()) you cause the tied methods to be
 invoked, and subsequently, the data is stored.
 
 The last thing I do in my handlers, right before I untie the hash, is to
 update a timestamp, just as you did.
 
 Hope that explains it.
 
 Cheers!
 
 -klm.
 
 +--+---+
 | Kenneth L. Miller, Consultant| "And as you rise above the fearlines  |
 | Shetland Software Services Inc.  |  in the frown you look down, hear |
 | [EMAIL PROTECTED] |  the sound of the faces in the crowd" |
 |  |- Fearless, Pink Floyd |
 +--+---+

-- 
Jure Simsic
email:  [EMAIL PROTECTED]
[EMAIL PROTECTED]



Expanding a URI

2000-06-13 Thread Kenneth Lee

Hi all,

I'm writing a fixup handler which do some statistics for each request 
base on the URI. The problem is when I open "/", I have no way to know 
the file sent to the client in the Response Phase is "/index.html" or 
whatever it was mapped.

$r-filename gives me "/www/htdocs", i.e $r-document_root, which is 
not what I wanted.

Is there any work-around here?

Thanks.
Kenneth



Perl Handler not called from Directory

2000-06-13 Thread Richard Hadley

Hi,

I have written a PerlHandler that executes when called from within a Location tag. But 
doesn't even get called when I change the tag to being a Directory tag.

e.g
Location
SetHandler perl-script
PerlHandler Apache::MyModule
/Location
Works fine

Directory
SetHandler perl-script
PerlHandler Apache::MyModule
/Directory

NOTHING HAPPENS ...!

Anyone know why this is ?

MTIA
Richard



Re: mod_perl: Configuration info at run-time

2000-06-13 Thread Richard L. Goerwitz

To get a list of virtual servers -

   for (my $s = Apache-server; $s; $s = $s-next()) {
   print "Virtual host: ", $s-server_hostname, "\n";
   }

  Is there any reasonable way to use the list of servers (successive
  values of $s above) to determine what mod_perl PerlSetVar directives
  have been issued for each virtual host?
 
  E.g., is there some clever way to use Apache::ModuleConfig-get ()
  to do this?
 
 $s-dir_config() should work.

You've actually hit upon my original reason for writing.  For whatever
reason, the following code doesn't work for me.  The dir_config routine
doesn't find what it's looking for (although it should - or at least so
I thought):

sub handler () {

  my $r = shift;
  my $vserver;

  $r-status (OK);
  $r-content_type ('text/plain');
  $r-send_http_header ();

  for ($vserver = Apache-server; $vserver; $vserver = $vserver-next) {
$r-print ('server: ', $vserver-server_hostname(), "\n");
$r-print ('port: ',   $vserver-port(), "\n");
$r-print ('variable value: ', $vserver-dir_config
('SomePerlVariable'), "\n");
  }

etc.

-- 
Richard Goerwitz[EMAIL PROTECTED]



Re: mod_perl: Configuration info at run-time

2000-06-13 Thread Matt Sergeant

On Tue, 13 Jun 2000, Richard L. Goerwitz wrote:

 To get a list of virtual servers -
 
for (my $s = Apache-server; $s; $s = $s-next()) {
print "Virtual host: ", $s-server_hostname, "\n";
}
 
   Is there any reasonable way to use the list of servers (successive
   values of $s above) to determine what mod_perl PerlSetVar directives
   have been issued for each virtual host?
  
   E.g., is there some clever way to use Apache::ModuleConfig-get ()
   to do this?
  
  $s-dir_config() should work.
 
 You've actually hit upon my original reason for writing.  For whatever
 reason, the following code doesn't work for me.  The dir_config routine
 doesn't find what it's looking for (although it should - or at least so
 I thought):
 
 sub handler () {
 
   my $r = shift;
   my $vserver;
 
   $r-status (OK);
   $r-content_type ('text/plain');
   $r-send_http_header ();
 
   for ($vserver = Apache-server; $vserver; $vserver = $vserver-next) {
 $r-print ('server: ', $vserver-server_hostname(), "\n");
 $r-print ('port: ',   $vserver-port(), "\n");
 $r-print ('variable value: ', $vserver-dir_config
 ('SomePerlVariable'), "\n");
   }

OK then, try this:

for ($s = Apache-server; $s; $s = $s-next) {
my ($server, $port) = ($s-server_hostname, $s-port);
$r-print('server: ', $server, "\n");
$r-print('port: ', $port, "\n");

my $subreq = $r-lookup_uri("http://$server:$port/");
$r-print('variable value: ',
$subreq-dir_config('SomePerlVariable'), "\n");
}

-- 
Matt/

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org http://xml.sergeant.org




Re: perl vs java

2000-06-13 Thread Roger Espel Llima

 Now, now...that is unfair. I was referring to writing in pure Perl vs pure 
 Java.
 
 Of course, C apis and pre-written daemon integration makes the glue 
 language a moot point (and favors Perl actually).

Well, mine is pure perl.  it can speak the protocol to integrate with a
pre-written C irc daemon, but you don't *have* to use it with one.

 BTW, is select() is still broken in Win32 Perl? It was 6 months ago (I 
 suspect because IO operates differently on win32) so you'd limit your 
 platform too.

Last I heard, perl's select() under win32 worked for sockets, but not
for pipes or ttys.  Anyway, limiting myself to platforms where select()
works doesn't strike me as a bad thing...

-- 
Roger Espel Llima, [EMAIL PROTECTED]
http://www.iagora.com/~espel/index.html



Re: Apache::Session weirdness

2000-06-13 Thread Perrin Harkins

On Tue, 13 Jun 2000, Jure Simsic wrote:

 I see. That explains it..
 Perhaps it would be nice just to put a note about this in the
 Apache::Session documentation..

It's already there:

  "Note that Apache::Session does only a shallow check to see
   if anything has changed.  If nothing changes in the top
   level tied hash, the data will not be updated in the
   backing store.  You are encouraged to timestamp the
   session hash so that it is sure to be updated."

- Perrin





Apache::AuthCookie

2000-06-13 Thread MOORHOUSE, John NW Group Risk


Having problem with the above, anyone any idea

It doesn't seem to create the cookie

I added the log_error above err_header_out in login()

$r-log_error("SET COOKIE " . $self-_cookie_string($r,
"$auth_type\_$auth_name", $ses_key)) if ($debug = 2);
$r-err_header_out("Set-Cookie" = $self-_cookie_string($r,
"$auth_type\_$auth_name", $ses_key));

errorlog entry
SET COOKIE Sample::AuthCookieHandler_Tas=fd3388f426a210cba2a1d6307345c56a;
path=/; domain=hp7;
[Tue Jun 13 18:05:11 2000] [error] ses_key_cookie


i.e  it doesn't seem to have set the cookie??

Any ideas would be greatly appreciated!!


Thanks
John



This e-mail is intended only for the addressee named above.
As this e-mail may contain confidential or privileged information,
if you are not the named addressee, you are not authorised to
retain, read, copy or disseminate this message or any part of it.



This e-mail is intended only for the addressee named above.
As this e-mail may contain confidential or privileged information,
if you are not the named addressee, you are not authorised to
retain, read, copy or disseminate this message or any part of it.





Cookie ordering

2000-06-13 Thread morpheus


I read something a while back in the archives about people having problems
with setting cookies via err_headers_out.  I need to arrange cookies in a
particular order using ap_table_add(r-err_headers_out, "Set-Cookie",
list);  Does anyone have a recommendation on how to ensure that the
Set-Cookie is set before the Location header?  I'm using err_headers_out
for errors and persistence across internal redirects.

Thanks

~m






Re: Where do I put my code?

2000-06-13 Thread Ariel Manzur

Hi.. this is very helpful.. thanks.. :-)

Now, I have one last question. Where do I put the "pachage Test::AuthAny" code?

At 09:24 13/06/2000 -0400, darren chamberlain wrote:
 I need apache to do this: always ask for authentication, accept any
 username/password as valid, and set an enviroment variable with the
 password, so I can retrieve it on a CGI script later. I wrote this code:

You're on the right track; put this code into it's own module, and run it.
This should work:

package Test::AuthAny;

use strict;
use Apache::Constants qw( OK AUTH_REQUIRED );

sub handler {
my $r = shift;
my ($u,$p) = ($r-connection-user,($r-get_basic_auth_pw)[1]); 

if ($u  $p) {
$r-subprocess_env(USERNAME = $u);
$r-subprocess_env(PASSWORD = $p);
return OK;
} else {
$r-note_basic_auth_failure;
$r-log_reason("username and password don't match");
return AUTH_REQUIRED;
}
}
1;
__END__


Install it as a PerlAuthenHandler for /auth/ like so:

Location /auth
# Any other directievs you might have here already ...
AuthType  Basic
AuthName  "Name of the Authentcation Realm" 
require   valid-user
PerlAuthenHandler Test::AuthAny
/Location

Now, from your CGI scripts, or SSI's, or whatever, you can grab $ENV{USERNAME}
and $ENV{PASSWORD} and use them.

 Thanks.. Bye.
 
 Ariel.

darren

-- 
There are worse things in life than death. Have you ever spent an
evening with an insurance salesman?
-- Woody Allen




handlers on CPAN

2000-06-13 Thread J. J. Horner

 do handlers belong on CPAN?

Thanks,
JJ

-- 
J. J. Horner
Apache, Perl, Unix, Linux
[EMAIL PROTECTED] http://www.knoxlug.org/




Re: mod_perl: Configuration info at run-time

2000-06-13 Thread Richard L. Goerwitz

Matt Sergeant wrote:

   for ($s = Apache-server; $s; $s = $s-next) {
   my ($server, $port) = ($s-server_hostname, $s-port);
   $r-print('server: ', $server, "\n");
   $r-print('port: ', $port, "\n");
  
   my $subreq = $r-lookup_uri("http://$server:$port/");
   $r-print('variable value: ', $subreq-dir_config('SomePerlVariable'), 
"\n");
   }

 Why don't you just try it? It should work regardless. The auth stuff
 should only happen if you actually call $subreq-run()

Thanks for that pointer re subreqs and auth.  I appreciate it.

For whatever reason, when I try this, though, dir_config() doesn't pick
up any of my Perl variables, even though it (naturally) has no trouble
doing this when called in the usual way (e.g., $r-dir_config()).

My configuration is pretty vanilla:  RedHat 6.1 w/ from-scratch builds
of Perl 5.00503, Apache 1.3.12, mod_perl 1.24.

-- 
Richard Goerwitz[EMAIL PROTECTED]



Logging response times

2000-06-13 Thread Eric Jain

I currently log "time - $r-request_time" in my PerlLogHandler.

This seems to works well, but I'm sure there is a better method, which
also is able to log more detailed than just in seconds...



--
Eric Jain




How do I get modperl and php to coexist?

2000-06-13 Thread Rob Tanner

With both modperl and php3 installed in apache (static build), modperl 
works fine and php simply doesn't work.  When I try a GET on a *.php3 page, 
my browser wants to save it.  That symptom addressed in the php faq (#6.8) 
which states that the php module is not getting invoked and has some 
suggested things to check, none of which were the cause of the problem. 
The only way I got php to work, was to build the server sans modperl.  I 
really need both for my project, but if I have to sacrifice, it will be the 
php that goes.

The particulars are php-3.0.16, modperl-1.24, mod-ssl-2.6.4, apache-1.3.12.

Any suggested fix?

-- Rob



   _ _ _ _   __ _ _ _ _
  /\_\_\_\_\/\_\ /\_\_\_\_\_\
 /\/_/_/_/_/   /\/_/ \/_/_/_/_/_/  QUIDQUID LATINE DICTUM SIT,
/\/_/__\/_/ __/\/_//\/_/  PROFUNDUM VIDITUR
   /\/_/_/_/_/ /\_\  /\/_//\/_/
  /\/_/ \/_/  /\/_/_/\/_//\/_/ (Whatever is said in Latin
  \/_/  \/_/  \/_/_/_/_/ \/_/  appears profound)

  Rob Tanner
  McMinnville, Oregon
  [EMAIL PROTECTED]



Re: How do I get modperl and php to coexist?

2000-06-13 Thread Ime Smits

| works fine and php simply doesn't work.  When I try a GET on a *.php3
page,
| my browser wants to save it.  That symptom addressed in the php faq (#6.8)

Look for a line like

AddType application/x-httpd-php3 .php3 .php .phtml

in your httpd.conf. If it ain't there, that's propably your problem.

Ime




RE: How do I get modperl and php to coexist?

2000-06-13 Thread Rob Tanner

It's Caldera's 2.3 Linux distribution.  I'm not sure off the top of my head 
(and I'm not near my machine) what the kernel level -- it's a v2 something 
(2.2.0.10 or something like that??)

-- Rob


--On Tuesday, June 13, 2000 1:35 PM -0700 Karyn Ulriksen 
[EMAIL PROTECTED] wrote:

 Which OS  OS Version?  I've compiled all these plus FrontPage on Solaris
  Linux.

 -Original Message-
 From: Rob Tanner [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, June 13, 2000 1:35 PM
 To: mod_perl discuss
 Subject: How do I get modperl and php to coexist?


 With both modperl and php3 installed in apache (static build), modperl
 works fine and php simply doesn't work.  When I try a GET on a *.php3
 page,  my browser wants to save it.  That symptom addressed in the php
 faq (#6.8)  which states that the php module is not getting invoked and
 has some  suggested things to check, none of which were the cause of the
 problem.  The only way I got php to work, was to build the server sans
 modperl.  I  really need both for my project, but if I have to sacrifice,
 it will be the  php that goes.

 The particulars are php-3.0.16, modperl-1.24, mod-ssl-2.6.4,
 apache-1.3.12.

 Any suggested fix?

 -- Rob



_ _ _ _   __ _ _ _ _
   /\_\_\_\_\/\_\ /\_\_\_\_\_\
  /\/_/_/_/_/   /\/_/ \/_/_/_/_/_/  QUIDQUID LATINE DICTUM SIT,
 /\/_/__\/_/ __/\/_//\/_/  PROFUNDUM VIDITUR
/\/_/_/_/_/ /\_\  /\/_//\/_/
   /\/_/ \/_/  /\/_/_/\/_//\/_/ (Whatever is said in Latin
   \/_/  \/_/  \/_/_/_/_/ \/_/  appears profound)

   Rob Tanner
   McMinnville, Oregon
   [EMAIL PROTECTED]




   _ _ _ _   __ _ _ _ _
  /\_\_\_\_\/\_\ /\_\_\_\_\_\
 /\/_/_/_/_/   /\/_/ \/_/_/_/_/_/  QUIDQUID LATINE DICTUM SIT,
/\/_/__\/_/ __/\/_//\/_/  PROFUNDUM VIDITUR
   /\/_/_/_/_/ /\_\  /\/_//\/_/
  /\/_/ \/_/  /\/_/_/\/_//\/_/ (Whatever is said in Latin
  \/_/  \/_/  \/_/_/_/_/ \/_/  appears profound)

  Rob Tanner
  McMinnville, Oregon
  [EMAIL PROTECTED]



Re: How do I get modperl and php to coexist?

2000-06-13 Thread Rob Tanner

That would be too easy.  'Fraid it's there.

-- Rob

--On Tuesday, June 13, 2000 11:07 PM +0200 Ime Smits [EMAIL PROTECTED] wrote:

 | works fine and php simply doesn't work.  When I try a GET on a *.php3
 page,
 | my browser wants to save it.  That symptom addressed in the php faq
 (#6.8)

 Look for a line like

 AddType application/x-httpd-php3 .php3 .php .phtml

 in your httpd.conf. If it ain't there, that's propably your problem.

 Ime





   _ _ _ _   __ _ _ _ _
  /\_\_\_\_\/\_\ /\_\_\_\_\_\
 /\/_/_/_/_/   /\/_/ \/_/_/_/_/_/  QUIDQUID LATINE DICTUM SIT,
/\/_/__\/_/ __/\/_//\/_/  PROFUNDUM VIDITUR
   /\/_/_/_/_/ /\_\  /\/_//\/_/
  /\/_/ \/_/  /\/_/_/\/_//\/_/ (Whatever is said in Latin
  \/_/  \/_/  \/_/_/_/_/ \/_/  appears profound)

  Rob Tanner
  McMinnville, Oregon
  [EMAIL PROTECTED]



RE: How do I get modperl and php to coexist?

2000-06-13 Thread Karyn Ulriksen

Let's start with the basics,

   If you run 'httpd -l', doesn mod_php show up in the list of compiled in
modules that it spits out?  If yes, Apache did compile with PHP with at
least minimum PHP services.  If no, Apache did not compile in PHP.

   If you cd to "apache distribution root/src/modules/", do you see a
subdirectory call "php3"?  If yes, PHP set up the module structure to do at
least a minimum PHP service module.  If no, you didn't get very far with
your PHP install.

   How did you compile Apache?

Did you let mod_perl compile it?
Did you let follow PHP's 'quick install' at the top of PHP's INSTALL
file?
Did you cd into the apache distribution root/src" directory and
install it
from there while using AddModule statement in the Configuration
file?
Did you cd into "apache distribution root", and type something
like:
"./configure --activate-php-module .."  ?


 - Karyn

-Original Message-
From: Rob Tanner [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 13, 2000 2:16 PM
To: Karyn Ulriksen; 'Rob Tanner'
Cc: '[EMAIL PROTECTED]'
Subject: RE: How do I get modperl and php to coexist? 


It's Caldera's 2.3 Linux distribution.  I'm not sure off the top of my head 
(and I'm not near my machine) what the kernel level -- it's a v2 something 
(2.2.0.10 or something like that??)

-- Rob


--On Tuesday, June 13, 2000 1:35 PM -0700 Karyn Ulriksen 
[EMAIL PROTECTED] wrote:

 Which OS  OS Version?  I've compiled all these plus FrontPage on Solaris
  Linux.

 -Original Message-
 From: Rob Tanner [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, June 13, 2000 1:35 PM
 To: mod_perl discuss
 Subject: How do I get modperl and php to coexist?


 With both modperl and php3 installed in apache (static build), modperl
 works fine and php simply doesn't work.  When I try a GET on a *.php3
 page,  my browser wants to save it.  That symptom addressed in the php
 faq (#6.8)  which states that the php module is not getting invoked and
 has some  suggested things to check, none of which were the cause of the
 problem.  The only way I got php to work, was to build the server sans
 modperl.  I  really need both for my project, but if I have to sacrifice,
 it will be the  php that goes.

 The particulars are php-3.0.16, modperl-1.24, mod-ssl-2.6.4,
 apache-1.3.12.

 Any suggested fix?

 -- Rob



_ _ _ _   __ _ _ _ _
   /\_\_\_\_\/\_\ /\_\_\_\_\_\
  /\/_/_/_/_/   /\/_/ \/_/_/_/_/_/  QUIDQUID LATINE DICTUM SIT,
 /\/_/__\/_/ __/\/_//\/_/  PROFUNDUM VIDITUR
/\/_/_/_/_/ /\_\  /\/_//\/_/
   /\/_/ \/_/  /\/_/_/\/_//\/_/ (Whatever is said in Latin
   \/_/  \/_/  \/_/_/_/_/ \/_/  appears profound)

   Rob Tanner
   McMinnville, Oregon
   [EMAIL PROTECTED]




   _ _ _ _   __ _ _ _ _
  /\_\_\_\_\/\_\ /\_\_\_\_\_\
 /\/_/_/_/_/   /\/_/ \/_/_/_/_/_/  QUIDQUID LATINE DICTUM SIT,
/\/_/__\/_/ __/\/_//\/_/  PROFUNDUM VIDITUR
   /\/_/_/_/_/ /\_\  /\/_//\/_/
  /\/_/ \/_/  /\/_/_/\/_//\/_/ (Whatever is said in Latin
  \/_/  \/_/  \/_/_/_/_/ \/_/  appears profound)

  Rob Tanner
  McMinnville, Oregon
  [EMAIL PROTECTED]



Re: [OT] Re: sendMail in cgi program

2000-06-13 Thread Ian Kallen


Well, you _can _ do this
$var="END";
   This is my variable's
   multiline text,
   complete tith tabs\t\t and extra newline\n\n, etc
END

four spaces in the opening and closing quote.  I usually use qq{ }
depending on how much I care about whitespace formatting.  If I was
writing Perl code to generate Python code, I'd be in trouble (in more
than one way).


Paul wrote:
 As someone mentioned on the board (ever so briefly), here-documents
 like this one require that your "sentinel" string have no leading
 whitespace.
 
 e.i., you may say
$var=END;
   This is my variable's
   multiline text,
   complete tith tabs\t\t and extra newline\n\n, etc
 END
 
 but you *can't* say
$var=END;
   blah
END
 
 because here, END has space in front of it.
 In several shells you can put tabs in front of it if you say
print-END; # the dash says "let me use a leading tab"
blah
 tab hereEND

--
Salon Internet  http://www.salon.com/
  Manager, Software and Systems "Livin' La Vida Unix!"
Ian Kallen [EMAIL PROTECTED] / AIM: iankallen / Fax: (415) 354-3326



Re: [OT] Making apps (un)available solution

2000-06-13 Thread Frank Wiles

 .--[ Erich L. Markert wrote (2000/06/13 at 15:24:26) ]--
 | 
 |  I'm trying to figure out the best way to make apps (un)available without
 |  having to edit the apache config files.
 |  
 |  Any suggestions would be appreciated.
 |  
 `-

I was discussing this just the other day with some fellow perl
coders. The only solution we can up with would be to either append
an Include with your configs in it. Or to store your config
information in a database or other flat file and use Perl sections
within the config.  

Honestly I don't see any way around editing the config files short
of just using an Apache::Registry directory. 

 ---
  Frank Wiles [EMAIL PROTECTED]
  http://frank.wiles.org
 ---




RE: Problem compiling with HPUX 11 64-bit OS

2000-06-13 Thread Scott Phan

Gavin,

I still have problems when compiling Apache. However, I managed to retrieve
an Apache 1.3.12 version that works on hpux 11 64-bit OS at this address:
http://hpux.connect.org.uk/hppd/hpux/Networking/WWW/apache-1.3.12/

But when I integrate it with mod_perl version 1.24, the httpd doesn’t
recognize “TypesConfig” and “SetHandler perl-script” directives even though
the required module is compiled.

Here is a list of modules:

# ./httpd -l
Compiled-in modules:
  http_core.c
  mod_env.c
  mod_log_config.c
  mod_mime.c
  mod_negotiation.c
  mod_status.c
  mod_include.c
  mod_autoindex.c
  mod_dir.c
  mod_cgi.c
  mod_asis.c
  mod_imap.c
  mod_actions.c
  mod_userdir.c
  mod_alias.c
  mod_access.c
  mod_auth.c
  mod_setenvif.c
  mod_perl.c
suexec: disabled; invalid wrapper /usr/local/apache/bin/suexec

I preferred using Apache 1.3.9 since the default directories are set to
“conf” and “logs” instead of “etc” and “adm”

Here’s the compilation error:

gmake[3]: Entering directory `/export/scottp/apache_1.3.9/src/os/unix'
cc -c  -I../../os/unix -I../../include   -DHPUX11 -Aa -D_HPUX_SOURCE -DUSE_H
SREGEX -DUSE_EXPAT -I../../lib/expat-lite `../../apaci` os.c
cc: "/usr/include/dlfcn.h", line 17: error 1681: Must use +e or -Ae for long
long in ANSI mode.
gmake[3]: *** [os.o] Error 1
gmake[3]: Leaving directory `/export/scottp/apache_1.3.9/src/os/unix'
gmake[2]: *** [subdirs] Error 1
gmake[2]: Leaving directory `/export/scottp/apache_1.3.9/src'
gmake[1]: *** [build-std] Error 2
gmake[1]: Leaving directory `/export/scottp/apache_1.3.9'
gmake: *** [build] Error 2

Appreciate your comments … Thanks,

Scott

-Original Message-
From: Gavin Mathias [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 12, 2000 4:14 PM
To: Scott Phan; [EMAIL PROTECTED]
Subject: RE: Problem compiling with HPUX 11 64-bit OS


Add these lines to the apache Configuration file in the src directory

EXTRA_CFLAGS=`perl -MExtUtils::Embed -e ccopts`
EXTRA_LIBS=`perl -MExtUtils::Embed -e ldopts`

and recompile.

Regards,
Gavin


 -Original Message-
From:   Scott Phan [mailto:[EMAIL PROTECTED]]
Sent:   Monday, June 12, 2000 10:41 AM
To: [EMAIL PROTECTED]
Subject:Problem compiling with HPUX 11 64-bit OS

Help,

I'm trying to compile mod_perl on 64-bit HPUX 11.  The following error
occurs during the make process:

cc -c  -I./os/unix -I./include   -DHPUX11 -Aa -D_HPUX_SOURCE -DUSE_HSREGEX -
DUSE_EXPAT -I./lib/expat-lite -D_HPUX_SOURCE -I/usr/local/include -D_LARGEFI
LE_SOURCE -D_FILE_OFFSET_BITS=64 -Ae -DMOD_PERL modules.c
cc -c  -I./os/unix -I./include   -DHPUX11 -Aa -D_HPUX_SOURCE -DUSE_HSREGEX -
DUSE_EXPAT -I./lib/expat-lite -D_HPUX_SOURCE -I/usr/local/include -D_LARGEFI
LE_SOURCE -D_FILE_OFFSET_BITS=64 -Ae -DMOD_PERL buildmark.c
cc  -DHPUX11 -Aa -D_HPUX_SOURCE -DUSE_HSREGEX -DUSE_EXPAT -I./lib/expat-lite
 -D_HPUX_SOURCE -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS
=64 -Ae -DMOD_PERL\
  -o httpd buildmark.o modules.o modules/perl/libperl.a
modules/standard/libstandard.a main/libmain.a ./os/unix/libos.a ap/libap.a
regex/libregex.a lib/expat-lite/libexpat.a `perl
/export/scottp/mod_perl-1.24/src/modules/perl/ldopts  ` -lm -lpthread
/usr/ccs/bin/ld: Unsatisfied symbols:
   dlclose (code)
   dlopen (code)
   dlerror (code)
   dlsym (code)
gmake[1]: *** [target_static] Error 1
gmake[1]: Leaving directory `/export/scottp/apache_1.3.9/src'
gmake: *** [apache_httpd] Error 2


I have Apache 1.3.9 source code and 1.24 for mod_perl

The configuration flags are:

# perl Makefile.PL
Configure mod_perl with ../apache_1.3.9/src ? [y]
Shall I build httpd in ../apache_1.3.9/src for you? [y]
Appending mod_perl to src/Configuration
Using config file: /export/scottp/mod_perl-1.24/src/Configuration
Creating Makefile
 + configured for HP-UX 11 platform
 + setting C compiler to cc
 + setting C pre-processor to cc -E
 + checking for system header files
 + adding selected modules
 + checking sizeof various data types
 + doing sanity check on compiler and options
Creating Makefile in support
Creating Makefile in regex
Creating Makefile in os/unix
Creating Makefile in ap
Creating Makefile in main
Creating Makefile in lib/expat-lite
Creating Makefile in modules/standard
EXTRA_CFLAGS: -DHPUX11 -Aa -D_HPUX_SOURCE -DUSE_HSREGEX -DUSE_EXPAT -I$(SRCD
IR)/lib/expat-lite
PerlDispatchHandler.disabled (enable with PERL_DISPATCH=1)
PerlChildInitHandlerenabled
PerlChildExitHandlerenabled
PerlPostReadRequestHandler..disabled (enable with PERL_POST_READ_REQUEST=1)
PerlTransHandlerdisabled (enable with PERL_TRANS=1)
PerlHeaderParserHandler.disabled (enable with PERL_HEADER_PARSER=1)
PerlAccessHandler...disabled (enable with PERL_ACCESS=1)
PerlAuthenHandler...disabled (enable with PERL_AUTHEN=1)
PerlAuthzHandlerdisabled (enable with PERL_AUTHZ=1)
PerlTypeHandler.disabled (enable with PERL_TYPE=1)
PerlFixupHandlerdisabled (enable with PERL_FIXUP=1)

Re: Apache::Session weirdness

2000-06-13 Thread Dave Baker

On Sat, Jun 10, 2000 at 07:30:04AM -0600, Ken Miller wrote:
 The session hash reference is a tied var.  When you follow a reference past 
 the first level, the tied methods don't get invoked.  When you update the 
 top level (as you did with the time()) you cause the tied methods to be 
 invoked, and subsequently, the data is stored.
 
 The last thing I do in my handlers, right before I untie the hash, is to 
 update a timestamp, just as you did.

This one bit me also.  I'm now using this (since I don't need a timestamp)

  tied(%session)-make_modified;


Dave


-- 

-  Dave Baker  :  [EMAIL PROTECTED]  :  http://dsb3.com/  :  AIM#duirwyrd  -
GPG: 1024D/D7BCA55D / 09CD D148 57DE 711E 6708  B772 0DD4 51D5 D7BC A55D


 PGP signature


RE: non-DSO mod_perl, Embperl, and AIX not working

2000-06-13 Thread Greg Estep


When 'make' invokes 'ld' with the following command:

ld -o
blib/arch/auto/HTML/Embperl/Embperl.so  -bhalt:4 -bM:SRE -bI:/usr/local/lib/
perl5/5.6.0/aix/CORE/perl.exp -bE:Embperl.exp -b
noentry -lC -lc -L/usr/local/lib Embperl.o epmain.o epio.o epchar.o epcmd.o
eputil.o epeval.o
epdbg.o -bI:/usr/local/lib/perl5/site_perl/5.6.0/aix/auto/Apache/mod_perl.ex
p

These following errors are produced.

ld: 0711-317 ERROR: Undefined symbol: .ap_palloc
ld: 0711-317 ERROR: Undefined symbol: .ap_rputc
ld: 0711-317 ERROR: Undefined symbol: .ap_rflush
ld: 0711-317 ERROR: Undefined symbol: .ap_rwrite
ld: 0711-317 ERROR: Undefined symbol: .ap_setup_client_block
ld: 0711-317 ERROR: Undefined symbol: .ap_should_client_block
ld: 0711-317 ERROR: Undefined symbol: .ap_get_client_block
ld: 0711-317 ERROR: Undefined symbol: .ap_pstrdup
ld: 0711-317 ERROR: Undefined symbol: .ap_table_set
ld: 0711-317 ERROR: Undefined symbol: .ap_table_add
ld: 0711-317 ERROR: Undefined symbol: .ap_set_content_length
ld: 0711-317 ERROR: Undefined symbol: .ap_send_http_header
ld: 0711-317 ERROR: Undefined symbol: .ap_log_error
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more
information.

When I add '-bnoquiet' to the command, the output looks like (stdout 
stderr combined):

ld): halt 4
(ld): savename blib/arch/auto/HTML/Embperl/Embperl.so
(ld): filelist 10 4
(ld): setopt noprogram
(ld): noentry
NOENTRY: There is no entry point.
(ld): lib /usr/lib/libC.a
(ld): lib /usr/lib/libc.a
(ld): i Embperl.o
(ld): i epmain.o
(ld): i epio.o
(ld): i epchar.o
(ld): i epcmd.o
(ld): i eputil.o
(ld): i epeval.o
(ld): i epdbg.o
INSERT: Shared object libC.a[shr.o]: 403 symbols imported.
INSERT: Shared object libC.a[shr2.o]: 38 symbols imported.
INSERT: Shared object libC.a[shr3.o]: 29 symbols imported.
INSERT: Shared object libC.a[ansi_32.o]: 479 symbols imported.
INSERT: Shared object libc.a[shr.o]: 2172 symbols imported.
INSERT: Shared object libc.a[meth.o]: 2 symbols imported.
INSERT: Shared object libc.a[aio.o]: 11 symbols imported.
INSERT: Shared object libc.a[pse.o]: 78 symbols imported.
INSERT: Shared object libc.a[dl.o]: 4 symbols imported.
INSERT: Shared object libc.a[pty.o]: 1 symbols imported.
FILELIST: Number of previously inserted files processed: 10
(ld): imports /usr/local/lib/perl5/5.6.0/aix/CORE/perl.exp
IMPORTS: Symbols imported from import file
/usr/local/lib/perl5/5.6.0/aix/CORE/perl.exp: 896
(ld): imports
/usr/local/lib/perl5/site_perl/5.6.0/aix/auto/Apache/mod_perl.exp
IMPORTS: Symbols imported from import file
/usr/local/lib/perl5/site_perl/5.6.0/aix/auto/Apache/mod_perl.exp: 5
(ld): exports Embperl.exp
EXPORTS: Symbols exported: 1
(ld): resolve
RESOLVE: 894 of 5647 symbols were kept.
(ld): addgl /usr/lib/glink.o
ADDGL: Glink code added for 116 symbols.
(ld): er full
ld: 0711-318 ERROR: Undefined symbols were found.
The following symbols are in error:
 SymbolInpndx  TY CL Source-File(Object-File) OR
Import-File{Shared-object}
  RLD: Address  Section  Rld-type Referencing
Symbol
 ---
---
ld: 0711-317 ERROR: Undefined symbol: .ap_palloc
 .ap_palloc[224]   ER PR epio.c(epio.o)
   03b4 .textR_RBR[22]
.EMBPERL__realloc
   0508 .textR_RBR[24]
.EMBPERL__malloc
ld: 0711-317 ERROR: Undefined symbol: .ap_rputc
 .ap_rputc [254]   ER PR epio.c(epio.o)
   0e5c .textR_RBR[60]
.EMBPERL_oputc
ld: 0711-317 ERROR: Undefined symbol: .ap_rflush
 .ap_rflush[256]   ER PR epio.c(epio.o)
   0e74 .textR_RBR[60]
.EMBPERL_oputc
   104c .textR_RBR[62]
.EMBPERL_owrite
ld: 0711-317 ERROR: Undefined symbol: .ap_rwrite
 .ap_rwrite[260]   ER PR epio.c(epio.o)
   1030 .textR_RBR[62]
.EMBPERL_owrite
ld: 0711-317 ERROR: Undefined symbol: .ap_setup_client_block
 .ap_setup_client_block[268]   ER PR epio.c(epio.o)
   14c8 .textR_RBR[72]
.EMBPERL_iread
ld: 0711-317 ERROR: Undefined symbol: .ap_should_client_block
 .ap_should_client_block   [270]   ER PR epio.c(epio.o)
   14d4 .textR_RBR[72]
.EMBPERL_iread
ld: 0711-317 ERROR: Undefined symbol: .ap_get_client_block
 .ap_get_client_block  [272]   ER PR epio.c(epio.o)
   14f4 .textR_RBR[72]
.EMBPERL_iread
ld: 0711-317 ERROR: Undefined symbol: .ap_pstrdup
 .ap_pstrdup   [1124]  ER PR epmain.c(epmain.o)
   0a98 .textR_RBR[18]
.EndOutput
   0ab0 .textR_RBR[18]
.EndOutput
   0ac8 .text

Modperl Test Problem and Redhat6.2 Apache::DBI strange thing. Thanks.

2000-06-13 Thread Steven Zhu

Hi All:

Thank you all for taking time to read this message.

I got two things that i really don't understand.

1. I got RedHat6.2. I tried to install modperl. Apache1.3.12 and modperl
1.24.
I installed every prerequired package. Configuration is fine and
compiling is fine
without any errors. But i never got test passed. The error messages:

httpd listening on port 8529
will write error_log to: t/logs/error_log
letting apache warm up...\c
done
/usr/bin/perl t/TEST 0
still waiting for server to warm up...not ok
server failed to start! (please examine t/logs/error_log) at t/TEST line
95.
make: *** [run_tests] Error 9

I check error.log file:

[notice] Destruction-DESTROY called for $global_object
[Tue Jun 13 18:42:39 2000] [warn] [notice] child_init for process 20497,
report
any problems to [no address given]

There is nothing i can do. I am so frustrated because we has another
machine upgrated from
redhat5.2 to 6.1. We installed modperl without any problem. We tested
everything ok.
Please point out. Greate Thanks.

2. Since i can't get my new modperl running. I just use modperl coming
with redhat6.2.
The weired thing is that if i put PerlModule Apache::DBI in httpd.conf,
the web server
can not startup. If i take that out, the server can connect with
database ( because i put
use DBI; in perl script file?). But i can't get persistent connections,
sometimes it can connect
with database (mysql), sometimes it can't connect database with the
following errors
DBD::mysql::st execute failed: MySQL server has gone away at
cnznetmod.pm line 1
59.
DBD::mysql::st fetchrow failed: fetch() without execute() at
cnznetmod.pm line 1
60.
DBD::mysql::db do failed: MySQL server has gone away at cnznetmod.pm
line 151.
DBD::mysql::st execute failed: MySQL server has gone away at
cnznetmod.pm line 1
59.
DBD::mysql::st fetchrow failed: fetch() without execute() at
cnznetmod.pm line 1
60.
DBD::mysql::st execute failed: MySQL server has gone away at
cnznetmod.pm line 1
30.
DBD::mysql::st fetchrow failed: fetch() without execute() at
cnznetmod.pm line 1
31.

But it works in most time.  I can't turn on debug because i can't put
PerlModule Apache::DBI in httpd.conf.

Thank you very much...

Steven.




Re: Apache on Nt

2000-06-13 Thread Martin Morrison

SP5 works fine.

Martin

josephbifano wrote:
 
 Hi,
 
 I have Apache running on a windows NT workstation and need to get
 Mod_perl and HTML::MASON working so I can do development on it.  I can
 not get mod_perl to load.  I have tried several things with no luck.  I
 am using sp5 and one of the docs say to use sp3.  ANyone out there doing
 this now?
 
 Joe



Re: Where do I put my code?

2000-06-13 Thread Ariel Manzur

Is there any way to know if the module is runnung? I put the .pm file
inside /usr/lib/perl5/site_perl/5.005/i386-linux (that's where Apache.pm
is) and then put:

AuthType  Basic
AuthName  "Name of the Authentcation Realm" 
require   valid-user
PerlAuthenHandler AuthAny

on the Location /auth part of the site, but it's not working.. I don't
get errors, and it doesn't accept the authentication (it authenticates
against /etc/shadow, like a normal protection).

Any idea?

Thanks! bye..

Ariel.

At 15:26 13/06/2000 -0400, darren chamberlain wrote:
Ariel Manzur ([EMAIL PROTECTED]) said something to this effect:
 Hi.. this is very helpful.. thanks.. :-)
 
 Now, I have one last question. Where do I put the "pachage Test::AuthAny" 
code?

Make a Perl library directory that you want to store all of your Perl
modules in, for example, /www/lib. In your scripts, stick a line

use lib '/www/lib';

at the beginning to use this directory, and in a Perl section in your
httpd.conf.

Package names reflect filesystem hierarchy -- Test::AuthAny is in a
directory called Test, in a file called AuthAny.pm. Test lives in
any directory that is in the special array @INC (which use lib
modifies by prepending to @INC). An example:

(bash) $ perl -e 'print join "\n",@INC;'
/usr/local/perl/5.6.0/lib/5.6.0/i686-linux
/usr/local/perl/5.6.0/lib/5.6.0
/usr/local/perl/5.6.0/lib/site_perl/5.6.0/i686-linux
/usr/local/perl/5.6.0/lib/site_perl/5.6.0
/usr/local/perl/5.6.0/lib/site_perl
.
(bash) $ perl
use lib '/www/lib';
print join "\n",@INC;
/www/lib
/usr/local/perl/5.6.0/lib/5.6.0/i686-linux
/usr/local/perl/5.6.0/lib/5.6.0
/usr/local/perl/5.6.0/lib/site_perl/5.6.0/i686-linux
/usr/local/perl/5.6.0/lib/site_perl/5.6.0
/usr/local/perl/5.6.0/lib/site_perl
.

Put your code (assuming use lib /www/lib) in /www/lib/Test/AuthAny.pm, make 
sure the
appropriate use lib lines are in your Perl sections in your httpd, and you 
will be
OK.

Try perldoc lib for info on the use lib pragma.

Good luck.

darren

-- 
A theory is not accepted when it's critics are converted, but when they
eventually die.
 -- Maxwell Plank




Re: perl vs java

2000-06-13 Thread Shane Nay

On Tue, 13 Jun 2000, you wrote:
 Now, now...that is unfair. I was referring to writing in pure Perl vs pure 
 Java.

Admittedly it's not completely fair :-).  I admitted that I would do (have
done) it in c.  Given a choice between C and perl that is.  But as you say in
the next paragraph, Perl is clearly a better choice than java on this. 
(Although if you're only supporting JDK1.1x and later, the ability to pass java
objects over HTTP is really cool, and I used it extensively)

 
 Of course, C apis and pre-written daemon integration makes the glue 
 language a moot point (and favors Perl actually).
 
 BTW, is select() is still broken in Win32 Perl? It was 6 months ago (I 
 suspect because IO operates differently on win32) so you'd limit your 
 platform too.

Honestly I don't know much about the Win32 platform.  Until I had to use VMWare
to look at a prototype for a product I was helping out with I hadn't used
Windows in about 2 years. (BTW: Huge plug for VMWare, that's some
REALLY cool software, not just for runing windows on linux, but testing other
OSes... I can't say enough good stuff about vmware)

Thanks,
Shane.




cvs commit: modperl-2.0/src/modules/perl mod_perl.c mod_perl.h modperl_callback.c modperl_config.c modperl_config.h modperl_types.h

2000-06-13 Thread dougm

dougm   00/06/13 14:05:55

  Modified:lib/ModPerl Code.pm
   pod  modperl_dev.pod
   src/modules/perl mod_perl.c mod_perl.h modperl_callback.c
modperl_config.c modperl_config.h modperl_types.h
  Log:
  first cut of PerlOptions directive
  
  Revision  ChangesPath
  1.30  +46 -15modperl-2.0/lib/ModPerl/Code.pm
  
  Index: Code.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- Code.pm   2000/06/12 19:37:25 1.29
  +++ Code.pm   2000/06/13 21:05:35 1.30
  @@ -81,15 +81,17 @@
   $directive_proto{$k}-{ret} = 'const char *';
   }
   
  +#XXX: allow disabling of PerDir hooks on a PerDir basis
  +my @hook_flags = (map { canon_uc($_) } keys %hooks);
   my %flags = (
  -Srv = [qw(NONE PERL_TAINT_CHECK PERL_WARN FRESH_RESTART
  -   PERL_CLONE PERL_ALLOC PERL_OFF UNSET)],
  -Dir = [qw(NONE INCPUSH SENDHDR SENTHDR ENV CLEANUP RCLEANUP)],
  +Srv = [qw(NONE CLONE PARENT ENABLED), @hook_flags, 'UNSET'],
  +Dir = [qw(NONE SEND_HEADER SETUP_ENV UNSET)],
   Interp = [qw(NONE IN_USE PUTBACK CLONED BASE)],
   Handler = [qw(NONE PARSED METHOD OBJECT ANON)],
   );
   
  -my %flags_lookup = map { $_,1 } qw(Srv);
  +my %flags_lookup = map { $_,1 } qw(Srv Dir);
  +my %flags_options = map { $_,1 } qw(Srv);
   
   sub new {
   my $class = shift;
  @@ -201,10 +203,11 @@
   my $i = 0;
   
   for my $h (@$handlers) {
  +my $h_name = join $h, qw(Perl Handler);
   my $name = canon_func('cmd', $h, 'handlers');
   my $cmd_name = canon_define('cmd', $h, 'entry');
   my $protostr = canon_proto($prototype, $name);
  -
  +my $flag = 'MpSrv' . canon_uc($h);
   my $ix = $self-{handler_index}-{$class}-[$i++];
   my $av = "$prototype-{cfg}-{name}-handlers[$ix]";
   
  @@ -215,7 +218,7 @@
   print $h_fh EOF;
   
   #define $cmd_name \\
  -{"Perl${h}Handler", $name, NULL, \\
  +{"$h_name", $name, NULL, \\
$prototype-{scope}, ITERATE, "Subroutine name"}
   
   EOF
  @@ -223,11 +226,16 @@
   $protostr
   {
   $prototype-{cfg}-{get};
  -if (MpSrvPERL_OFF(scfg)) {
  +if (!MpSrvENABLED(scfg)) {
   return ap_pstrcat(parms-pool,
 "Perl is disabled for server ",
 parms-server-server_hostname, NULL);
   }
  +if (!$flag(scfg)) {
  +return ap_pstrcat(parms-pool,
  +  "$h_name is disabled for server ",
  +  parms-server-server_hostname, NULL);
  +}
   MP_TRACE_d(MP_FUNC, "push \@%s, %s\\n", parms-cmd-name, arg);
   return modperl_cmd_push_handlers(($av), arg, parms-pool);
   }
  @@ -243,24 +251,34 @@
   sub generate_flags {
   my($self, $h_fh, $c_fh) = @_;
   
  +my $n = 1;
  +
   while (my($class, $opts) = each %{ $self-{flags} }) {
   my $i = 0;
   my @lookup = ();
   my $lookup_proto = "";
  +my @dumper;
   if ($flags_lookup{$class}) {
   $lookup_proto = join canon_func('flags', 'lookup', $class),
  -  'int ', '(const char *str)';
  +  'U32 ', '(const char *str)';
   push @lookup, "$lookup_proto {";
   }
  +
  +my $flags = join $class, qw(Mp FLAGS);
   
  -print $h_fh "\n#define Mp${class}FLAGS(p) p-flags\n";
  +print $h_fh "\n#define $flags(p) ",
  +  ($flags_options{$class} ? '(p)-flags-opts' : '(p)-flags'), "\n";
  +
   $class = "Mp$class";
  +print $h_fh "\n#define ${class}Type $n\n";
  +$n++;
   
   for my $f (@$opts) {
   my $flag = "${class}_f_$f";
   my $cmd  = $class . $f;
  +my $name = canon_name($f);
  +
   if (@lookup) {
  -my $name = canon_name($f);
   push @lookup, qq(   if (strEQ(str, "$name")) return $flag;);
   }
   
  @@ -268,19 +286,32 @@
   
   /* $f */
   #define $flag $i
  -#define $cmd(p)  ((p)-flags  $flag)
  -#define ${cmd}_On(p)  ((p)-flags |= $flag)
  -#define ${cmd}_Off(p) ((p)-flags = ~$flag)
  +#define $cmd(p)  ($flags(p)  $flag)
  +#define ${cmd}_On(p)  ($flags(p) |= $flag)
  +#define ${cmd}_Off(p) ($flags(p) = ~$flag)
   
   EOF
  +push @dumper,
  +  qq{fprintf(stderr, " $name %s\\n", \\
  + ($flags(p)  $i) ? "On " : "Off");};
  +
   $i += $i || 1;
   }
   if (@lookup) {
  -print $c_fh join "\n", @lookup, "   return -1;\n}\n";
  +print $c_fh join "\n", @lookup, "   return 0;\n}\n";
   print $h_fh "$lookup_proto;\n";
   }
  +
  +shift @dumper; #NONE
  +print $h_fh join ' \\'."\n", 
  +