static char* valid_keys[] = { "callbacks", "can", "default", "depends", "isa", "optional", "regex", "type" }; HE* he; hv_iterinit(spec); while (he = hv_iternext(spec)) { STRLEN len; char* key = HePV(he, len); int ok = 0; int j; for (j=0; j < sizeof(valid_keys)/sizeof(valid_keys[0]); j++) { if (strcmp(key, valid_keys[j]) == 0) { ok = 1; break; } } if (!ok) { SV* buffer = sv_2mortal(newSVpv("'",0)); sv_catpv(buffer, key); sv_catpv(buffer, "': unknown option error\n"); FAIL(buffer, options); } } #### $ ./841578.pl 1..4 'callback': unknown option error at ./841578.pl line 14 main::howareyoufeelingtoday('happy') called at ./841578.pl line 18 # Looks like your test exited with 9 before it could output anything.