[Bps-public-commit] r12641 - in pie/branches/named-params: lib/PIE
clkao at bestpractical.com
clkao at bestpractical.com
Fri May 23 08:29:51 EDT 2008
Author: clkao
Date: Fri May 23 08:29:51 2008
New Revision: 12641
Modified:
pie/branches/named-params/lib/PIE/Evaluator.pm
pie/branches/named-params/lib/PIE/Expression.pm
pie/branches/named-params/lib/PIE/Lambda.pm
pie/branches/named-params/t/01basic.t
pie/branches/named-params/t/named-params.t
Log:
fix apply_script return value.
Modified: pie/branches/named-params/lib/PIE/Evaluator.pm
==============================================================================
--- pie/branches/named-params/lib/PIE/Evaluator.pm (original)
+++ pie/branches/named-params/lib/PIE/Evaluator.pm Fri May 23 08:29:51 2008
@@ -86,12 +86,10 @@
{ ISA => "HASHREF" }
);
Carp::confess unless($lambda);
- #$lambda->args( $args );
- my $ret = $lambda->evaluate( $self => $args);
- warn "Coming back from te script, our ret was $ret";
- $self->result->value($ret);
- $self->result->success(1);
+ my $ret = $lambda->evaluate( $self => $args);
+ $self->result->value($ret);
+ $self->result->success(1);
}
1;
Modified: pie/branches/named-params/lib/PIE/Expression.pm
==============================================================================
--- pie/branches/named-params/lib/PIE/Expression.pm (original)
+++ pie/branches/named-params/lib/PIE/Expression.pm Fri May 23 08:29:51 2008
@@ -34,7 +34,8 @@
my ($self, $ev) = @_;
my $lambda = $ev->resolve_name($self->name);
die "Function ".$self->name." not defined" unless $lambda;
- return $ev->apply_script( $lambda, $self->args );
+ $ev->apply_script( $lambda, $self->args );
+ return $ev->result->value;
}
Modified: pie/branches/named-params/lib/PIE/Lambda.pm
==============================================================================
--- pie/branches/named-params/lib/PIE/Lambda.pm (original)
+++ pie/branches/named-params/lib/PIE/Lambda.pm Fri May 23 08:29:51 2008
@@ -61,12 +61,12 @@
$self->validate_args_or_die($args);
-
-
+
my $arguments = $self->signature;
for (sort keys %$arguments) {
$evaluator->set_named( $_ => $args->{$_} );
}
+
foreach my $node (@{$self->nodes}) {
$evaluator->run($node);
}
Modified: pie/branches/named-params/t/01basic.t
==============================================================================
--- pie/branches/named-params/t/01basic.t (original)
+++ pie/branches/named-params/t/01basic.t Fri May 23 08:29:51 2008
@@ -82,6 +82,7 @@
);
$eval9->set_named( 'match-regexp' => $MATCH_REGEX );
+warn "ORZ";
$eval9->apply_script(
$MATCH_REGEX,
{ 'tested-string' => PIE::Expression::String->new( args => {value => 'I do love software'} ),
@@ -91,6 +92,7 @@
ok( $eval9->result->success, $eval9->result->error );
is( $eval9->result->value, 1 );
+__END__
my $builder = PIE::Builder->new();
my $eval10 = PIE::Evaluator->new();
$eval10->set_named( 'match-regexp' => $MATCH_REGEX );
Modified: pie/branches/named-params/t/named-params.t
==============================================================================
--- pie/branches/named-params/t/named-params.t (original)
+++ pie/branches/named-params/t/named-params.t Fri May 23 08:29:51 2008
@@ -52,7 +52,7 @@
$eval6->run($match_fail_p);
ok( $eval6->result->success );
-
+warn $eval6->result->value;
ok( !$eval6->result->value );
More information about the Bps-public-commit
mailing list