I am trying to use some of the command line tools of the xml.apache.org project; Xerces-J, Xalan and FOP. The goal is to validate the XML, transform it, then create a PDF. I wish I could use AxKit, but I need to create PDFs and FOP is the only open source tool I could find to do this. One of the routines look like this;
It does the job, but I am going crazy trying to trap any errors or warnings. When there is an error it just prints it to the screen and it never gets into $@. I have read up on eval and system but I cannot figure out a way to get the results of the command into $@. I need to do error checking and logging for each of these routines. Is it a problem specific to Java commands, am I missing something in my eval? Or did I just drink too much coffee today? If anybody can help me I will toast to your collective honor and wisdom this weekend. mmmmmm ... toastsub validate_xml { my $file_r = shift; # use Xerces to validate xml eval { `java sax.SAXCount -v $$file_r`; }; if ($@) { print "$@\n"; &log_error($@); } }
Get Strong Together!!
In reply to Trapping Java Errors by aardvark
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |