perfSONAR_PS::DB::File - A module that provides methods for adding 'database like' functions to files that contain XML markup.
This purpose of this module is to ease the burden for someone who simply wishes to use a flat file as an XML database. It should be known that this is not recommended as performance will no doubt suffer, but the ability to do so can be valuable. The module is to be treated as an object, where each instance of the object represents a direct connection to a file. Each method may then be invoked on the object for the specific database.
The only argument is a string representing the file to be opened.
(Re-)Sets the name of the file to be used.
Opens the database, will return status of operation.
Close the database, will return status of operation.
Given a query, returns the results or nothing.
Given a query, returns the results (as a nodeset) or nothing.
Counts the results of a query.
Returns the internal XML::LibXML DOM object. Will return "" on error.
Sets the DOM object.
use perfSONAR_PS::DB::File; my $file = new perfSONAR_PS::DB::File( "./store.xml" ); # or also: # # my $file = new perfSONAR_PS::DB::File; # $file->setFile("./store.xml"); my $parameters->{error} = ""; $file->openDB($parameters->{error}); print "There are " , $file->count("//nmwg:metadata", $parameters->{error}) , " elements in the file.\n"; my @results = $file->query("//nmwg:metadata", $parameters->{error}); foreach my $r (@results) { print $r , "\n"; } $file->closeDB($parameters->{error}); # If a DOM already exists... my $dom = XML::LibXML::Document->new("1.0", "UTF-8"); $file->setDOM($dom, $parameters->{error}); # or getting back the DOM... my $dom2 = $file->getDOM($parameters->{error});
XML::LibXML, Log::Log4perl, Params::Validate, perfSONAR_PS::Common
To join the 'perfSONAR-PS' mailing list, please visit:
https://mail.internet2.edu/wws/info/i2-perfsonar
The perfSONAR-PS subversion repository is located at:
https://svn.internet2.edu/svn/perfSONAR-PS
Questions and comments can be directed to the author, or the mailing list. Bugs, feature requests, and improvements can be directed here:
https://bugs.internet2.edu/jira/browse/PSPS
$Id$
Jason Zurawski, zurawski@internet2.edu
You should have received a copy of the Internet2 Intellectual Property Framework along with this software. If not, see <http://www.internet2.edu/membership/ip.html>
Copyright (c) 2004-2008, Internet2 and the University of Delaware
All rights reserved.
To install perfSONAR_PS::DB::File, copy and paste the appropriate command in to your terminal.
cpanm
cpanm perfSONAR_PS::DB::File
CPAN shell
perl -MCPAN -e shell install perfSONAR_PS::DB::File
For more information on module installation, please visit the detailed CPAN module installation guide.