|
|
Choosing A Webhost: |
[Patch mp2] Test tied %Location in <Perl> sections: msg#00106apache.mod-perl.devel
As we discussed, instead of trying to use Tie::IxHash behind the scenes to order %Location blocks and such, we will recommend users to use Tie:: * for themselves like so: <Perl> tie %Location, "My::Tie"; </Perl> So, until I get around updating the documentation, I've at least tested that tied %Hashes in <Perl> sections do behave proprely. Only problem I can think of is that if you use PerlSections->dump, your hash will be dumped as a hash, not seeing the tie magic. So next time around, if you load your dumped <Perl> configuration, you'll experience hash ordering trouble once again. Index: t/response/TestDirective/perldo.pm =================================================================== RCS file: /home/cvs/modperl-2.0/t/response/TestDirective/perldo.pm,v retrieving revision 1.7 diff -u -I$Id -r1.7 perldo.pm --- t/response/TestDirective/perldo.pm 29 Feb 2004 05:28:43 -0000 1.7 +++ t/response/TestDirective/perldo.pm 24 Mar 2004 00:21:05 -0000 @@ -11,7 +11,7 @@ sub handler { my $r = shift; - plan $r, tests => 14; + plan $r, tests => 15; ok t_cmp('yes', $TestDirective::perl::worked); @@ -27,6 +27,8 @@ ok not exists $Location{'/perl_sections'}; ok exists $Location{'/perl_sections_saved'}; ok t_cmp('PerlSection', $Location{'/perl_sections_saved'}{'AuthName'}); + + ok t_cmp('TIED', $Location{'/tied'}, 'Tied %Location'); ok t_cmp('yes', $TestDirective::perl::comments); Index: t/conf/extra.last.conf.in =================================================================== RCS file: /home/cvs/modperl-2.0/t/conf/extra.last.conf.in,v retrieving revision 1.16 diff -u -I$Id -r1.16 extra.last.conf.in --- t/conf/extra.last.conf.in 16 Feb 2004 19:50:12 -0000 1.16 +++ t/conf/extra.last.conf.in 24 Mar 2004 00:21:05 -0000 @@ -12,7 +12,24 @@ }; </Perl> +<Perl> + package Tie::PerlSection; + use Tie::Hash; + @ISA = (Tie::StdHash); + sub FETCH { + my ($hash, $key) = @_; + if ($key eq '/tied') { + return 'TIED'; + } + return $hash->{$key}; + } +</Perl> + <Perl > +#Test tied %Location +tie %Location, 'Tie::PerlSection'; +$Location{'/tied'} = 'test_tied'; + $Apache::Server::SaveConfig = 1; $Location{'/perl_sections_saved'} = { 'AuthName' => 'PerlSection', -- 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
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: win32 unresolved symbols in mp2, Geoffrey Young |
|---|---|
| Next by Date: | Re: [Patch mp2] Test tied %Location in <Perl> sections, David Wheeler |
| Previous by Thread: | [mp2] ModPerl::Util::parse_version, Stas Bekman |
| Next by Thread: | Re: [Patch mp2] Test tied %Location in <Perl> sections, David Wheeler |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |