![]() |
|||
| |||
|
SpaceKit for Perl, page 2
1 Introduction
» Example Client Applications
3 Example Server Implementation (bxxd.pl)
4 Example For The Impatient - Utilites
this article in RFC-2629 formats Example Client Applications Example client applications are located in the top-level examples/client directory.
Blocks Information Groper (big.pl) Implements the basic client (mixer) interface. The search, fetch, and store mixer operations are supported.
Search Operation Returns a list of valid "name" attributes (e.g., "doc.rfc.2629") matching the search criteria. These names are suitable as arguments to the fetch operation.
% perl big.pl -server sqa.invisible.net search "<union><intersect><compare subtree='doc.rfc' operator='contains' caseSensitive='false'><path><element property='email' /></path><value>mrose@</value></compare></intersect></union>" doc.rfc.2629See SEP[2] for further details on the set-union specification used by the search operation.
Fetch Operation Fetch the contents of the specified block to standard output.
% perl big.pl -server sqa.invisible.net fetch doc.rfc.2629 <rfc serial="2" name="doc.rfc.2629"> <rfc.props number="2629" category="info" relativeSize="46132"></rfc.props> <doc.props> <doc.front> <doc.title>Writing I-Ds and RFCs using XML</doc.title> <doc.author surname="Rose" fullname="Marshall T. Rose" initials="M.T."> <organization>Invisible Worlds, Inc.</organization> <address> <postal> <street>660 York Street</street> <city>San Francisco</city> <region>CA</region> <code>94110</code> <country>US</country></postal> <phone>+1 415 695 3975</phone> <email>mrose@not.invisible.net</email> <uri>http://invisible.net/</uri></address></doc.author> <doc.date year="1999" month="June"></doc.date> <doc.area>General</doc.area> <doc.keyword>RFC</doc.keyword> <doc.keyword>Request for Comments</doc.keyword> <doc.keyword>I-D</doc.keyword> <doc.keyword>Internet-Draft</doc.keyword> <doc.keyword>XML</doc.keyword> <doc.keyword>Extensible Markup Language</doc.keyword></doc.front><doc.extras abstract="true" note="false"></doc.extras> <doc.links> </doc.links> </doc.props> <remote.props uri="http://sqa.not.invisible.net/public/rfc/html/rfc2629.html"></remote.props> <remote.props uri="http://sqa.not.invisible.net/public/rfc/txt/rfc2629.txt" language="text"></remote.props> </rfc>
Store Operation Store the specified block using content from standard input. Four modes of store operation are available: create, delete, update, and write. This implementation of store expects to get its block content from standard input.
Store create Create a new block, returning an error if the block already exists.
% perl big.pl -server sqa.invisible.net store test.yoursubtree test.yoursubtree.2629 create < 2629.xml
Store delete Delete the specified block, returning an error if the block does not exist. This operation only requires the block name, so a simplified XML input can be provided (e.g., <rfc name="doc.rfc.2629" />).
% perl big.pl -server sqa.invisible.net store test.yoursubtree test.yoursubtree.2629 delete < 2629.xml
Store update Update the specified block, returning an error if the block does not exist.
% perl big.pl -server sqa.invisible.net store test.yoursubtree test.yoursubtree.2629 update < 2629.xml
Store write Create or update the specified block, as appropriate.
% perl big.pl -server sqa.invisible.net store test.yoursubtree test.yoursubtree.2629 write < 2629.xmlNOTE: It is probably not a good idea to allow non-authenticated store operations against your blocks server, which is what the above examples demonstrate. The following is a more likely example in normal use, using SASL/OTP for authentication.
% perl big.pl -server sqa.invisible.net -mechanism otp -username yourusername -passphrase yourpassphrase store test.yoursubtree test.yoursubtree.2629 write < 2629.xml
BXXP Ping (bxxpng.pl) Opens a channel with the specified server and passes arbitrary text, which is then either echoed back to the client and verified to match what was sent (NULL/ECHO profile) or is simply ignored by the server (NULL/SINK profile).
BXXPng echo
% perl bxxpng.pl -server sqa.invisible.net echo initializing buffer... done. ..... 5 round-trips: min/avg/max = 312.743 334.746 360.107 (ms) 3 2 2 (KB/s)
BXXPng sink
% perl bxxpng.pl -server sqa.invisible.net sink initializing buffer... done. ..... 5 round-trips: min/avg/max = 306.301 329.171 376.339 (ms) 3 2 2 (KB/s)
Next » Example Server Implementation (bxxd.pl)
Footnotes » [2] Rose, M.T., "The Blocks Simple Exchange Profile", Internet-Draft draft-mrose-blocks-exchange-01, April 2000.
Copyright © 2000 Invisible Worlds. All Rights Reserved.
![]() |
|||
|