You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Jens Helweg <he...@gmx.de> on 2007/06/19 13:34:10 UTC
Howto develop with modperl 2 ? (Restart Apache all the time ?)
Hi everyone,
I have just started using modperl 2 on Windows. Apache is 2.2.4. Perl
ist ActiveState Perl 5.8.8.
I have setup my first perl module an included everything into the apache
configuration and up to now everything works fine.
But one thing that I really wonder is: I need to restart apache every
time I make a change to my perl module. Is that the way one would
develop using modperl ? (I don't think so).
Running the perl module on command line neither works because then it
complains about the modperl/apache stuff that isn't available.
How would one professionally develop code using modperl ?
Regards,
Jens
Re: Howto develop with modperl 2 ? (Restart Apache all the time ?)
Posted by Jens Helweg <he...@gmx.de>.
That's what I've tried and how I determined that the reload does not
seem to work.
When I change something in my perl module it still doesn't take effect.
Only when I restart Apache the changes apply.
Now I'd wish to verify that the monitoring of my perl module is really
done by the reload module. Maybe it's possible to log some of the things
the reload module does ?
Lionel MARTIN wrote:
> Yes, easily.
>
> In any of your handler, you make a reference to one test module.
>
> For example, in your response handler:
>
> use myModule();
> use Apache2::Const -compile => qw(OK);
> sub handler {
> myModule::printHello();
> return Apache2::Const::OK;
> }
> 1;
>
> And then: myModule.pm:
>
> sub printHello {
> print 'Hello';
> }
> 1;
>
> Then, you start your server, and test your handler.
> It should print 'Hello';
>
> Then, without restarting your server, you change myModule.pm into:
>
> sub printHello {
> print 'Hi';
> }
> 1;
>
> And you run your page again.
>
> This time, it should print 'Hi', showing that Apache took the update
> into account on the fly, without having to restart anything.
>
> HTH.
>
> Lionel.
>
> ----- Original Message ----- From: "Jens Helweg" <he...@gmx.de>
> To: <mo...@perl.apache.org>
> Sent: Thursday, June 21, 2007 11:12 AM
> Subject: Re: Howto develop with modperl 2 ? (Restart Apache all the time ?)
>
>
>> Thank you. I really missed the second ':'.
>> Now it's not complaining anymore but the reload still doesn't work...
>>
>> Is there a way to verify that the Reload module has been loaded and
>> that is works at all ?
>>
>>
>> Sean Davis wrote:
>>> Jens Helweg wrote:
>>>> Thanks Linonel, Jonathan.
>>>> I have added this to my configuration and now get the error message:
>>>>
>>>> failed to resolve handler `Apache2:Reload':
>>>>
>>>> I haven't had the chance to look at this any closer. I will do this
>>>> tomorrow, though. I don't want to overstrain your help - but do you
>>>> have
>>>> an idea ?
>>>
>>> Is this error cut-and-paste? If so, you have only one ':'.
>>>
>>> Sean
>>>
>>
>>
>
>
Re: Howto develop with modperl 2 ? (Restart Apache all the time ?)
Posted by Lionel MARTIN <ma...@laposte.net>.
Yes, easily.
In any of your handler, you make a reference to one test module.
For example, in your response handler:
use myModule();
use Apache2::Const -compile => qw(OK);
sub handler {
myModule::printHello();
return Apache2::Const::OK;
}
1;
And then: myModule.pm:
sub printHello {
print 'Hello';
}
1;
Then, you start your server, and test your handler.
It should print 'Hello';
Then, without restarting your server, you change myModule.pm into:
sub printHello {
print 'Hi';
}
1;
And you run your page again.
This time, it should print 'Hi', showing that Apache took the update into
account on the fly, without having to restart anything.
HTH.
Lionel.
----- Original Message -----
From: "Jens Helweg" <he...@gmx.de>
To: <mo...@perl.apache.org>
Sent: Thursday, June 21, 2007 11:12 AM
Subject: Re: Howto develop with modperl 2 ? (Restart Apache all the time ?)
> Thank you. I really missed the second ':'.
> Now it's not complaining anymore but the reload still doesn't work...
>
> Is there a way to verify that the Reload module has been loaded and that
> is works at all ?
>
>
> Sean Davis wrote:
>> Jens Helweg wrote:
>>> Thanks Linonel, Jonathan.
>>> I have added this to my configuration and now get the error message:
>>>
>>> failed to resolve handler `Apache2:Reload':
>>>
>>> I haven't had the chance to look at this any closer. I will do this
>>> tomorrow, though. I don't want to overstrain your help - but do you have
>>> an idea ?
>>
>> Is this error cut-and-paste? If so, you have only one ':'.
>>
>> Sean
>>
>
>
Re: Howto develop with modperl 2 ? (Restart Apache all the time ?)
Posted by Jens Helweg <he...@gmx.de>.
Thank you. I really missed the second ':'.
Now it's not complaining anymore but the reload still doesn't work...
Is there a way to verify that the Reload module has been loaded and that
is works at all ?
Sean Davis wrote:
> Jens Helweg wrote:
>> Thanks Linonel, Jonathan.
>> I have added this to my configuration and now get the error message:
>>
>> failed to resolve handler `Apache2:Reload':
>>
>> I haven't had the chance to look at this any closer. I will do this
>> tomorrow, though. I don't want to overstrain your help - but do you have
>> an idea ?
>
> Is this error cut-and-paste? If so, you have only one ':'.
>
> Sean
>
Re: Howto develop with modperl 2 ? (Restart Apache all the time ?)
Posted by Sean Davis <sd...@mail.nih.gov>.
Jens Helweg wrote:
> Thanks Linonel, Jonathan.
> I have added this to my configuration and now get the error message:
>
> failed to resolve handler `Apache2:Reload':
>
> I haven't had the chance to look at this any closer. I will do this
> tomorrow, though. I don't want to overstrain your help - but do you have
> an idea ?
Is this error cut-and-paste? If so, you have only one ':'.
Sean
Re: Howto develop with modperl 2 ? (Restart Apache all the time ?)
Posted by Jens Helweg <he...@gmx.de>.
Thanks Linonel, Jonathan.
I have added this to my configuration and now get the error message:
failed to resolve handler `Apache2:Reload':
I haven't had the chance to look at this any closer. I will do this
tomorrow, though. I don't want to overstrain your help - but do you have
an idea ?
Jens
Jonathan Vanasco wrote:
>
> On Jun 19, 2007, at 10:59 AM, Lionel MARTIN wrote:
>
>> You can put that in your Apache conf file:
>>
>> PerlModule Apache2::Reload
>> PerlInitHandler Apache2::Reload
>>
>> This way, every time you alter one of your Apache modules, it gets
>> reloaded.
>>
>> This incurs a small performance hit (the server has to fstat the
>> related files every time a request is run, to know if any module has
>> been updated on disk), but that's definitely a good choice when
>> developing (no need to restart your server)
>
>
> Just to add:
>
> this can screw up class inheritance
> given
> b isa a
> sub a::one
> sub b::one
> issue:
> if you delete b::one, you'll get an error under
> apache::reload. you'll need to restart the server
>
> also
>
> some modules, like rose::db::object, do some very agressive
> optimizations and setup that have to do with package namesapce, and are
> only run at begin. if you alter their subs/vars/constants, you'll need
> to restart as well.
>
> Apache2::Reload is the way to go.. but there are situations like the
> above to watch out for.
>
> I'm sure there are other situations out there too. those are just the
> ones i deal with daily.
>
>
>
> // Jonathan Vanasco
>
> | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> - - - - - - - - - - - - - - - - - -
> | CEO/Founder SyndiClick Networks
> | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> - - - - - - - - - - - - - - - - - -
> | Founder/CTO/CVO
> | FindMeOn.com - The cure for Multiple Web Personality Disorder
> | Web Identity Management and 3D Social Networking
> | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> - - - - - - - - - - - - - - - - - -
> | RoadSound.com - Tools For Bands, Stuff For Fans
> | Collaborative Online Management And Syndication Tools
> | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> - - - - - - - - - - - - - - - - - -
>
>
>
Re: Howto develop with modperl 2 ? (Restart Apache all the time ?)
Posted by Jonathan Vanasco <jv...@2xlp.com>.
On Jun 19, 2007, at 10:59 AM, Lionel MARTIN wrote:
> You can put that in your Apache conf file:
>
> PerlModule Apache2::Reload
> PerlInitHandler Apache2::Reload
>
> This way, every time you alter one of your Apache modules, it gets
> reloaded.
>
> This incurs a small performance hit (the server has to fstat the
> related files every time a request is run, to know if any module
> has been updated on disk), but that's definitely a good choice when
> developing (no need to restart your server)
Just to add:
this can screw up class inheritance
given
b isa a
sub a::one
sub b::one
issue:
if you delete b::one, you'll get an error under apache::reload.
you'll need to restart the server
also
some modules, like rose::db::object, do some very agressive
optimizations and setup that have to do with package namesapce, and
are only run at begin. if you alter their subs/vars/constants,
you'll need to restart as well.
Apache2::Reload is the way to go.. but there are situations like the
above to watch out for.
I'm sure there are other situations out there too. those are just
the ones i deal with daily.
// Jonathan Vanasco
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
| CEO/Founder SyndiClick Networks
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
| Founder/CTO/CVO
| FindMeOn.com - The cure for Multiple Web Personality Disorder
| Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
| RoadSound.com - Tools For Bands, Stuff For Fans
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
Re: Howto develop with modperl 2 ? (Restart Apache all the time ?)
Posted by Lionel MARTIN <ma...@laposte.net>.
Hi,
You can put that in your Apache conf file:
PerlModule Apache2::Reload
PerlInitHandler Apache2::Reload
This way, every time you alter one of your Apache modules, it gets reloaded.
This incurs a small performance hit (the server has to fstat the related
files every time a request is run, to know if any module has been updated on
disk), but that's definitely a good choice when developing (no need to
restart your server)
Lionel.
----- Original Message -----
From: "Jens Helweg" <he...@gmx.de>
To: <mo...@perl.apache.org>
Sent: Tuesday, June 19, 2007 1:34 PM
Subject: Howto develop with modperl 2 ? (Restart Apache all the time ?)
> Hi everyone,
>
> I have just started using modperl 2 on Windows. Apache is 2.2.4. Perl ist
> ActiveState Perl 5.8.8.
>
> I have setup my first perl module an included everything into the apache
> configuration and up to now everything works fine.
>
> But one thing that I really wonder is: I need to restart apache every time
> I make a change to my perl module. Is that the way one would develop using
> modperl ? (I don't think so).
>
> Running the perl module on command line neither works because then it
> complains about the modperl/apache stuff that isn't available.
>
> How would one professionally develop code using modperl ?
>
> Regards,
> Jens
>
>