RE: Apache Subprocess

2007-06-28 Thread khan.sajid

 
Hi Scott,

The program itself is not invoked, I tried with some other as you
mentioned but no luck, In short Apache SubProcess is not working for me,
Even the example that's mentioned in the website, May be I am missing
something very basic, Any help??

Thanks,


-Original Message-
From: Scott Gifford [mailto:[EMAIL PROTECTED] 
Sent: Saturday, June 23, 2007 9:43 AM
To: Sajid Khan (WT01 - Computing, Storage & Software Products)
Cc: modperl@perl.apache.org
Subject: Re: Apache Subprocess

<[EMAIL PROTECTED]> writes:

> Hi Scott,
>
> I do not see anything in error log, The print line before and after 
> the command also works fine,The webserver has permission to run the 
> command since I can execute the same command using backtick like 
> `/tmp/in_out_err.pl`

Huh, that is very odd.  Are you sure the program is not getting executed
at all?  Is it possible it's just not getting its input or sending its
output because of buffering?  What if instead of that program you run
something like "/bin/echo Test"?

> Do we need to configure anything so that apache can start executing 
> the Apache::SubProcess package ?

Well, you will need to say "use Apache::SubProcess", but I assume you
would get a compile-time error if you didn't do that.

-Scott.


The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.
 
www.wipro.com


Where is Perl compilation output when using modperl ?

2007-06-28 Thread Jens Helweg

Hi erveryone,

I am using modperl2 with apache2 on win32 (activestate Perl 5.8). I have 
my own perl module included in the apache conf.


Whenever I have an error in my module apache does not start and the only 
error message I can find is in apache's error.log:


Can't load Perl file: D:/path_to_my_perl_module for server myserver, 
exiting...


It doesn't say anything about what is wrong in the code.

Is there a way to get the compilers output from perl, so I can get 
details on what is wrong in the code ?


(when I run perl -c mymodule.pm on command line it complains about 
missing modules - so that doesn't seem to be an option when using modperl.)


Thanks in advance,
Jens



PerlAuthenHandler PerlAuthzHandler in mod_perl 2.0

2007-06-28 Thread Martijn

Hello.

I'm doing some testing/debugging on a newly built server (Apache
2.0.52, mod_perl 2.0.3) and find that both PerlAuthenHandler and
PerlAuthzHandler are ignored. The weird thing is: other Perl*Handlers,
including PerlAccessHandler, work as expected (expected by me, that
is): they block access to mydomain.com/test in the setup copied below
and write a line in error_log.

I am afraid I am making a stupid mistake somewhere, but I can't find
where. Any help would be greatly appreciated.

Thanks.

Martijn.

---

In httpd.conf:

PerlModule Testhandler


# PerlAccessHandler TestHandler
# the above line *does* block access
PerlAuthenHandler TestHandler
PerlAuthzHandler TestHandler
# same problem if only one of the two lines occurs


---

Testhandler.pm:

package TestHandler;
use strict;

use Apache2::Log;
use Apache2::Const qw(:common :remotehost OK FORBIDDEN);
use Apache2::RequestRec ();

sub handler  {
   my ($r) = shift;
   my $url = $r->uri;
   $r->log_error('You are visiting ' . $url . '!');
   return FORBIDDEN;
# DECLINED instead of FORBIDDEN doesn't work either
}

1;


Re: PerlAuthenHandler PerlAuthzHandler in mod_perl 2.0

2007-06-28 Thread Geoffrey Young


Martijn wrote:
> Hello.
> 
> I'm doing some testing/debugging on a newly built server (Apache
> 2.0.52, mod_perl 2.0.3) and find that both PerlAuthenHandler and
> PerlAuthzHandler are ignored. 
> 
> 
> # PerlAccessHandler TestHandler
> # the above line *does* block access
> PerlAuthenHandler TestHandler
> PerlAuthzHandler TestHandler
> # same problem if only one of the two lines occurs
> 

you need a Require directive for apache's auth* hooks to run.  see the
introduction to chapter 13 of the mod_perl cookbook here

  http://www.modperlcookbook.org/chapters/ch13.pdf

and the rest of the chapter as well, if you're interested.  the concepts
are the same between httpd 1.3 and 2.0, though the code will require a
bit of modification for mod_perl 2.0.

HTH

--Geoff


Re: PerlAuthenHandler PerlAuthzHandler in mod_perl 2.0

2007-06-28 Thread John ORourke

Hi Martijn,

http://perl.apache.org/docs/2.0/user/handlers/http.html is your friend...

Authen is only called if there is a 'require' and AuthType/AuthName 
directive,

Authz is only called if Authen is successful.

cheers
John

Martijn wrote:

Hello.

I'm doing some testing/debugging on a newly built server (Apache
2.0.52, mod_perl 2.0.3) and find that both PerlAuthenHandler and
PerlAuthzHandler are ignored. The weird thing is: other Perl*Handlers,
including PerlAccessHandler, work as expected (expected by me, that
is): they block access to mydomain.com/test in the setup copied below
and write a line in error_log.

