Location, filename, path_info

2006-07-31 Thread Scott Penrose

Hey ho

I have a simple configuration:

PerlModule Test::FH

SetHandler perl-script
PerlResponseHandler Test::FH


Now I go to the URL http://www.myhost.com/xyz/abc/qqq/123

Inside my code I want to get "/ggg/123" so I try

print "Request: " . $r->path_info . "\n";

This returns "/abc/ggg/123"
Now it always drops the top level "/xyz" - assumably because it is  
effectively a file in the root directory.

One way to fix it is to create all the directories, but not too many.

Now what I really want is anything after what ever the location that  
the handler is set in.


I can achieve this with a variable that sets the location, but that  
seemed a little redundant.


Effectively I am creating a "virtual" location.

Is there a way I can configure or get the Location ?

Ta

Scott
--
* - *  http://www.osdc.com.au - Open Source Developers Conference * - *
Scott Penrose
VP in charge of Pancakes
http://linux.dd.com.au/
[EMAIL PROTECTED]

Dismaimer: If you receive this email in error - please eat it  
immediately to prevent it from falling into the wrong hands.


Please do not send me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html

Microsoft is not the answer. It's the question. And the answer is no.




RE: Can't use mysql stored procedures under mod_perl (although they work directly from Perl)

2006-07-31 Thread Frank Maas
> -8<-- Start Bug Report 8<--
> 1. Problem Description:
> 
> I'm trying to use stored procedures in a mysql database from within a perl
> script.
> A simple test script runs fine from a command-line perl interpreter, and
> runs fine
> when invoked via CGI.
> 
> The same script always fails when run under mod_perl, receiving:
> ERROR: 1312 'PROCEDURE ceres_bt.create_inventory_lot can't return a result
> set in the given context'

Has someone replied to this? If so, sorry for this double post. If not: this is 
not a mod_perl bug. It is caused by an imcompatibility between DBD::MySQL 
(production branch) and new features in MySQL, see 
http://forums.mysql.com/read.php?51,63934,63934#msg-63934. As you can see from 
http://www.nntp.perl.org/group/perl.dbi.announce/298, support for resultsets 
from procedures is available through the development version (3.0006_1).

Regards,
Frank




Re: Location, filename, path_info

2006-07-31 Thread Michael Peters


Scott Penrose wrote:
> Hey ho
> 
> I have a simple configuration:
> 
> PerlModule Test::FH
> 
> SetHandler perl-script
> PerlResponseHandler Test::FH
> 
> 
> Now I go to the URL http://www.myhost.com/xyz/abc/qqq/123
> 
> Inside my code I want to get "/ggg/123" so I try
> 
> print "Request: " . $r->path_info . "\n";
> 
> This returns "/abc/ggg/123"
> Now it always drops the top level "/xyz" - assumably because it is
> effectively a file in the root directory.

Are you saying that /xyz does exist in your document root? I've found that
Apache won't work if you mix a virtual directory, real directory and path_info.

This is because PATH_INFO is what ever is left over after url => file name
mapping. If there's no real file, then apache removes the  value, else
it removes the part that is a real file/directory.

If you want a virtual directory, make sure that there are no real directories of
the same name.

-- 
Michael Peters
Developer
Plus Three, LP



Fwd: Install and error Can't locate loadable object for module Apache::Constants

