Like most Perl modules, the RefDBClient::Client module is object-oriented. This section introduces the two classes that you need to know in order to work with the module. To see a working example, please check the test.pl script shipped with the module.
This is the main class used to access all refdb client functions. To get started, create a new instance and set the communication parameters:
use RefDBClient::Client; my $client = new RefDBClient::Client; $client->set_conninfo("127.0.0.1", "9734", "markus", "pass", "refdbtest", "/home/markus/literature", "/usr/local/share/refdb/css/refdb.css"); |
Then you can go ahead and send commands to the server like this:
my @result = $client->refdb_listdb(""); foreach $line (@result) { print $line . "\n"; } |
Note: As you can easily guess the functions implementing the client commands are analogous to the commands found in the refdba and refdbc clients. See the reference pages about these apps for further information about the commands.
server_ip and port_address are the IP address and the port where a refdbd server can be reached. username and password are required for the database server authentication. database is the name of the database that you want to use. You may leave it as 'undef' and later select a database instead. pdf_root and css_url set the paths for the offprint directory and the stylesheet for HTML output, respectively.
Adds the bibliography style supplied as a string in XML format according to the citestylex DTD to the refdb database. Returns a list of server messages.
If the database engine supports username/password authentication, use this function to add a new user to the system and grant access to a database. The host parameter is the IP address or the hostname of the system where refdbd runs (this parameter is currently only used by MySQL). newuserpassword is the password to be used for the new user(s). If is_add is set to "t", the user permissions will be granted, otherwise they will be revoked. The usernames parameter is a string containing a space-separated list of usernames. Returns a list of server messages.
If is_remove is set to "t", this function will remove the words supplied in the space-separated words string from the database of reserved journal words. Otherwise it will add the words to that database. Returns a list of server messages.
Sends the command to the server to perform configuration tasks. See the refdba:confserv command for a list of available server commands. Returns a list of server messages.
This function will create a new database using the supplied character encoding if the database engine supports this feature. Returns a list of server messages.
Deletes the given database. Returns a list of server messages.
Deletes the bibliography styles that match the provided pattern. The pattern is a Unix-style regular expression for MySQL and PostgreSQL and a SQL regular expression for SQLite. Returns a list of server messages.
Retrieves the given bibliography style as a XML document conforming to the citestylex DTD. Returns a list containing the style.
Retrieves a list of matching databases. databasename_regexp is a Unix-style regular expression for MySQL and PostgreSQL and a SQL regular expression for SQLite. Use an empty string to request all databases. Returns a list with the matching databases.
Retrieves a list of matching bibliography styles. stylename_regexp is a Unix-style regular expression for MySQL and PostgreSQL and a SQL regular expression for SQLite. Use an empty string to request all styles. Returns a list with the matching bibliography styles.
Retrieves a list of matching users of the given database. username_regexp is a Unix-style regular expression for MySQL and PostgreSQL and a SQL regular expression for SQLite. Use an empty string to request all users. Returns a list with the matching usernames.
Retrieves a list of matching reserved journal name words. word_regexp is a Unix-style regular expression for MySQL and PostgreSQL and a SQL regular expression for SQLite. Use an empty string to request all words. Returns a list with the matching journal words.
Requests some connection and status information from the server. Returns a list of server messages.
Adds the RIS datasets in the string risdata to the current databbase. Set owner if someone else than the current user is supposed to own the datasets. Returns a list of server messages.
Updates the RIS datasets in the string risdata in the current databbase. Set owner if someone else than the current user is supposed to own the datasets. If is_personal is set to "t", update only the personal information (RP, AV, N1). Returns a list of server messages.
Deletes the given datasets from the current database. id_list is a whitespace-separated list of IDs or ID ranges.
Retrieves a list of matching series editors in the current database. author_regexp is a Unix-style regular expression for MySQL and PostgreSQL and a SQL regular expression for SQLite. Use an empty string to request all series editors. Returns a list of the matching series editors.
Retrieves a list of matching authors in the current database. author_regexp is a Unix-style regular expression for MySQL and PostgreSQL and a SQL regular expression for SQLite. Use an empty string to request all authors. Returns a list of the matching authors.
Retrieves a list of matching editors in the current database. author_regexp is a Unix-style regular expression for MySQL and PostgreSQL and a SQL regular expression for SQLite. Use an empty string to request all editors. Returns a list of the matching editors.
Retrieves a list of matching keywords in the current database. author_regexp is a Unix-style regular expression for MySQL and PostgreSQL and a SQL regular expression for SQLite. Use an empty string to request all keywords. Returns a list of the matching keywords.
Retrieves a list of matching full journal names in the current database. journal_regexp is a Unix-style regular expression for MySQL and PostgreSQL and a SQL regular expression for SQLite. Use an empty string to request all full journal names. Returns a list of the matching full journal names. If is_all is set to "t", returns the matching full journal names along with the corresponding abbreviated names.
Retrieves a list of matching abbreviated journal names in the current database. journal_regexp is a Unix-style regular expression for MySQL and PostgreSQL and a SQL regular expression for SQLite. Use an empty string to request all abbreviated journal names. Returns a list of the matching abbreviated journal names. If is_all is set to "t", returns the matching abbreviated journal names along with the corresponding full and user abbreviated names.
Retrieves a list of matching abbreviated journal names (user abbreviation 1) in the current database. journal_regexp is a Unix-style regular expression for MySQL and PostgreSQL and a SQL regular expression for SQLite. Use an empty string to request all abbreviated journal names. Returns a list of the matching abbreviated journal names. If is_all is set to "t", returns the matching abbreviated journal names along with the corresponding full and user abbreviated names.
Retrieves a list of matching abbreviated journal names (user abbreviation 2) in the current database. journal_regexp is a Unix-style regular expression for MySQL and PostgreSQL and a SQL regular expression for SQLite. Use an empty string to request all abbreviated journal names. Returns a list of the matching abbreviated journal names. If is_all is set to "t", returns the matching abbreviated journal names along with the corresponding full and user abbreviated names.
Retrieves the references that match the query string. type specifies the output type and can be one of 'scrn', 'html', 'db31', 'db31x', 'teix', 'tex'. format_string specifies additional fields to be printed in the 'scrn' or 'html' output formats. sort_string can be either 'ID' or 'PY'. If is_personal is set to "t", only matching references in the personal reference list will be listed. query_string is a string using the refdbc:getref query syntax. Returns the requested output as a list.
Adds or removes (if is_remove is set to "t") the given references from the personal reference list. id_list is a space-separated list of IDs or ID ranges. Returns a list of server messages.
Selects the given database as the current database. Returns a list of server messages.
Retrieves information about the currently selected database. Returns the information as a list.
Retrieves a bibliography suited for LaTeX documents. style selects the bibliography style. cite_data is a string containing a space-separated list of citation keys that were cited. Returns the bibliography as a list.
Retrieves a bibliography and a stylesheet driver suitable for SGML or XML documents. type is one of 'db31', 'db31x', or 'teix' and selects the output type. style selects the bibliography style. style_callback and biblio_callback are references of functions that will be called when stylesheet and bibliography data are ready, respectively. style_callback will be called as style_callback (style, type, styledata). biblio_callback will be called as biblio_callback (bibliodata). cite_data is a string containing the citation information as a XML document conforming to the citationlistx DTD. Returns a list of server messages.
This is a helper function to create bibliographies for LaTeX documents. It extracts the citations from the .aux file whose name is supplied as an argument. The result is a space-separated string containing the citation keys found in the file.
This is a helper class to handle RIS datasets.
Reads the RIS datasets from the file with the given filename into a list. The function returns this list.