--- loncom/homework/math_parser/CalcEnv.pm 2015/06/29 15:42:13 1.1 +++ loncom/homework/math_parser/CalcEnv.pm 2023/03/13 22:31:22 1.3 @@ -1,6 +1,8 @@ # The LearningOnline Network with CAPA - LON-CAPA # CalcEnv # +# $Id: CalcEnv.pm,v 1.3 2023/03/13 22:31:22 raeburn Exp $ +# # Copyright (C) 2014 Michigan State University Board of Trustees # # This program is free software: you can redistribute it and/or modify @@ -36,9 +38,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();