You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by "Philip M. Gollucci" <pg...@p6m7g8.com> on 2005/08/21 11:14:02 UTC
[PATCH] Apache2::Reload
Hi,
Given:
PerlModule Apache2::Reload
PerlInitHandler Apache2::Reload
PerlSetVar ReloadDebug On
This list can get big, making it hard to find the module. This patch sorts it alphabetically.
Index: Reload.pm
===================================================================
--- Reload.pm (revision 234167)
+++ Reload.pm (working copy)
@@ -131,7 +131,9 @@
my $ReloadDirs = ref($o) && $o->dir_config("ReloadDirectories");
my @watch_dirs = split(/\s+/, $ReloadDirs||'');
- while (my($key, $file) = each %Apache2::Reload::INCS) {
+ foreach my $key (sort { $a cmp $b } keys %Apache2::Reload::INCS) {
+ my $file = $Apache2::Reload::INCS{$key};
+
next unless defined $file;
next if @watch_dirs && !grep { $file =~ /^$_/ } @watch_dirs;
warn "Apache2::Reload: Checking mtime of $key\n" if $DEBUG;
END
------------------------------------------------------------
What doesn't kill us can only make us stronger.
Nothing is impossible.
Philip M. Gollucci (pgollucci@p6m7g8.com) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
http://www.liquidityservicesinc.com
http://www.liquidation.com
http://www.uksurplus.com
http://www.govliquidation.com
http://www.gowholesale.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [PATCH] Apache2::Reload
Posted by "Philippe M. Chiasson" <go...@ectoplasm.org>.
Stas Bekman wrote:
> Philippe M. Chiasson wrote:
>> Geoffrey Young wrote:
>>
>>>> - while (my($key, $file) = each %Apache2::Reload::INCS) {
>>>> + foreach my $key (sort { $a cmp $b } keys %Apache2::Reload::INCS) {
>>>> + my $file = $Apache2::Reload::INCS{$key};
>
>>> I hate each.
>>
>>
>> each is perfect when iterating over a large hash and not caring about
>> ordering.
>> Doesn't need to build a large array to hold _all_ the keys, so it's a
>> major
>> speed improvement.
>
> right, but A-R is a dev module :) (well most of the time :)
Yup, that's right.
>> I am not sure what is gained here by sorting ?
>
> Just that what Philip was after: easier to spot whether some module was
> reloaded or not.
>
> +1
Yeah, I've just looked more closely at what it's doing, and I would have to
agree to. This is a _good_ feature (and it's been checked in already, so +1 retro-actively)
--------------------------------------------------------------------------------
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5
Re: [PATCH] Apache2::Reload
Posted by Stas Bekman <st...@stason.org>.
Philippe M. Chiasson wrote:
> Geoffrey Young wrote:
>
>>>- while (my($key, $file) = each %Apache2::Reload::INCS) {
>>>+ foreach my $key (sort { $a cmp $b } keys %Apache2::Reload::INCS) {
>>>+ my $file = $Apache2::Reload::INCS{$key};
>>I hate each.
>
>
> each is perfect when iterating over a large hash and not caring about ordering.
> Doesn't need to build a large array to hold _all_ the keys, so it's a major
> speed improvement.
right, but A-R is a dev module :) (well most of the time :)
> I am not sure what is gained here by sorting ?
Just that what Philip was after: easier to spot whether some module was
reloaded or not.
+1
--
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [PATCH] Apache2::Reload
Posted by "Philippe M. Chiasson" <go...@ectoplasm.org>.
Geoffrey Young wrote:
>>- while (my($key, $file) = each %Apache2::Reload::INCS) {
>>+ foreach my $key (sort { $a cmp $b } keys %Apache2::Reload::INCS) {
>>+ my $file = $Apache2::Reload::INCS{$key};
>
> I hate each.
each is perfect when iterating over a large hash and not caring about ordering.
Doesn't need to build a large array to hold _all_ the keys, so it's a major
speed improvement.
I am not sure what is gained here by sorting ?
--------------------------------------------------------------------------------
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5
Re: [PATCH] Apache2::Reload
Posted by Geoffrey Young <ge...@modperlcookbook.org>.
> - while (my($key, $file) = each %Apache2::Reload::INCS) {
> + foreach my $key (sort { $a cmp $b } keys %Apache2::Reload::INCS) {
> + my $file = $Apache2::Reload::INCS{$key};
I hate each.
+1
--Geoff
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org