I am afraid I am making a stupid mistake somewhere, but I can't find
where. Any help would be greatly appreciated.




Re: PerlAuthenHandler PerlAuthzHandler in mod_perl 2.0

2007-06-28 Thread Geoffrey Young

for the record

> Authen is only called if there is a 'require' 

that's true

> and AuthType/AuthName
> directive,

but that is not :)  you might run into trouble if you don't define those
directives, but their absence won't prevent the auth phases from running.

--Geoff


Re: Where is Perl compilation output when using modperl ?

2007-06-28 Thread Randy Kobes

On Thu, 28 Jun 2007, Jens Helweg wrote:


Hi erveryone,

I am using modperl2 with apache2 on win32 (activestate Perl 5.8). I have my 
own perl module included in the apache conf.


Whenever I have an error in my module apache does not start and the only 
error message I can find is in apache's error.log:


Can't load Perl file: D:/path_to_my_perl_module for server myserver, 
exiting...


It doesn't say anything about what is wrong in the code.

Is there a way to get the compilers output from perl, so I can get details on 
what is wrong in the code ?


(when I run perl -c mymodule.pm on command line it complains about missing 
modules - so that doesn't seem to be an option when using modperl.)


Thanks in advance,
Jens


One could use eval to require the module, and if there's a
problem, print $@ to the error log. But probably the most
efficient way is to first fix any errors from
"perl -c  mymodule.pm".

--
best regards,
Randy Kobes


Re: PerlAuthenHandler PerlAuthzHandler in mod_perl 2.0

2007-06-28 Thread John ORourke

Geoffrey Young wrote:



and AuthType/AuthName
directive,



but that is not :)  you might run into trouble if you don't define those
directives, but their absence won't prevent the auth phases from running.
  


Interesting and useful!  In that case we need a doc patch - see 
http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlAuthenHandler


"The check_user_id (authen) phase is called whenever the requested file 
or directory is password protected. This, in turn, requires that the 
directory be associated with AuthName, AuthType and at least one require 
directive."


cheers
John



Re: Where is Perl compilation output when using modperl ?

2007-06-28 Thread Jens Helweg

Randy Kobes schrieb:

On Thu, 28 Jun 2007, Jens Helweg wrote:


Hi erveryone,

I am using modperl2 with apache2 on win32 (activestate Perl 5.8). I 
have my own perl module included in the apache conf.


Whenever I have an error in my module apache does not start and the 
only error message I can find is in apache's error.log:


Can't load Perl file: D:/path_to_my_perl_module for server myserver, 
exiting...


It doesn't say anything about what is wrong in the code.

Is there a way to get the compilers output from perl, so I can get 
details on what is wrong in the code ?


(when I run perl -c mymodule.pm on command line it complains about 
missing modules - so that doesn't seem to be an option when using 
modperl.)


Thanks in advance,
Jens


One could use eval to require the module, and if there's a
problem, print $@ to the error log. But probably the most
efficient way is to first fix any errors from
"perl -c  mymodule.pm".



I thought perl -c mymodule.pm is no option when developing modperl 
handler modules because these will only run/build in the apache modperl 
environment and not on command line ?


How do the modperl pros find an error in modperl modules when all apache 
tells is that it can't load the module instead of priting the complete 
error that the perl compiler/parser has with the code.


When I run a perl script from command line, perl will give some details 
on what is wrong with my code. This information must be somewhere when 
apache/modperl starts and compiles my module ? Mabye there is some sort 
of switch to turn it on ?

Sorry I'm new to this whole modperl thing...

Thanks for you response !
Jens



Re: Where is Perl compilation output when using modperl ?

2007-06-28 Thread Michael Peters
Jens Helweg wrote:

> How do the modperl pros find an error in modperl modules when all apache
> tells is that it can't load the module instead of priting the complete
> error that the perl compiler/parser has with the code.

I'm not sure why the error message is getting buried for you, but I get errors
like that to my error log all the time. So it's not something that's always a
problem. In fact, I think it's always worked right for me. Don't know if this is
encouraging or not :)

-- 
Michael Peters
Developer
Plus Three, LP



Re: Where is Perl compilation output when using modperl ?

2007-06-28 Thread John ORourke

Jens Helweg wrote:
I thought perl -c mymodule.pm is no option when developing modperl 
handler modules because these will only run/build in the apache 
modperl environment and not on command line ?
Not sure about your windows environment but a command-line perl -c works 
just fine for me on modules which use Apache2::*


Make sure you have 'use strict; use warnings;' in your code, that will 
help you write good code.


cheers
John



Re: newbie questions

2007-06-28 Thread pubert na

I made a little progress on my own, but I'm still stuck.

If I do an $r->assbackwards(1); before I send the header, the first time the
page loads, everything is perfect.  If I reload, some of the frames get
shifted around, or the entire page reloads inside a single frame.  Keep in
mind that without mod_perl I don't have this problem.

Here's a link to an unresolved thread which raises the same issue.
http://mail-archives.apache.org/mod_mbox/perl-modperl/25.mbox/[EMAIL 
PROTECTED]


Here's my setup:



 PerlSendHeader off
 SetHandler perl-script
 PerlResponseHandler ModPerl::Registry
 PerlOptions -ParseHeaders
 Options +ExecCGI
 PerlOptions -SetupEnv


Thanks in advance.


Re: PerlAuthenHandler PerlAuthzHandler in mod_perl 2.0

2007-06-28 Thread Martijn

http://perl.apache.org/docs/2.0/user/handlers/http.html is your friend...

Authen is only called if there is a 'require' and AuthType/AuthName
directive,
Authz is only called if Authen is successful.


Thanks to you both, this does help a lot. In this particular case, I
was only interested in the fact whether these phases were run. Since
PerlAccessHandler and PerlFixupHandler both run, they must run too (I
was suspicious the order of the Apache request cycle or the names of
the mod_perl directives might have changed in 2.0 or something...).

But reading this does help me a great deal understanding mod_perl in
general. And yes, I too wonder why I had never done it in the past. :)

Martijn


Re: newbie questions

2007-06-28 Thread Dondi Stroma
Try using PerlResponseHandler ModPerl::PerlRun, or ModPerl::PerlRunPrefork 
(if you use the preforking Apache MPM) and see what happens. You might have 
to install it first if it wasn't already installed.




- Original Message - 
From: pubert na

To: modperl@perl.apache.org
Sent: Thursday, June 28, 2007 1:48 PM
Subject: Re: newbie questions


I made a little progress on my own, but I'm still stuck.

If I do an $r->assbackwards(1); before I send the header, the first time the 
page loads, everything is perfect.  If I reload, some of the frames get 
shifted around, or the entire page reloads inside a single frame.  Keep in 
mind that without mod_perl I don't have this problem.


Here's a link to an unresolved thread which raises the same issue.
http://mail-archives.apache.org/mod_mbox/perl-modperl/25.mbox/[EMAIL 
PROTECTED]


Here's my setup:



 PerlSendHeader off
 SetHandler perl-script
 PerlResponseHandler ModPerl::Registry
 PerlOptions -ParseHeaders
 Options +ExecCGI
 PerlOptions -SetupEnv


Thanks in advance. 



Re: newbie questions

2007-06-28 Thread Perrin Harkins

On 6/27/07, pubert na <[EMAIL PROTECTED]> wrote:

  print $cgi->header(
 -cookie  => values
%{VirtualPlant::Util::getCookies()}
 );


You need to send your cookie header with err_headers_out().  See
http://perl.apache.org/docs/2.0/user/coding/cooking.html#Sending_Cookies_in_REDIRECT_Response__ModPerl__Registry_

- Perrin


Re: newbie questions

2007-06-28 Thread Perrin Harkins

[ Please keep it on the list ]

On 6/28/07, pubert na <[EMAIL PROTECTED]> wrote:

No luck with that suggestion either. Printing the header with
$r->send_http_header;  seems to result in the exact same issue.


I can't tell what you tried from this description.  Can you show some code?


I commented
out the cookie part to simplify things.


Wasn't the cookie part the only thing that was giving you trouble?


It seems as though mod_perl is
caching something which affects the urls.  Are there any known issues with
HTML::Template?


No.  It's possible you have a scoping problem with a variable that you
use to store the results from HTML::Template.

- Perrin


Re: Where is Perl compilation output when using modperl ?

2007-06-28 Thread Alvar Freude

Hi,

-- Jens Helweg <[EMAIL PROTECTED]> wrote:


Is there a way to get the compilers output from perl, so I can get
details on what is wrong in the code ?


usually you get the errors in the apache's error log. I don't know where 
it is stored on Windows, you may look in your httpd.conf.



Ciao
 Alvar

--
** Alvar C.H. Freude, http://alvar.a-blast.org/
** http://www.assoziations-blaster.de/
** http://www.wen-waehlen.de/
** http://odem.org/


pgpOXI2jZKTdI.pgp
Description: PGP signature


Re: Where is Perl compilation output when using modperl ?

2007-06-28 Thread William A. Rowe, Jr.
Alvar Freude wrote:
> Hi,
> 
> -- Jens Helweg <[EMAIL PROTECTED]> wrote:
> 
>> Is there a way to get the compilers output from perl, so I can get
>> details on what is wrong in the code ?
> 
> usually you get the errors in the apache's error log. I don't know where
> it is stored on Windows, you may look in your httpd.conf.

Starts out recorded in the Application Event Log as 'Apache' events, until
we have an error log open and usable.

Starting bin\httpd.exe from the command line is sometimes more educational
than launching the Apache service.  At least errors have a console to land
in and inform you what's going on.