Re: moose and mod_perl

[email protected] (Stevan Little)
Newsgroups perl.moose
Message-ID <[email protected]>
Mike,

Honestly, I have no idea what that directive does, I never used it :)

However a little googling shows that it is perhaps a problem for more  
then just you:

http://modperlbook.org/html/4-2-9-PerlFreshRestart.html

And that it is ultimately deprecated in 2.0:

http://modperlbook.org/html/25-1-2-6-PerlFreshRestart.html

I suspect that effort would be better spent moving your old code away  
from using it instead of trying to make Moose support it. I know that  
Moose works with Module::Refresh (there are tests in the suite for it)  
and it did at one point work with Apache::Reload as well (I haven't  
tested it against the latest version as we have moved away from  
mod_perl at work and us mostly FCGI now).

- Stevan

On Dec 16, 2008, at 6:15 AM, Mike Glen wrote:

> Did some more digging into this and it is down to the line
>
> PerlFreshRestart on
>
> in one of the apache config files
> turn it off and i can preload Moose classes no problem
>
> unfortunately this seems to break our old mod_perl code  (running  
> using perl 5.8.8 )
>
>
> [email protected] wrote:
>> I'm preloading with a startup.pl
>> there a few other things in it at the minute from an old mod_perl app
>> when im back in work tomorrow i will trim everything else out so i  
>> am just
>> preloading the Moose stuff and see if that makes a difference
>>
>>
>>> Mike,
>>>
>>> That is very odd, I have had several Moose based apps running under
>>> mod_perl for a while now without issue.
>>>
>>> How exactly are you pre-loading? With a startup.pl?
>>>
>>> - Stevan
>>>
>>>
>>> On Dec 15, 2008, at 11:56 AM, Mike Glen wrote:
>>>
>>>
>>>> Are there any know issues with using moose and mod_perl when you
>>>> preload modules in a startup.pl?
>>>>
>>>> I'm running the latest Moose (downloaded today), mod_perl 1, apache
>>>> 1.3.37 and perl 5.8.8
>>>>
>>>> What seems to be happening is that if i preload any mod_perl  
>>>> scripts
>>>> using Moose objects then they loose their attributes.
>>>>
>>>> for example I have a Moose class
>>>>
>>>> package MINDsweep::TestClass;
>>>>
>>>> use Moose;
>>>> has 'requiredAttRO' => ( is => 'ro', isa => 'Str', required => 1);
>>>> has 'requiredAttRW' => ( is => 'rw', isa => 'Str', required => 1);
>>>>
>>>> 1;
>>>>
>>>> and a mod_perl script
>>>>
>>>> package MINDsweep::Apache::Test;
>>>>
>>>> use Apache::Request();
>>>> use Apache::Constants qw(OK);
>>>> use MINDsweep::TestClass();
>>>>
>>>> use strict;
>>>>
>>>> sub handler {
>>>>  my $r = Apache::Request->new(shift);
>>>>  my $um;
>>>>    my $test = MINDsweep::TestClass->new( requiredAttRO => 'Read
>>>> Only', requiredAttRW => 'Read Write' );
>>>>    print '<pre>' . $test->dump() . '</pre>';
>>>>    return OK;
>>>> }
>>>> 1;
>>>>
>>>> with no preloading I get
>>>>
>>>> $VAR1 = bless( {
>>>>               'requiredAttRO' => 'Read Only',
>>>>               'requiredAttRW' => 'Read Write'
>>>>             }, 'MINDsweep::TestClass' );
>>>>
>>>>
>>>>
>>>> but if I preload stuff
>>>>
>>>> $VAR1 = bless( {}, 'MINDsweep::TestClass' );
>>>>
>>>>
>>>>
>>>> Thanks,
>>>> Mike
>>>>
>>>> --
>>>> MINDsweep
>>>> 25 albany street
>>>> edinburgh - UK - eh1 3qn
>>>>
>>>> m: 07786984428
>>>>
>>>>
>>>> MINDsweep www.mindsweep.net is a division of c2sky services limited
>>>> www.c2sky.net
>>>>
>>>> This e-mail may contain confidential information.  It is intended
>>>> solely
>>>> for the attention of the designated recipient(s).  If you are not  
>>>> the
>>>> intended recipient, you must not make any use of the information
>>>> contained in the e-mail or cause or allow anyone to do so.  Please
>>>> contact the sender immediately and delete the message.
>>>>
>>>>
>>
>>
>
> -- 
> MINDsweep
> 25 albany street
> edinburgh - UK - eh1 3qn
>
> m: 07786984428
>
>
> MINDsweep www.mindsweep.net is a division of c2sky services limited
> www.c2sky.net
>
> This e-mail may contain confidential information.  It is intended  
> solely
> for the attention of the designated recipient(s).  If you are not the
> intended recipient, you must not make any use of the information
> contained in the e-mail or cause or allow anyone to do so.  Please
> contact the sender immediately and delete the message.
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.