You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ja...@apache.org on 2001/10/10 22:07:52 UTC

cvs commit: xml-xerces/perl/samples IDOMCount.pl

jasons      01/10/10 13:07:52

  Modified:    perl/samples IDOMCount.pl
  Log:
  	* samples/IDOMCount.pl (Repository):
  	Added USAGE output if no input files are specified
  	new exception handling code
  
  Revision  Changes    Path
  1.2       +14 -3     xml-xerces/perl/samples/IDOMCount.pl
  
  Index: IDOMCount.pl
  ===================================================================
  RCS file: /home/cvs/xml-xerces/perl/samples/IDOMCount.pl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- IDOMCount.pl	2001/09/16 15:19:19	1.1
  +++ IDOMCount.pl	2001/10/10 20:07:51	1.2
  @@ -83,15 +83,17 @@
     * = Default if not provided explicitly
   
   EOU
  -my $VERSION = q[$Id: IDOMCount.pl,v 1.1 2001/09/16 15:19:19 jasons Exp $];
  +my $VERSION = q[$Id: IDOMCount.pl,v 1.2 2001/10/10 20:07:51 jasons Exp $ ];
   
   my $rc = GetOptions(\%OPTIONS,
   		    'v=s',
   		    'n',
   		    's');
   
  -die "$USAGE" unless $rc;
  +die $USAGE unless $rc;
   
  +die $USAGE unless scalar @ARGV;
  +
   my $file = $ARGV[0];
   -f $file or die "File '$file' does not exist!\n";
   
  @@ -124,7 +126,16 @@
   $parser->setErrorHandler($error_handler);
   
   my $t0 = new Benchmark;
  -$parser->parse ($file);
  +eval {
  +  $parser->parse ($file);
  +};
  +if ($@) {
  +  if (ref $@) {
  +    die $@->getMessage();
  +  } else {
  +    die $@;
  +  }
  +}
   my $doc = $parser->getDocument ();
   my $element_count = $doc->getElementsByTagName("*")->getLength();
   my $t1 = new Benchmark;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org