1#!/usr/bin/env perl 2# -*-Perl-*- 3 4## 5## \file readSBML.pl 6## \brief Similar to validateSBML, but without the validation 7## \author TBI {xtof,raim}@tbi.univie.ac.at 8## 9 10## 11## Copyright 2005 TBI 12## 13## This library is free software; you can redistribute it and/or modify it 14## under the terms of the GNU Lesser General Public License as published 15## by the Free Software Foundation; either version 2.1 of the License, or 16## any later version. 17## 18## This library is distributed in the hope that it will be useful, but 19## WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF 20## MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and 21## documentation provided hereunder is on an "as is" basis, and the 22## California Institute of Technology and Japan Science and Technology 23## Corporation have no obligations to provide maintenance, support, 24## updates, enhancements or modifications. In no event shall the 25## California Institute of Technology or the Japan Science and Technology 26## Corporation be liable to any party for direct, indirect, special, 27## incidental or consequential damages, including lost profits, arising 28## out of the use of this software and its documentation, even if the 29## California Institute of Technology and/or Japan Science and Technology 30## Corporation have been advised of the possibility of such damage. See 31## the GNU Lesser General Public License for more details. 32## 33## You should have received a copy of the GNU Lesser General Public License 34## along with this library; if not, write to the Free Software Foundation, 35## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 36## 37## The original code contained here was initially developed by: 38## 39## Christoph Flamm and Rainer Machne 40## Institut fuer Theoretische Chemie 41## Universitaet Wien 42## Waehringerstrasse 17/3/308 43## A-1090 Wien, Austria 44 45use File::Basename; 46use Benchmark qw/:hireswallclock/; 47use blib '../../src/bindings/perl'; 48use LibSBML; 49use strict; 50use vars qw/$tu/; 51 52my $filename = shift() 53 || do { printf STDERR "\n usage: @{[basename($0)]} <filename>\n\n"; 54 exit (1); 55 }; 56 57my $t0 = new Benchmark; 58my $rd = new LibSBML::SBMLReader(); 59my $d = $rd->readSBML($filename); 60my $t1 = new Benchmark; 61(my $ellapsed = timestr(timediff($t1, $t0), 'nop')) =~ s/\A([\d\.]+)/$1/; 62my $errors = $d->getNumErrors(); 63my $size = -s $filename; 64 65printf( "\n" ); 66printf( " filename: %s\n" , $filename ); 67printf( " file size: %lu\n", $size ); 68printf( " read time (%s): %lu\n", $tu, $ellapsed*1000); 69printf( " error(s): %u\n" , $errors ); 70 71if ($errors > 0) { 72 $d->printErrors(); 73} 74 75printf("\n"); 76 77BEGIN { 78 $main::tu = 'ms'; 79 eval "use Time::HiRes"; 80 warn "\nModule Time::HiRes not installed.\n" 81 . "Time granularity will be integer seconds not milliseconds!\n" if $@; 82 $main::tu = ' s' if $@; 83} 84 85__END__ 86 87