Forum archive 2000-2006

David Baur - use XML::Parser in a pg/lib/ .pm file

by Arnold Pizer -
Number of replies: 0
 use XML::Parser in a pg/lib/ .pm file topic started 7/10/2006; 6:11:16 PMlast post 7/10/2006; 7:13:25 PM
 David Baur - use XML::Parser in a pg/lib/ .pm file  7/10/2006; 6:11:16 PM (reads: 253, responses: 1) Hello again. I'm still working on that Java evaluator that I mentioned earlier, and I've run into a bit of trouble. To better explain my problem I feel I should first explain my approach. Right now the project consists primarily of 3 files : 1) pg/lib/Java.pm, which houses the bulk of my code and handles copying, compiling, and grading of a student's java code and returns the results (score, message, etc) in the form of a hash similar to an answerhash. 2) pg/macros/javaAnswerEvaluators.pl, which introduces a java_cmp evaluator which is essentially a wrapper for Java.pm based off of the evaluators in extraAnswerEvaluators.pl 3) customfolder/WWTestRunner.java, which runs a JUnit test on a student's java code and gives customized output in a proprietary format for parsing by Java.pm As it is right now, all of this works fine. For the sake of friendliness and expandability, however, I am trying to turn WWTestRunner's output into proper XML. I have modified WWTestRunner to output XML, but I am having trouble setting up Java.pm to parse it. The code to set up a parser in Java.pm looks something like: use XML::Parser; my $XMLparser = new XML::Parser( Style => 'Debug' ); my$XMLobj = $XMLparser->parsefile($fileName); and webwork says: Can't locate object method "new" via package "XML::Parser" (perhaps you forgot to load "XML::Parser"?) at /opt/pg/lib/Java.pm line 103, chunk 1. So from what I've gathered, it looks like "use" doesn't work because of the way the modules are loaded. Is this correct? If so, I was wondering if there was another way to load XML::Parser or a better way to structure this process to get around it. Thanks -David EDIT: I apologize for any formatting issues, and swear to never compose a post in notepad ever again. <| Post or View Comments |>