Subject: | [PATCH] Fix user defined options handling and fix default of optional options |
Date: | Wed, 9 Sep 2009 16:55:45 +0200 |
To: | bug-apache-session-wrapper [...] rt.cpan.org |
From: | demerphq <demerphq [...] gmail.com> |
I was trying to use Apache::Session::Wrapper via Apache::Session::Flex
via MasonX::Request::WithApacheSession with customized configuration
via config file, and couldnt figure out how to make things work with
custom defined options until I made the following changes. While i was
debugging the one issue I noticed that the default optional options
was incorrect leading to ARRAY(0xdeadbeef) style keys in internal
hashes.
Cheers,
commit cf3b9051d3dd4e52e034436290e78191b19669bf
Author: Yves Orton <demerphq@gemini.(none)>
Date: Thu Aug 20 23:04:57 2009 +0200
user config options should default to SCALAR
diff --git a/lib/Apache/Session/Wrapper.pm b/lib/Apache/Session/Wrapper.pm
index 97595ac..1bdd4ed 100644
--- a/lib/Apache/Session/Wrapper.pm
+++ b/lib/Apache/Session/Wrapper.pm
@@ -311,7 +311,10 @@ sub _SetValidParams {
{
for my $p ( map { @$_ } map { @$_ } values %$hash )
{
- $extra{$p} = { optional => 1 };
+ $extra{$p} = {
+ optional => 1,
+ type => SCALAR
+ };
}
}
commit 8eda80d6f5c129f3b0f5aa892e6bf8c95f0f4859
Author: Yves Orton <demerphq@gemini.(none)>
Date: Thu Aug 20 23:04:02 2009 +0200
default should be an empty array, not an array of empty arrays
diff --git a/lib/Apache/Session/Wrapper.pm b/lib/Apache/Session/Wrapper.pm
index 66a37a2..97595ac 100644
--- a/lib/Apache/Session/Wrapper.pm
+++ b/lib/Apache/Session/Wrapper.pm
@@ -350,7 +350,7 @@ sub RegisterClass {
my $class = shift;
my %p = validate( @_, { name => { type => SCALAR },
required => { type => SCALAR | ARRAYREF,
default => [ [ ] ] },
- optional => { type => SCALAR | ARRAYREF,
default => [ [ ] ] },
+ optional => { type => SCALAR | ARRAYREF,
default => [ ] },
},
);
@@ -378,7 +378,7 @@ sub RegisterFlexClass {
},
name => { type => SCALAR },
required => { type => SCALAR | ARRAYREF,
default => [ [ ] ] },
- optional => { type => SCALAR | ARRAYREF,
default => [ [ ] ] },
+ optional => { type => SCALAR | ARRAYREF,
default => [ ] },
},
);
--
perl -Mre=debug -e "/just|another|perl|hacker/"