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 )
mg...@mindsweep.net 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.