[LON-CAPA-cvs] cvs: modules /msu localenroll.pm
raeburn
lon-capa-cvs@mail.lon-capa.org
Tue, 17 Oct 2006 18:31:51 -0000
raeburn Tue Oct 17 14:31:51 2006 EDT
Modified files:
/modules/msu localenroll.pm
Log:
Adding MSU's instcode_defaults() sub, and the AUTOLOAD() sub used to handle missing subroutines gracefully.
Index: modules/msu/localenroll.pm
diff -u modules/msu/localenroll.pm:1.21 modules/msu/localenroll.pm:1.22
--- modules/msu/localenroll.pm:1.21 Mon Sep 25 13:16:03 2006
+++ modules/msu/localenroll.pm Tue Oct 17 14:31:51 2006
@@ -1,6 +1,6 @@
# functions to glue school database system into Lon-CAPA for
# automated enrollment
-# $Id: localenroll.pm,v 1.21 2006/09/25 17:16:03 raeburn Exp $
+# $Id: localenroll.pm,v 1.22 2006/10/17 18:31:51 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -463,5 +463,35 @@
return $sectioncheck;
}
+sub instcode_defaults {
+ my ($dom,$defaults,$code_order) = @_;
+ %{$defaults} = (
+ 'Year' => '\d{2}',
+ 'Semester' => '^[sfu]s',
+ 'Department' => '\w{2,3}',
+ 'Number' => '\d{3,4}\w?',
+ );
+ @{$code_order} = ('Semester','Year','Department','Number');
+ return 'ok';
+}
+
+###############################
+# sub AUTOLOAD
+#
+# Incoming data: none
+# Returns ''
+#
+# Prevents errors when undefined subroutines are called in this package
+# Will allow new routines added in the future to be called from lond etc.
+# without the need for customized versions of local*.pm packages to be
+# modified to include the new subroutines immediately.
+#
+# See "Programming Perl" 3rd ed. pp 296-298.
+###############################
+
+sub AUTOLOAD {
+ our $AUTOLOAD;
+ return '';
+}
1;