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
signature.asc
Description: This is a digitally signed message part