2006-07-31 Thread Davood Firoozian
Hia, I'm installing mod_perl and when i want to use, this message is the answer,[Mon Jul 31 16:31:04 2006] [error] [client 
21.21.21.24] failed to resolve handler `Apache::SOAP': Can't locate loadable object for module Apache::Constants in @INC (@INC contains: /usr/lib/perl5 /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl /usr/local/lib/perl/5.8.7 /usr/local/share/perl/5.8.7 . /etc/apache2) at /usr/lib/perl5/mod_perl.pm line 14\nCompilation failed in require at /usr/lib/perl5/Apache.pm line 6.\nBEGIN failed--compilation aborted at /usr/lib/perl5/Apache.pm line 6.\nCompilation failed in require at /usr/local/share/perl/5.8.8/SOAP/Transport/HTTP.pm line 444.\nCompilation failed in require at (eval 2) line 3.\n
My box is a debian machin I think I have to install mod_perk with EVERYTHING=1 Sowitch ? maybe ? if true how to do it with dpkg ? 




Re: Fwd: Install and error Can't locate loadable object for module Apache::Constants

2006-07-31 Thread Randy Kobes

On Mon, 31 Jul 2006, Davood Firoozian wrote:


Hia,
I'm installing mod_perl and when i want to use, this message is the answer,

[Mon Jul 31 16:31:04 2006] [error] [client 21.21.21.24] failed to resolve
handler `Apache::SOAP': Can't locate loadable object for module
Apache::Constants in @INC (@INC contains: /usr/lib/perl5 /etc/perl
/usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5
/usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8
/usr/local/lib/site_perl /usr/local/lib/perl/5.8.7
/usr/local/share/perl/5.8.7 . /etc/apache2) at /usr/lib/perl5/mod_perl.pm
line 14\nCompilation failed in require at /usr/lib/perl5/Apache.pm line
6.\nBEGIN failed--compilation aborted at /usr/lib/perl5/Apache.pm line
6.\nCompilation failed in require at
/usr/local/share/perl/5.8.8/SOAP/Transport/HTTP.pm line 444.\nCompilation
failed in require at (eval 2) line 3.\n


My box is a debian machin I think I have to install mod_perk with
EVERYTHING=1 Sowitch ? maybe ? if true how to do it with dpkg ?


The presence of /etc/apache2 in @INC suggests you're running
Apache2 - is that the case? If so, you need to install
mod_perl-2, and then use Apache2::SOAP:
   http://search.cpan.org/dist/Apache2-SOAP

--
best regards,
Randy Kobes


How to detect if a module is loaded from the master apache

2006-07-31 Thread Torsten Foertsch
Hi,

I want to distinguish between the 2 cases if a module is loaded from the 
master apache or at runtime from a child apache. Ideads for both mp1.x and 
mp2.x are welcome.

I tried to call ModPerl::Util::current_callback with mp2.0.2 just after 
compilation and a segfault.

Thanks,
Torsten


pgpmwG67dKTo4.pgp
Description: PGP signature


Transforming request to HTTP/1.1

2006-07-31 Thread Radoslaw Zielinski
Hello,

I'm trying to transform a not-really-HTTP request (first line containing
method differs) to HTTP using PerlTransHandler, like this:

  sub Trans::handler {
my ($r) = @_;
my $method = $r->method;
if ($r->method eq 'FOO') {
  $r->server->method_register($method);
  $r->method('POST');
  $r->filename(1);
  $r->uri('/');
  return Apache2::Const::OK;
}
return Apache2::Const::DECLINED;
  }

So, if client sends "FOO blah whatever", I would like it to be changed
to "POST / HTTP/1.1".

But... this doesn't quite work.  $r->protocol for these requests
contains "HTTP/0.9".  The difference is: HTTP headers are neither
printed nor generated ($r->headers_out is empty).

Can I force HTTP/1.1 in PerlTransHandler somehow?
If not, can I force headers to be generated (without doing that manually)?
I've tried Apache2::SubRequest, but succeeded only with segfaults (after
$subreq->run).


My response handler:

  sub Resp::handler {
my ($r) = @_;
warn $r->protocol;
$r->content_type("text/plain");
$r->status(200);
$r->print("foo\nbar\n");
return Apache2::Const::OK;
  }

Configuration:

  SetHandler modperl
  PerlTransHandlerTrans
  PerlResponseHandler Resp


I know I could get it done using filters, but writing them is a pain...

-- 
Radosław Zieliński <[EMAIL PROTECTED]>


pgpTuPtNKuF4u.pgp
Description: PGP signature


RE: Can't use mysql stored procedures under mod_perl (although they work directly from Perl)

2006-07-31 Thread Jonathan H Lundquist
Thanks for your reply; it is the only one so far.  I will give 3.0006_1 a
try, but I'm not hopeful, as I think we probably are dealing with a mod_perl
bug.  I am using 3.0006, but as I stated it has been patched for multiple
result set (procedure) support, and it is calling procedures successfully in
both straight Perl command line use and via fcgid.

-Original Message-
From: Frank Maas [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 31, 2006 5:16 AM
To: [EMAIL PROTECTED]; modperl@perl.apache.org
Subject: RE: Can't use mysql stored procedures under mod_perl (although they
work directly from Perl)

> -8<-- Start Bug Report 8<--
> 1. Problem Description:
> 
> I'm trying to use stored procedures in a mysql database from within a perl
> script.
> A simple test script runs fine from a command-line perl interpreter, and
> runs fine
> when invoked via CGI.
> 
> The same script always fails when run under mod_perl, receiving:
> ERROR: 1312 'PROCEDURE ceres_bt.create_inventory_lot can't return a result
> set in the given context'

Has someone replied to this? If so, sorry for this double post. If not: this
is not a mod_perl bug. It is caused by an imcompatibility between DBD::MySQL
(production branch) and new features in MySQL, see
http://forums.mysql.com/read.php?51,63934,63934#msg-63934. As you can see
from http://www.nntp.perl.org/group/perl.dbi.announce/298, support for
resultsets from procedures is available through the development version
(3.0006_1).

Regards,
Frank



!DSPAM:44cdf48833612134717754!



Re: Fwd: Install and error Can't locate loadable object for module Apache::Constants

2006-07-31 Thread Davood Firoozian
I have mod_perl 2  and Apache::Soap but problem persist I think this is a bug http://www.usenetlinux.com/showthread.php?t=175047My appache version is 
2.0 I'm upgrading to 2.2 ...On 7/31/06, Randy Kobes <[EMAIL PROTECTED]> wrote:
On Mon, 31 Jul 2006, Davood Firoozian wrote:> Hia,> I'm installing mod_perl and when i want to use, this message is the answer,
>> [Mon Jul 31 16:31:04 2006] [error] [client 21.21.21.24] failed to resolve> handler `Apache::SOAP': Can't locate loadable object for module> Apache::Constants in @INC (@INC contains: /usr/lib/perl5 /etc/perl
> /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5> /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8> /usr/local/lib/site_perl /usr/local/lib/perl/5.8.7> /usr/local/share/perl/5.8.7 . /etc/apache2) at /usr/lib/perl5/mod_perl.pm
> line 14\nCompilation failed in require at /usr/lib/perl5/Apache.pm line> 6.\nBEGIN failed--compilation aborted at /usr/lib/perl5/Apache.pm line> 6.\nCompilation failed in require at> /usr/local/share/perl/5.8.8/SOAP/Transport/HTTP.pm line 444.\nCompilation
> failed in require at (eval 2) line 3.\n>>> My box is a debian machin I think I have to install mod_perk with> EVERYTHING=1 Sowitch ? maybe ? if true how to do it with dpkg ?The presence of /etc/apache2 in @INC suggests you're running
Apache2 - is that the case? If so, you need to installmod_perl-2, and then use Apache2::SOAP:http://search.cpan.org/dist/Apache2-SOAP--best regards,
Randy Kobes


Re: Fwd: Install and error Can't locate loadable object for module Apache::Constants

2006-07-31 Thread Michael Peters


Davood Firoozian wrote:
> I have mod_perl 2  and Apache::Soap but problem persist

Do you have Apache::SOAP or Apache2::SOAP? Randy suggested Apache2::SOAP.

-- 
Michael Peters
Developer
Plus Three, LP



Re: Fwd: Install and error Can't locate loadable object for module Apache::Constants

2006-07-31 Thread Frank Wiles
On Mon, 31 Jul 2006 18:45:26 +
"Davood Firoozian" <[EMAIL PROTECTED]> wrote:

> I have mod_perl 2  and Apache::Soap but problem persist I think this
> is a bug
> 
> http://www.usenetlinux.com/showthread.php?t=175047
> 
> My appache version is 2.0 I'm upgrading to 2.2 ...

   As mentioned previously, you need to be using Apache2::SOAP and
   NOT Apache::SOAP.  Apache::SOAP is for Apache 1 only. 

 -
   Frank Wiles <[EMAIL PROTECTED]>
   http://www.wiles.org
 -



Re: Fwd: Install and error Can't locate loadable object for module Apache::Constants

2006-07-31 Thread Randy Kobes

On Mon, 31 Jul 2006, Davood Firoozian wrote:


I have mod_perl 2  and Apache::Soap but problem persist I think this is a
bug

http://www.usenetlinux.com/showthread.php?t=175047

My appache version is 2.0 I'm upgrading to 2.2 ...


The problem reported at the above link results from trying
to use mod_perl-1 with Apache2 - the resolution is to
install mod_perl-2. And then, as others have pointed
out, use Apache2-SOAP.

--
best regards,
Randy


Re: Location, filename, path_info

2006-07-31 Thread Scott Penrose

On 31/07/2006, at 23:15, Michael Peters wrote:
Are you saying that /xyz does exist in your document root? I've  
found that
Apache won't work if you mix a virtual directory, real directory  
and path_info.


This is because PATH_INFO is what ever is left over after url =>  
file name
mapping. If there's no real file, then apache removes the  
 value, else

it removes the part that is a real file/directory.

If you want a virtual directory, make sure that there are no real  
directories of

the same name.


Sounds like I am experiencing this problem. Another way of explaining  
this is using ScriptAlias - if I was using standard CGI I could do  
this...


ScriptAlias /xyz/abc /usr/lib/cgi-bin/test-fm.pl

And now it will work perfectly. It does not matter if directories  
exist or not.


e.g. http://www.myhost.com/xyz/abc/qqq/123

Now has PATH_INFO set to "/qqq/123". You can create in DocumentRoot  
"xyz" and even "xyz/abc" and even "xyz/abc/qqq" and it still sets  
PATH_INFO to "/qqq/123"


However this is not the case using "" which does make sense  
but...


So another way of putting my question is - how do I use a Perl Module  
instead of a ScriptAlias (CGI Script) and get the same results from  
path_info.


Ta

Scott
--
* - *  http://www.osdc.com.au - Open Source Developers Conference * - *
Scott Penrose
VP in charge of Pancakes
http://linux.dd.com.au/
[EMAIL PROTECTED]

Dismaimer: If you receive this email in error - please eat it  
immediately to prevent it from falling into the wrong hands.


Please do not send me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html

Microsoft is not the answer. It's the question. And the answer is no.




how to use mod_perl sections with mod_jk?

2006-07-31 Thread Robert Nicholson
So I'm trying to make a great deal of my httpd.conf dynamic based  
primarily on hostname etc.


I have most of it working but I've found that at least in my case I  
cannot use mod_jk directives in a perl section.


Q. Should I be able to use mod_jk directives in a perl section?


push @JkWorkerProperty, [qw(worker.myWorker.port $workerPort)];


also I often want to do Apache->module() but how
would I do say an Include where the value was set in a perl stanza  
but the Include will be outside the perl stanza. Failing that can I  
"Include" static httpd.conf snippests in a perl section with say  
Apache->include()?


Point is the path varies so I want to include where my variable has  
scope.


urgent help needed

2006-07-31 Thread philge philip
Dear colleague     I am a bioinformatics programmer from India.I need a guidance for configuring mod_perl2.0 in my server.     I have Apache.2.0.5.2 and Perl 5.8.5 installed in Fedora 3 operating system.  I downloaded mod_perl2.0 version and installed it with the following commands:     Perl MakeFfile.PL    MP_AP_PREFIX=/apxs path  Make  Make install     Next I added the lines:     LoadModule perl_module modules/mod_perl.so   PerlModule Apache2     to httpd.conf     when I tried restarting
 the server we got an error like cant locate perl module Apache2.pm module in @INC  Though I corrected this error once and when I tried to load Apache2::Request module in the script I got an error like cant locate perl module Apache2::Request.pm in @INC.     I tried installing the libapreq2-2.07 module to include Apache2::Request module but I am unable to load it.     Please guide me how to load the Apache2.pm module and load Apache2::request module.I  have a doubt whether I have to upgrade our Perl version since we got an error while trying with modperl2 rpm version and whether Fedora3 will support higher versions of perl?Kindly guide me please.Its urgent.Yours Sincerely  Philge Philip 
		Do you Yahoo!? 
Get on board. You're invited to try the new Yahoo! Mail Beta.

Re: urgent help needed

2006-07-31 Thread Robert Nicholson
Google for mod_perl book and read it. I'm sure it has the correct steps to get perl and @INC setup correctly.http://modperlbook.org/html/ch03_09.htmlAfter you've loaded the perl module itself you want to change @INC to include where Apache2is. If you want I think you can put that logic in an  stanzaOn Jul 31, 2006, at 11:54 PM, philge philip wrote:Dear colleague     I am a bioinformatics programmer from India.I need a guidance for configuring mod_perl2.0 in my server.     I have Apache.2.0.5.2 and Perl 5.8.5 installed in Fedora 3 operating system.  I downloaded mod_perl2.0 version and installed it with the following commands:     Perl MakeFfile.PL    MP_AP_PREFIX=/apxs path  Make  Make install     Next I added the lines:     LoadModule perl_module modules/mod_perl.so   PerlModule Apache2     to httpd.conf     when I tried restarting the server we got an error like cant locate perl module Apache2.pm module in @INC  Though I corrected this error once and when I tried to load Apache2::Request module in the script I got an error like cant locate perl module Apache2::Request.pm in @INC.     I tried installing the libapreq2-2.07 module to include Apache2::Request module but I am unable to load it.     Please guide me how to load the Apache2.pm module and load Apache2::request module.I  have a doubt whether I have to upgrade our Perl version since we got an error while trying with modperl2 rpm version and whether Fedora3 will support higher versions of perl?Kindly guide me please.Its urgent.Yours Sincerely  Philge Philip  		Do you Yahoo!? Get on board. You're invited to try the new Yahoo! Mail Beta.

handlers

2006-07-31 Thread Vladimir S. Tikhonjuk
Hi everyone!

I have Authentication handler, which I set like:

  
  PerlAuthenHandler Promtelecom::Authentication
  AuthType Basic
  AuthName "Promtelecom Network"
  Require valid-user
  

Alseo I have 2 simple PerlHandler's: Debitor and DebitorDocuments, which
set like:

PerlModule Promtelecom::Debitor

  SetHandler perl-script
  PerlHandler Promtelecom::Debitor


PerlModule Promtelecom::DebitorDocuments

  SetHandler perl-script
  PerlHandler Promtelecom::DebitorDocuments


When I go to http://localhost/ by my browser, I see working
Authentication Handler. When I go for the first time to
http://localhost/debitor/ or http://localhost/debitor/documents I see
Authentication Handler too.
So, the question is: when I go to http://localhost/debitor/documents
will the Debitor handler called ?
Or will be the next chain: Authentication -> Debitor -> DebitorDocuments
invoked ?


Re: handlers

2006-07-31 Thread Scott Penrose


On 01/08/2006, at 15:30, Vladimir S. Tikhonjuk wrote:


Hi everyone!

I have Authentication handler, which I set like:

  
  PerlAuthenHandler Promtelecom::Authentication
  AuthType Basic
  AuthName "Promtelecom Network"
  Require valid-user
  

Alseo I have 2 simple PerlHandler's: Debitor and DebitorDocuments,  
which

set like:

PerlModule Promtelecom::Debitor

  SetHandler perl-script
  PerlHandler Promtelecom::Debitor


PerlModule Promtelecom::DebitorDocuments

  SetHandler perl-script
  PerlHandler Promtelecom::DebitorDocuments


When I go to http://localhost/ by my browser, I see working
Authentication Handler. When I go for the first time to
http://localhost/debitor/ or http://localhost/debitor/documents I see
Authentication Handler too.
So, the question is: when I go to http://localhost/debitor/documents
will the Debitor handler called ?
Or will be the next chain: Authentication -> Debitor ->  
DebitorDocuments

invoked ?


Only if you reverse the order. e.g.

PerlModule Promtelecom::DebitorDocuments

  SetHandler perl-script
  PerlHandler Promtelecom::DebitorDocuments

PerlModule Promtelecom::Debitor

  SetHandler perl-script
  PerlHandler Promtelecom::Debitor


Apache will often report if you put them in the wrong order at  
startup time.


Basically first one wins - so if the URL is "/debitor/documents/fred"  
and the first Location is "/debitor" - it would win. So you make sure  
that it is always least to most significant.


Scott
--
* - *  http://www.osdc.com.au - Open Source Developers Conference * - *
Scott Penrose
Anthropomorphic Personification Expert
http://search.cpan.org/search?author=SCOTT
[EMAIL PROTECTED]

Dismaimer: While every attempt has been made to make sure that this  
email only contains zeros and ones, there has been no effort made to  
guarantee the quantity or the order.


Please do not send me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html

Microsoft is not the answer. It's the question. And the answer is no.




Re: handlers

2006-07-31 Thread Vladimir S. Tikhonjuk
Scott Penrose пишет:

>
> On 01/08/2006, at 15:30, Vladimir S. Tikhonjuk wrote:
>
>> Hi everyone!
>>
>> I have Authentication handler, which I set like:
>>
>> 
>> PerlAuthenHandler Promtelecom::Authentication
>> AuthType Basic
>> AuthName "Promtelecom Network"
>> Require valid-user
>> 
>>
>> Alseo I have 2 simple PerlHandler's: Debitor and DebitorDocuments, which
>> set like:
>>
>> PerlModule Promtelecom::Debitor
>> 
>> SetHandler perl-script
>> PerlHandler Promtelecom::Debitor
>> 
>>
>> PerlModule Promtelecom::DebitorDocuments
>> 
>> SetHandler perl-script
>> PerlHandler Promtelecom::DebitorDocuments
>> 
>>
>> When I go to http://localhost/ by my browser, I see working
>> Authentication Handler. When I go for the first time to
>> http://localhost/debitor/ or http://localhost/debitor/documents I see
>> Authentication Handler too.
>> So, the question is: when I go to http://localhost/debitor/documents
>> will the Debitor handler called ?
>> Or will be the next chain: Authentication -> Debitor -> DebitorDocuments
>> invoked ?
>
>
> Only if you reverse the order. e.g.
>
> PerlModule Promtelecom::DebitorDocuments
> 
> SetHandler perl-script
> PerlHandler Promtelecom::DebitorDocuments
> 
> PerlModule Promtelecom::Debitor
> 
> SetHandler perl-script
> PerlHandler Promtelecom::Debitor
> 
>
> Apache will often report if you put them in the wrong order at startup
> time.
>
> Basically first one wins - so if the URL is "/debitor/documents/fred"
> and the first Location is "/debitor" - it would win. So you make sure
> that it is always least to most significant.
>
> Scott

So, as I understant, If I want authenticate user before seeing every
page, I have to put


PerlAuthenHandler Promtelecom::Authentication
AuthType Basic
AuthName "Promtelecom Network"
Require valid-user


to be the first one.

Then, If I want DebitorDocuments Handler (
http://localhost/debitor/documents ) invoked without Debitor handler, I
have to put it before DebitorHandler ?
And vise versa: If I want Debitor Handler and then DebitorDocuments
Handler to be invoked when I go to http://localhost/debitor/documents,
the Debitor Handler have to stand before DebitorDocuments Handler in
httpd.conf ?


Re: how to use mod_perl sections with mod_jk?

2006-07-31 Thread Andreas J. Koenig
> On Mon, 31 Jul 2006 23:00:33 -0500, Robert Nicholson <[EMAIL PROTECTED]> 
> said:

  > So I'm trying to make a great deal of my httpd.conf dynamic based
  > primarily on hostname etc.

  > I have most of it working but I've found that at least in my case I
  > cannot use mod_jk directives in a perl section.

  > Q. Should I be able to use mod_jk directives in a perl section?

  > 
  > push @JkWorkerProperty, [qw(worker.myWorker.port $workerPort)];
  > 

  > also I often want to do  with Apache-> module() but how would I do say an Include where the
  > value was set in a perl stanza but the Include will be outside the
  > perl stanza. Failing that can I "Include" static httpd.conf
  > snippests in a perl section with say Apache-> include()?

  > Point is the path varies so I want to include where my variable has
  > scope.

All this works if you use $PerlConfig instead of symbol table
manipulations. $PerlConfig is like an include statement for a string.
Works fine with apache1 but needs recent SVN for apache2.

-- 
andreas


Re: handlers

2006-07-31 Thread Scott Penrose


On 01/08/2006, at 15:50, Vladimir S. Tikhonjuk wrote:



So, as I understant, If I want authenticate user before seeing every
page, I have to put


PerlAuthenHandler Promtelecom::Authentication
AuthType Basic
AuthName "Promtelecom Network"
Require valid-user


to be the first one.

Then, If I want DebitorDocuments Handler (
http://localhost/debitor/documents ) invoked without Debitor  
handler, I

have to put it before DebitorHandler ?
And vise versa: If I want Debitor Handler and then DebitorDocuments
Handler to be invoked when I go to http://localhost/debitor/documents,
the Debitor Handler have to stand before DebitorDocuments Handler in
httpd.conf ?


Only one handler will run - not both. But otherwise yes.

Basically for each section of Apache, one thing wins. Mostly you can  
think of sections as Authentication, Authorization, and Handler  
(there are others of course, especially filters, fixup handlers and  
more - but the first three are the most common).


So if you have:


Auth...

Handler Debitor::Documents

Handler Debitor

Then the Auth handler will not be effected by the other entries  
because they are not changing that slot - the Auth Slot.
But you are changing the Handler slot - and then the order is  
important - but only one will run.


So if you did it in the order you had in your original mail - the  
Debitor::Document handler would never get run.


Hope that kind of makes sense.

Scott
--
* - *  http://www.osdc.com.au - Open Source Developers Conference * - *
Scott Penrose
Welcome to the Digital Dimension
http://www.dd.com.au/
[EMAIL PROTECTED]

Dismaimer: Contents of this mail and signature are bound to change  
randomly. Whilst every attempt has been made to control said  
randomness, the author wishes to remain blameless for the number of  
eggs that damn chicken laid. Oh and I don't want to hear about  
butterflies either.


Please do not send me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html

Microsoft is not the answer. It's the question. And the answer is no.




Re: handlers

2006-07-31 Thread Vladimir S. Tikhonjuk
Scott Penrose пишет:

>
> On 01/08/2006, at 15:50, Vladimir S. Tikhonjuk wrote:
>
>>
>> So, as I understant, If I want authenticate user before seeing every
>> page, I have to put
>>
>> 
>> PerlAuthenHandler Promtelecom::Authentication
>> AuthType Basic
>> AuthName "Promtelecom Network"
>> Require valid-user
>> 
>>
>> to be the first one.
>>
>> Then, If I want DebitorDocuments Handler (
>> http://localhost/debitor/documents ) invoked without Debitor handler, I
>> have to put it before DebitorHandler ?
>> And vise versa: If I want Debitor Handler and then DebitorDocuments
>> Handler to be invoked when I go to http://localhost/debitor/documents,
>> the Debitor Handler have to stand before DebitorDocuments Handler in
>> httpd.conf ?
>
>
> Only one handler will run - not both. But otherwise yes.
>
> Basically for each section of Apache, one thing wins. Mostly you can
> think of sections as Authentication, Authorization, and Handler (there
> are others of course, especially filters, fixup handlers and more -
> but the first three are the most common).
>
> So if you have:
>
> 
> Auth...
> 
> Handler Debitor::Documents
> 
> Handler Debitor
>
> Then the Auth handler will not be effected by the other entries
> because they are not changing that slot - the Auth Slot.
> But you are changing the Handler slot - and then the order is
> important - but only one will run.
>
> So if you did it in the order you had in your original mail - the
> Debitor::Document handler would never get run.
>
> Hope that kind of makes sense.
>
> Scott

O.K. Thanks for answer :)
I want to write rather big project. How I have to construct it: I mean,
should I make a lot of handlers, like, /debitor, /debitor/documents,
/debitor/documents/contracts  Or, create *.pl scripts. Or may be
there is another theory ?



Re: handlers

2006-07-31 Thread John ORourke

Vladimir S. Tikhonjuk wrote:



O.K. Thanks for answer :)
I want to write rather big project. How I have to construct it: I mean,
should I make a lot of handlers, like, /debitor, /debitor/documents,
/debitor/documents/contracts  Or, create *.pl scripts. Or may be
there is another theory ?
 



Personally I use a more flexible approach - I don't want to have to put 
the whole website structure inside httpd.conf, because every change 
requires a re-start.  Also, you will probably have common startup and 
exit code in each handler.


So you could try something like this:


   
   PerlResponseHandler My::Module


then

sub handler {
   # common startup code - check database connection is up, check 
config has been read, etc

   # check URI
   if uri is for static files
  return DECLINED
   else
  call the code for that URI
   # common exit code - clean up etc
}

You could even do something really clever and make it map URI onto 
module - eg. so /debitor/contract/create calls 
Debitor::Contract->create(), but that wouldn't be very secure!


John