1Ace::Local(3) User Contributed Perl Documentation Ace::Local(3)
2
3
4
6 Ace::Local - use giface, tace or gifaceclient to open a local connec‐
7 tion to an Ace database
8
10 use Ace::Local
11 my $ace = Ace::Local->connect(-path=>'/usr/local/acedb/elegans');
12 $ace->query('find author Se*');
13 die "Query unsuccessful" unless $ace->status;
14 $ace->query('show');
15 while ($ace->encore) {
16 print $ace->read;
17 }
18
20 This class is provided for low-level access to local (non-networked)
21 Ace databases via the giface program. You will generally not need to
22 access it directly. Use Ace.pm instead.
23
24 For the sake of completeness, the method can also use the aceclient
25 program for its access. However the Ace::AceDB class is more efficient
26 for this purpose.
27
29 connect()
30
31 $accessor = Ace::Local->connect(-path=>$path_to_database);
32
33 Connect to the database at the indicated path using giface and return a
34 connection object (an "accessor"). Giface must be on the current
35 search path. Multiple accessors may be open simultaneously.
36
37 Arguments include:
38
39 -path
40 Path to the database (location of the "wspec/" directory).
41
42 -program
43 Used to indicate the location of the desired giface or gifaceclient
44 executable. You may also use tace or aceclient, but in that case
45 the asGIF() functionality will nog work. Can be used to override
46 the search path.
47
48 -host
49 Used when invoking gifaceclient. Indicates the host to connect to.
50
51 -port
52 Used when invoking gifaceclient. Indicates the port to connect to.
53
54 -nosync
55 Ordinarily Ace::Local synchronizes with the tace/giface prompt,
56 throwing out all warnings and copyright messages. If this is set,
57 Ace::Local will not do so. In this case you must call the
58 low_read() method until it returns undef in order to synchronize.
59
60 query()
61
62 $status = $accessor->query('query string');
63
64 Send the query string to the server and return a true value if success‐
65 ful. You must then call read() repeatedly in order to fetch the query
66 result.
67
68 read()
69
70 Read the result from the last query sent to the server and return it as
71 a string. ACE may return the result in pieces, breaking between whole
72 objects. You may need to read repeatedly in order to fetch the entire
73 result. Canonical example:
74
75 $accessor->query("find Sequence D*");
76 die "Got an error ",$accessor->error() if $accessor->status == STATUS_ERROR;
77 while ($accessor->status == STATUS_PENDING) {
78 $result .= $accessor->read;
79 }
80
81 low_read()
82
83 Read whatever data's available, or undef if none. This is only used by
84 the ace.pl replacement for giface/tace.
85
86 status()
87
88 Return the status code from the last operation. Status codes are
89 exported by default when you use Ace.pm. The status codes you may see
90 are:
91
92 STATUS_WAITING The server is waiting for a query.
93 STATUS_PENDING A query has been sent and Ace is waiting for
94 you to read() the result.
95 STATUS_ERROR A communications or syntax error has occurred
96
97 error()
98
99 May return a more detailed error code supplied by Ace. Error checking
100 is not fully implemented.
101
102 encore()
103
104 This method will return true after you have performed one or more
105 read() operations, and indicates that there is more data to read.
106 encore() is functionally equivalent to:
107
108 $encore = $accessor->status == STATUS_PENDING;
109
110 In fact, this is how it's implemented.
111
112 auto_save()
113
114 Sets or queries the auto_save variable. If true, the "save" command
115 will be issued automatically before the connection to the database is
116 severed. The default is true.
117
118 Examples:
119
120 $accessor->auto_save(1);
121 $flag = $accessor->auto_save;
122
124 Ace, Ace::Object, Ace::Iterator, Ace::Model
125
127 Lincoln Stein <lstein@w3.org> with extensive help from Jean Thierry-
128 Mieg <mieg@kaa.crbm.cnrs-mop.fr>
129
130 Copyright (c) 1997-1998, Lincoln D. Stein
131
132 This library is free software; you can redistribute it and/or modify it
133 under the same terms as Perl itself. See DISCLAIMER.txt for dis‐
134 claimers of warranty.
135
136
137
138perl v5.8.8 2001-02-20 Ace::Local(3)