[system] / trunk / pg / lib / Parser / Function.pm Repository:
ViewVC logotype

Diff of /trunk/pg/lib/Parser/Function.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 2914 Revision 2915
37# Evaluate all the arguments and then perform the function 37# Evaluate all the arguments and then perform the function
38# 38#
39sub eval { 39sub eval {
40 my $self = shift; my @params = (); 40 my $self = shift; my @params = ();
41 foreach my $x (@{$self->{params}}) {push(@params,$x->eval)} 41 foreach my $x (@{$self->{params}}) {push(@params,$x->eval)}
42 $self->_eval(@params); 42 my $result = eval {$self->_eval(@params)};
43 return $result unless $@;
44 $self->Error("Can't take $self->{name} of ".join(',',@params));
43} 45}
44# 46#
45# Stub for sub-classes 47# Stub for sub-classes
46# 48#
47sub _eval {shift; return @_} 49sub _eval {shift; return @_}
103 my $fn = $context->{functions}{$name}; 105 my $fn = $context->{functions}{$name};
104 Value::Error("No definition for function '$name'") unless defined($fn); 106 Value::Error("No definition for function '$name'") unless defined($fn);
105 my $isFormula = 0; 107 my $isFormula = 0;
106 foreach my $x (@_) {return $self->formula($name,@_) if Value::isFormula($x)} 108 foreach my $x (@_) {return $self->formula($name,@_) if Value::isFormula($x)}
107 my $class = $fn->{class}; 109 my $class = $fn->{class};
108 $class->_call($name,@_); 110 my $result = eval {$class->_call($name,@_)};
111 return $result unless $@;
112 Value::Error("Can't take $name of ".join(',',@_));
109} 113}
110# 114#
111# Stub for sub-classes. 115# Stub for sub-classes.
112# (Default is return the argument) 116# (Default is return the argument)
113# 117#

Legend:
Removed from v.2914  
changed lines
  Added in v.2915

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9