[LON-CAPA-cvs] cvs: loncom /homework convertjme.pl
albertel
lon-capa-cvs@mail.lon-capa.org
Sat, 18 Oct 2003 07:16:49 -0000
albertel Sat Oct 18 03:16:49 2003 EDT
Modified files:
/loncom/homework convertjme.pl
Log:
- be more resilent in parsing the JME string
Index: loncom/homework/convertjme.pl
diff -u loncom/homework/convertjme.pl:1.5 loncom/homework/convertjme.pl:1.6
--- loncom/homework/convertjme.pl:1.5 Sat Oct 18 02:51:08 2003
+++ loncom/homework/convertjme.pl Sat Oct 18 03:16:48 2003
@@ -2,7 +2,7 @@
# The LearningOnline Network with CAPA
# Dynamically converts JME strings into either a png or ps file.
#
-# $Id: convertjme.pl,v 1.5 2003/10/18 06:51:08 albertel Exp $
+# $Id: convertjme.pl,v 1.6 2003/10/18 07:16:48 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -542,8 +542,9 @@
sub parse_struct {
my ($struct,$name,$x,$y,$atomA,$atomB,$bondType)=@_;
- my @JMEstring = split(/ /,$struct);
-
+ $struct=~s/^\s*//;
+ $struct=~s/\s*$//;
+ my @JMEstring = split(/ +/,$struct);
# parse JME string
my $natoms= shift @JMEstring;
my $nbonds= shift @JMEstring;