Skip to content

Commit

Permalink
fixes for Readonly leading to 0.79
Browse files Browse the repository at this point in the history
  • Loading branch information
autarch committed Jan 21, 2006
1 parent 71ab450 commit d51e466
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 12 deletions.
11 changes: 11 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
0.79 Jan 13, 2006

- The XS version of Params::Validate did not work if a spec hash
reference was marked Readonly using Readonly::XS.

- Added some tests for using tied values for params or spec, and
discovered that a tied spec causes a segfault, but could not figure
out how to fix this (Grr, Perl magic is a huge pain in the nether
regions).


0.78 Jul 19, 2005

- If an overloaded object returned false in boolean context, then it
Expand Down
16 changes: 9 additions & 7 deletions MANIFEST
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
Changes
LICENSE
MANIFEST This list of files
Makefile.PL
README
TODO
Validate.xs
lib/Attribute/Params/Validate.pm
lib/Params/Validate.pm
lib/Params/ValidatePP.pm
lib/Params/ValidateXS.pm
LICENSE
Makefile.PL
MANIFEST This list of files
META.yml Module meta-data in YAML
ppport.h
README
t/01-validate.t
t/02-noop.t
t/03-attribute.t
Expand All @@ -31,9 +30,12 @@ t/18-depends.t
t/19-untaint.t
t/21-can.t
t/22-overload-can-bug.t
t/23-readonly-xs.t
t/24-tied.t
t/callbacks.pl
t/defaults.pl
t/regex.pl
t/tests.pl
t/with.pl
META.yml Module meta-data in YAML
TODO
Validate.xs
3 changes: 3 additions & 0 deletions MANIFEST.SKIP
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ pm_to_blib
test\.c
t/zz.*
t/99-pod.t
leak.*
^[^/]*\.t
^[^/]*\.pl
18 changes: 14 additions & 4 deletions Validate.xs
Original file line number Diff line number Diff line change
Expand Up @@ -1098,10 +1098,13 @@ validate(HV* p, HV* specs, HV* options, HV* ret)
hv_iterinit(specs);
while (he = hv_iternext(specs)) {
HV* spec;
SV* val;

val = HeVAL(he);

/* get extended param spec if available */
if (SvROK(HeVAL(he)) && SvTYPE(SvRV(HeVAL(he))) == SVt_PVHV) {
spec = (HV*) SvRV(HeVAL(he));
if (SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVHV) {
spec = (HV*) SvRV(val);
} else {
spec = NULL;
}
Expand Down Expand Up @@ -1384,10 +1387,13 @@ _validate(p, specs)

if (no_validation() && GIMME_V == G_VOID) XSRETURN(0);

if (!SvROK(p) || !(SvTYPE(SvRV(p)) == SVt_PVAV)) {
SvGETMAGIC(p);
if (! (SvROK(p) && SvTYPE(SvRV(p)) == SVt_PVAV)) {
croak("Expecting array reference as first parameter");
}
if (!SvROK(specs) || !(SvTYPE(SvRV(specs)) == SVt_PVHV)) {

SvGETMAGIC(specs);
if (! (SvROK(specs) && SvTYPE(SvRV(specs)) == SVt_PVHV)) {
croak("Expecting hash reference as second parameter");
}

Expand Down Expand Up @@ -1417,6 +1423,7 @@ _validate(p, specs)

if (GIMME_V != G_VOID)
ret = (HV*) sv_2mortal((SV*) newHV());

if (! validate(ph, (HV*) SvRV(specs), options, ret))
XSRETURN(0);

Expand All @@ -1436,9 +1443,11 @@ _validate_pos(p, ...)

if (no_validation() && GIMME_V == G_VOID) XSRETURN(0);

SvGETMAGIC(p);
if (!SvROK(p) || !(SvTYPE(SvRV(p)) == SVt_PVAV)) {
croak("Expecting array reference as first parameter");
}

specs = (AV*) sv_2mortal((SV*) newAV());
av_extend(specs, items);
for(i = 1; i < items; i++) {
Expand All @@ -1449,6 +1458,7 @@ _validate_pos(p, ...)
}

if (GIMME_V != G_VOID) ret = (AV*) sv_2mortal((SV*) newAV());

if (! validate_pos((AV*) SvRV(p), specs, get_options(NULL), ret))
XSRETURN(0);

Expand Down
2 changes: 1 addition & 1 deletion lib/Params/Validate.pm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ BEGIN

@ISA = 'Exporter';

$VERSION = '0.78';
$VERSION = '0.79';

my %tags =
( types =>
Expand Down

0 comments on commit d51e466

Please sign in to comment.