--- loncom/homework/math_parser/CalcEnv.pm 2015/06/29 15:42:13 1.1 +++ loncom/homework/math_parser/CalcEnv.pm 2015/06/30 17:42:14 1.2 @@ -36,9 +36,12 @@ use aliased 'Apache::math_parser::Units' # @param {boolean} unit_mode ## sub new { - my $class = shift; + my ($class, $unit_mode) = @_; + if (!defined $unit_mode) { + $unit_mode = 0; + } my $self = { - _unit_mode => shift // 0, + _unit_mode => $unit_mode, }; if ($self->{_unit_mode}) { $self->{_units} = Units->new();