RE: Loading Win32::OLE in a modperl package

2007-06-11 Thread Jan Dubois
On Sun, 10 Jun 2007, Foo JH wrote:
> Thanks for the clarification. In other words: avoid Win32::OLE in
> modperl?

That would be my advice.  But note that I'm not really knowledgeable
about all the different ways you can configure mod_perl.  Maybe there
is a configuration in which it is safe to use Win32::OLE.

Cheers,
-Jan 

>
> Jan Dubois wrote:
>> On Fri, 08 Jun 2007, Foo JH wrote:
>>
>>> I wonder if I am alone in experiencing this. Simply put: putting
>>> 'use Win32::OLE' in my modperl package will cause the Apache to
>>> fault. It basically can't start at all. A window will pop up
>>> complaining about 'Apache HTTP Server has encountered a problem and
>>> needs to close'. No entry into the error log.
>>>
>>> Does anyone know if this can be worked around?
>>>
>>
>> Using Win32::OLE in a multi-threaded way is generally not safe. It is
>> definitely not working correctly if you use the threads.pm module or
>> fork() emulation.
>>
>> It could potentially work in a multi-threaded environment if each
>> interpreter is created independently (not using perl_clone()). When
>> using the COM apartment threading model then each interpreter also
>> needs to be bound to a specific thread, as it is then invalid to
>> invoke methods on a COM object from any other thread than the one
>> that created it.
>>
>> Cheers,
>> -Jan




Re: Loading Win32::OLE in a modperl package

2007-06-10 Thread Foo JH

Thanks for the clarification. In other words: avoid Win32::OLE in modperl?


Jan Dubois wrote:

On Fri, 08 Jun 2007, Foo JH wrote:
  

I wonder if I am alone in experiencing this. Simply put: putting 'use
Win32::OLE' in my modperl package will cause the Apache to fault. It
basically can't start at all. A window will pop up complaining about
'Apache HTTP Server has encountered a problem and needs to close'. No
entry into the error log.

Does anyone know if this can be worked around?



Using Win32::OLE in a multi-threaded way is generally not safe.  It is
definitely not working correctly if you use the threads.pm module or
fork() emulation.

It could potentially work in a multi-threaded environment if each
interpreter is created independently (not using perl_clone()).  When
using the COM apartment threading model then each interpreter also
needs to be bound to a specific thread, as it is then invalid to
invoke methods on a COM object from any other thread than the one
that created it.

Cheers,
-Jan 



  




RE: Loading Win32::OLE in a modperl package

2007-06-08 Thread Jan Dubois
On Fri, 08 Jun 2007, Foo JH wrote:
> I wonder if I am alone in experiencing this. Simply put: putting 'use
> Win32::OLE' in my modperl package will cause the Apache to fault. It
> basically can't start at all. A window will pop up complaining about
> 'Apache HTTP Server has encountered a problem and needs to close'. No
> entry into the error log.
>
> Does anyone know if this can be worked around?

Using Win32::OLE in a multi-threaded way is generally not safe.  It is
definitely not working correctly if you use the threads.pm module or
fork() emulation.

It could potentially work in a multi-threaded environment if each
interpreter is created independently (not using perl_clone()).  When
using the COM apartment threading model then each interpreter also
needs to be bound to a specific thread, as it is then invalid to
invoke methods on a COM object from any other thread than the one
that created it.

Cheers,
-Jan 




Re: Loading Win32::OLE in a modperl package

2007-06-08 Thread Foo JH

Hey Lionel,

Will try, and let you guys know...but I am officially 18 minutes from 
hitting the weekends...:)


Lionel MARTIN wrote:

Hi again,

Did you try finally try out with Apache 2.0?

If this works with Apache 2.0, but not with Apache 2.2, then, it would 
perhaps be useful to point this out.


Lionel.

- Original Message - From: "Foo JH" <[EMAIL PROTECTED]>
To: "Lionel MARTIN" <[EMAIL PROTECTED]>
Sent: Friday, June 08, 2007 11:21 AM
Subject: Re: Loading Win32::OLE in a modperl package



Thanks Lionel.

Damn. I was hoping I won't need to 'regress' into Apache 2.0. But 
thanks a lot for suggesting a way out for me.


Lionel MARTIN wrote:

Hi again,

I tried our code, using as well this directive in my httpd.conf file:

PerlResponseHandler MyPackage

To make your handler work as the main Response Handler.

Moreover I had to alter your code to make it work, adding a:

use Apache2::RequestRec;

because otherwise, the content_type method is not defined.

And it worked perfectly (returning 'hello';)









Re: Loading Win32::OLE in a modperl package

2007-06-08 Thread Lionel MARTIN

Hi again,

Did you try finally try out with Apache 2.0?

If this works with Apache 2.0, but not with Apache 2.2, then, it would 
perhaps be useful to point this out.


Lionel.

- Original Message - 
From: "Foo JH" <[EMAIL PROTECTED]>

To: "Lionel MARTIN" <[EMAIL PROTECTED]>
Sent: Friday, June 08, 2007 11:21 AM
Subject: Re: Loading Win32::OLE in a modperl package



Thanks Lionel.

Damn. I was hoping I won't need to 'regress' into Apache 2.0. But thanks a 
lot for suggesting a way out for me.


Lionel MARTIN wrote:

Hi again,

I tried our code, using as well this directive in my httpd.conf file:

PerlResponseHandler MyPackage

To make your handler work as the main Response Handler.

Moreover I had to alter your code to make it work, adding a:

use Apache2::RequestRec;

because otherwise, the content_type method is not defined.

And it worked perfectly (returning 'hello';)







Re: Loading Win32::OLE in a modperl package

2007-06-08 Thread Lionel MARTIN

Hi again,

I tried our code, using as well this directive in my httpd.conf file:

PerlResponseHandler MyPackage

To make your handler work as the main Response Handler.

Moreover I had to alter your code to make it work, adding a:

use Apache2::RequestRec;

because otherwise, the content_type method is not defined.

And it worked perfectly (returning 'hello';)

#**
package MyPackage;
use strict;
use warnings;
use Win32::OLE;
use Apache2::RequestRec;

sub handler
{
   my $r = shift;
  
   $r->content_type('text/plain');

   print 'hello';
  
   return Apache2::Const::OK;

}

1;
#**

For your information, I am using:
Apache/2.0.59 (Win32) mod_perl/2.0.3 Perl/v5.8.8

perl and MP are ActiveState builds.
And I downloaded the Win32 binary from the Apache httpd website.

Lionel.




- Original Message - 
From: "Foo JH" <[EMAIL PROTECTED]>

To: "Lionel MARTIN" <[EMAIL PROTECTED]>
Cc: "mod_perl" 
Sent: Friday, June 08, 2007 10:43 AM
Subject: Re: Loading Win32::OLE in a modperl package



Thanks Lionel,

I'm running Apache2.2 + Perl5.88.

Try this piece of code:

package MyPackage;
use strict;
use warnings;
use Win32::OLE;

sub handler
{
   my $r = shift;
  
   $r->content_type('text/plain');

   print 'hello';
  
   return Apache2::Const::OK;

}

1;

Lionel MARTIN wrote:

Basically,

Doing, in test.pl, run by ModPel::Registry, something like:

use Win32::OLE;
print 'Hello';

Works prefectly...

Which versions (Apache, MP and Perl) are you running?


- Original Message ----- From: "Foo JH" <[EMAIL PROTECTED]>
To: "mod_perl" 
Sent: Friday, June 08, 2007 10:29 AM
Subject: Loading Win32::OLE in a modperl package



Hi all,

I wonder if I am alone in experiencing this. Simply put: putting 'use 
Win32::OLE' in my modperl package will cause the Apache to fault. It 
basically can't start at all.
A window will pop up complaining about 'Apache HTTP Server has 
encountered a problem and needs to close'. No entry into the error log.


Does anyone know if this can be worked around?







Re: Loading Win32::OLE in a modperl package

2007-06-08 Thread Foo JH

Thanks Lionel,

I'm running Apache2.2 + Perl5.88.

Try this piece of code:

package MyPackage;
use strict;
use warnings;
use Win32::OLE;

sub handler
{
   my $r = shift;
  
   $r->content_type('text/plain');

   print 'hello';
  
   return Apache2::Const::OK;

}

1;

Lionel MARTIN wrote:

Basically,

Doing, in test.pl, run by ModPel::Registry, something like:

use Win32::OLE;
print 'Hello';

Works prefectly...

Which versions (Apache, MP and Perl) are you running?


- Original Message - From: "Foo JH" <[EMAIL PROTECTED]>
To: "mod_perl" 
Sent: Friday, June 08, 2007 10:29 AM
Subject: Loading Win32::OLE in a modperl package



Hi all,

I wonder if I am alone in experiencing this. Simply put: putting 'use 
Win32::OLE' in my modperl package will cause the Apache to fault. It 
basically can't start at all.
A window will pop up complaining about 'Apache HTTP Server has 
encountered a problem and needs to close'. No entry into the error log.


Does anyone know if this can be worked around?






Re: Loading Win32::OLE in a modperl package

2007-06-08 Thread Lionel MARTIN

Basically,

Doing, in test.pl, run by ModPel::Registry, something like:

use Win32::OLE;
print 'Hello';

Works prefectly...

Which versions (Apache, MP and Perl) are you running?


- Original Message - 
From: "Foo JH" <[EMAIL PROTECTED]>

To: "mod_perl" 
Sent: Friday, June 08, 2007 10:29 AM
Subject: Loading Win32::OLE in a modperl package



Hi all,

I wonder if I am alone in experiencing this. Simply put: putting 'use 
Win32::OLE' in my modperl package will cause the Apache to fault. It 
basically can't start at all.
A window will pop up complaining about 'Apache HTTP Server has 
encountered a problem and needs to close'. No entry into the error log.


Does anyone know if this can be worked around?




Loading Win32::OLE in a modperl package

2007-06-08 Thread Foo JH

Hi all,

I wonder if I am alone in experiencing this. Simply put: putting 'use 
Win32::OLE' in my modperl package will cause the Apache to fault. It 
basically can't start at all.
A window will pop up complaining about 'Apache HTTP Server has 
encountered a problem and needs to close'. No entry into the error log.


Does anyone know if this can be worked around?