joes 2004/07/13 10:00:09
Modified: glue/perl/t/response/TestApReq request.pm
glue/perl/xsbuilder apreq_xs_tables.h
Log:
Cleanup perl versioning in MAGIC ITERATOR / MAGIC KEY tests.
Revision Changes Path
1.31 +27 -24 httpd-apreq-2/glue/perl/t/response/TestApReq/request.pm
Index: request.pm
===================================================================
RCS file: /home/cvs/httpd-apreq-2/glue/perl/t/response/TestApReq/request.pm,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- request.pm 13 Jul 2004 15:59:35 -0000 1.30
+++ request.pm 13 Jul 2004 17:00:08 -0000 1.31
@@ -146,32 +146,35 @@
$args->add("foo" => "bar2");
my $test_string = "";
- # TIEHASH ITERATOR TESTS
-
- $test_string .= "$a=$b;" while ($a, $b) = each %$args;
- die "each test failed: '$test_string'" unless
- $test_string eq "test=disable_uploads;foo=bar1;foo=bar2;";
-
- $test_string = join ":", values %$args;
- die "values test failed: '$test_string'" unless
- $test_string eq "disable_uploads:bar1:bar2";
-
- $test_string = join ":", %$args;
- die "list deref test failed: '$test_string'" unless
- $test_string eq "test:disable_uploads:foo:bar1:foo:bar2";
+ # MAGIC ITERATOR TESTS
+ if ($^V ge v5.8.0) {
+ warn "Running MAGIC ITERATOR tests";
+ $test_string .= "$a=$b;" while ($a, $b) = each %$args;
+ die "each test failed: '$test_string'" unless
+ $test_string eq
"test=disable_uploads;foo=bar1;foo=bar2;";
+
+ $test_string = join ":", values %$args;
+ die "values test failed: '$test_string'" unless
+ $test_string eq "disable_uploads:bar1:bar2";
+
+ $test_string = join ":", %$args;
+ die "list deref test failed: '$test_string'" unless
+ $test_string eq "test:disable_uploads:foo:bar1:foo:bar2";
+ }
# MAGIC KEY TESTS
-
- $test_string = "";
- $test_string .= "$_=" . $args->get($_) . ";" for $args->get;
- die "get test failed: '$test_string'" unless
- $test_string eq "test=disable_uploads;foo=bar1;foo=bar2;";
-
- $test_string = "";
- $test_string .= "$_=" . $args->get($_) . ";" for @_ = $args->get;
- die "get test2 failed: '$test_string'" unless
- $test_string eq "test=disable_uploads;foo=bar1;foo=bar2;";
-
+ if ($^V ge v5.8.1) {
+ warn "Running MAGIC KEY tests";
+ $test_string = "";
+ $test_string .= "$_=" . $args->get($_) . ";" for $args->get;
+ die "get test failed: '$test_string'" unless
+ $test_string eq
"test=disable_uploads;foo=bar1;foo=bar2;";
+
+ $test_string = "";
+ $test_string .= "$_=" . $args->get($_) . ";" for @_ =
$args->get;
+ die "get test2 failed: '$test_string'" unless
+ $test_string eq
"test=disable_uploads;foo=bar1;foo=bar2;";
+ }
[EMAIL PROTECTED]>print("ok");
}
1.18 +10 -14 httpd-apreq-2/glue/perl/xsbuilder/apreq_xs_tables.h
Index: apreq_xs_tables.h
===================================================================
RCS file: /home/cvs/httpd-apreq-2/glue/perl/xsbuilder/apreq_xs_tables.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- apreq_xs_tables.h 13 Jul 2004 16:30:00 -0000 1.17
+++ apreq_xs_tables.h 13 Jul 2004 17:00:09 -0000 1.18
@@ -166,21 +166,9 @@
}
+/* KEY MAGIC: needs 5.8.x, x >= 1 (not sure if this will work in 5.10.x) */
-/* TABLE_GET */
-struct apreq_xs_table_key_magic {
- SV *obj;
- const char *val;
-};
-
-/* Ignore KEY_MAGIC for now - testing safer MGVTBL approach.
-** Comment the define of APREQ_XS_TABLE_USE_KEY_MAGIC out
-** if perl still chokes on key magic
-** Need 5.8.1 or higher for PERL_MAGIC_vstring
-*/
-#define APREQ_XS_TABLE_USE_KEY_MAGIC (PERL_VERSION == 8 && PERL_SUBVERSION >
0)
-
-#if APREQ_XS_TABLE_USE_KEY_MAGIC
+#if (PERL_VERSION == 8 && PERL_SUBVERSION >= 1)
#define APREQ_XS_TABLE_ADD_KEY_MAGIC(p, sv, o, v) do { \
struct apreq_xs_table_key_magic *info = apr_palloc(p,sizeof *info); \
@@ -195,6 +183,14 @@
#define APREQ_XS_TABLE_ADD_KEY_MAGIC(p,sv,o,v) /* noop */
#endif
+
+
+/* TABLE_GET */
+struct apreq_xs_table_key_magic {
+ SV *obj;
+ const char *val;
+};
+
struct apreq_xs_do_arg {
void *env;