Stas Bekman wrote: > Actually > > <VirtualHost gozer> > <Perl> > $PerlSetVar = "foo $bar"; > </Perl> > </VirtualHost> > > works. As I've later figured out thanks to Philippe's examples is that > my problem was that I was calling: > > $PerlSetVar = ["foo", $bar], > > which mod_perl has happily ignored or something... it didn't generate > any errors. and I think it should. > > I'm still not sure how to set several PerlSetVar entries.
@PerlSetVar = ("foo $bar", "fooz $otherbar");
or
@PerlSetVar = (['foo',$bar], ['fooz',$otherbar]);
> It's very confusing. And the worst thing is that things silently fail...
It doesn't silently fail for me:
<Perl>
$PerlSetVar = ['gozer','rules'];
</Perl>
$> t/TEST -start
Syntax error on line 93 of [mp2]/t/conf/extra.last.conf:
$parms->add_config() has failed: PerlSetVar takes two arguments
[ error]
server has died with status 255
But the attached patche makes it work as you'd expect too ;-)
--------------------------------------------------------------------------------
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
Index: lib/Apache2/PerlSections.pm
===================================================================
--- lib/Apache2/PerlSections.pm (revision 239215)
+++ lib/Apache2/PerlSections.pm (working copy)
@@ -90,8 +90,8 @@
#We don't want to pick up stashes...
next if ($key =~ /::$/);
local (*ENTRY) = $val;
- if (defined $val && defined *ENTRY{SCALAR}) {
- push @{$self->{symbols}}, [$key, $ENTRY];
+ if (defined $val && defined *ENTRY{SCALAR} && defined $ENTRY) {
+ push @{$self->{symbols}}, [$key, \$ENTRY];
}
if (defined $val && defined *ENTRY{ARRAY}) {
push @{$self->{symbols}}, [$key, [EMAIL PROTECTED];
@@ -176,12 +176,16 @@
$self->dump_entry($name, $_) for @$entry;
}
else {
- $self->add_config("$name @$entry\n");
+ my $data = join ' ', map { qq("$_") } @$entry;
+ $self->add_config("$name $data\n");
}
}
elsif ($type eq 'HASH') {
$self->dump_hash($name, $entry);
}
+ elsif ($type eq 'REF') {
+ $self->dump_entry($name, $$entry);
+ }
elsif ($type) {
#XXX: Could do $type->can('httpd_config') here on objects ???
die "Unknown type '$type' for directive $name";
Index: lib/Apache2/PerlSections/Dump.pm
===================================================================
--- lib/Apache2/PerlSections/Dump.pm (revision 239215)
+++ lib/Apache2/PerlSections/Dump.pm (working copy)
@@ -72,10 +72,10 @@
return if not defined $entry;
my $type = ref($entry);
- if ($type eq 'SCALAR') {
+ if ($type eq 'SCALAR' || $type eq 'REF') {
$self->add_config(Data::Dumper->Dump([$$entry],[$name]));
}
- if ($type eq 'ARRAY') {
+ elsif ($type eq 'ARRAY') {
$self->dump_array($name,$entry);
}
else {
signature.asc
Description: OpenPGP digital signature
