Now you can pass another :-separated argument, the default value to use if none is specified.
Signed-off-by: Ian Jackson <ian.jack...@eu.citrix.com> CC: Roger Pau Monné <roy...@freebsd.org> --- Osstest/ResourceCondition/PropCompareBase.pm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Osstest/ResourceCondition/PropCompareBase.pm b/Osstest/ResourceCondition/PropCompareBase.pm index e1efe5f..5aff8f3 100644 --- a/Osstest/ResourceCondition/PropCompareBase.pm +++ b/Osstest/ResourceCondition/PropCompareBase.pm @@ -34,13 +34,14 @@ BEGIN { } sub new { - my ($class, $name, $prop, $val) = @_; + my ($class, $name, $prop, $val, $defval) = @_; die "propname: $prop?" unless propname_check($prop); return bless { Prop => $prop, - Val => $val + Val => $val, + DefaultVal => $val, }, $class; } @@ -64,7 +65,11 @@ END $hpropq->finish(); my $v = $row->[0]; - return $v; + return $v if defined $v; + + return $pc->{DefaultVal}; + # if no default specified, returns undef + # then _check gets to decide what to do } sub check { -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel