view release on metacpan or search on metacpan
Ace/Local.pm view on Meta::CPAN
my $args;
# some pretty insane heuristics to handle BOTH tace and aceclient
die "Specify either -path or -host and -port" if ($program && ($host || $port));
die "-path is not relevant for aceclient, use -host and/or -port"
if defined($program) && $program=~/aceclient/ && defined($path);
die "-host and -port are not relevant for tace, use -path"
if defined($program) && $program=~/tace/ and (defined $port || defined $host);
# note, this relies on the programs being included in the current PATH
my $prompt = 'acedb> ';
if ($host || $port) {
$program ||= 'aceclient';
$prompt = "acedb\@$host> ";
} else {
$program ||= 'giface';
}
if ($program =~ /aceclient/) {
$host ||= DEFAULT_HOST;
$port ||= DEFAULT_PORT;
$args = "$host -port $port";
} else {
$path ||= DEFAULT_DB;
$path = _expand_twiddles($path);
$args = $path;
}
my($rdr,$wtr) = (gensym,gensym);
my($pid) = open2($rdr,$wtr,"$program $args");
unless ($pid) {
$Ace::Error = <$rdr>;
return undef;
}
# Figure out the prompt by reading until we get zero length,
# then take whatever's at the end.
unless ($nosync) {
local($/) = "> ";
my $data = <$rdr>;
($prompt) = $data=~/^(.+> )/m;
unless ($prompt) {
$Ace::Error = "$program didn't open correctly";
return undef;
}
}
return bless {
'read' => $rdr,
'write' => $wtr,
'prompt' => $prompt,
'pid' => $pid,
'auto_save' => 1,
'status' => $nosync ? STATUS_PENDING : STATUS_WAITING, # initial stuff to read
},$class;
}
sub debug {
my $self = shift;
my $d = $self->{debug};
$self->{debug} = shift if @_;
Ace/Local.pm view on Meta::CPAN
}
sysread($rdr,$data,READSIZE);
return $data;
}
sub read {
my $self = shift;
return undef unless $self->{'status'} == STATUS_PENDING;
my $rdr = $self->{'read'};
my $len = defined $self->{'buffer'} ? length($self->{'buffer'}) : 0;
my $plen = length($self->{'prompt'});
my ($result, $bytes, $pos, $searchfrom);
while (1) {
# Read the data directly onto the end of the buffer
$bytes = sysread($rdr, $self->{'buffer'},
READSIZE, $len);
unless ($bytes > 0) {
$self->{'status'} = STATUS_ERROR;
return;
}
# check for prompt
# The following checks were implemented using regexps and $' and
# friends. I have changed this to use {r}index and substr (a)
# because they're much faster than regexps and (b) because using
# $' and $` causes all regexps in a program to execute
# very slowly due to excessive and unnecessary pre/post-match
# copying -- tim.cutts@incyte.com 08 Sep 1999
# Note, don't need to search the whole buffer for the prompt;
# just need to search the new data and the prompt length from
# any previous data.
$searchfrom = ($len <= $plen) ? 0 : ($len - $plen);
if (($pos = index($self->{'buffer'},
$self->{'prompt'},
$searchfrom)) > 0) {
$self->{'status'} = STATUS_WAITING;
$result = substr($self->{'buffer'}, 0, $pos);
$self->{'buffer'} = '';
return $result;
}
# return partial results for paragraph breaks
if (($pos = rindex($self->{'buffer'}, "\n\n")) > 0) {
Ace/Local.pm view on Meta::CPAN
=item B<-host>
Used when invoking I<gifaceclient>. Indicates the host to connect to.
=item B<-port>
Used when invoking I<gifaceclient>. Indicates the port to connect to.
=item B<-nosync>
Ordinarily Ace::Local synchronizes with the tace/giface prompt,
throwing out all warnings and copyright messages. If this is set,
Ace::Local will not do so. In this case you must call the low_read()
method until it returns undef in order to synchronize.
=back
=head2 query()
$status = $accessor->query('query string');
Makefile.PL view on Meta::CPAN
use Config;
use ExtUtils::MakeMaker qw(prompt WriteMakefile);
use File::Path;
require 5.8.0;
my $choice;
while (!$choice) {
$reply = prompt(
"\nWhat do you want to build?\n\n" .
" 1) Interface to Ace socket server and local databases (pure Perl)\n" .
" 2) The above plus XS optimizations (requires C compiler)\n" .
" 3) The above plus RPC server interface (requires C compiler)\n\n" .
"Enter your choice: ", "1");
if ($reply =~ /(\d+)/) {
$choice = $1;
die "invalid choice: $choice!" if $choice < 1 || $choice > 3;
}
}
$choice ||= 1; # safe default
my @extlib = ();
push @extlib,'Freesubs' if $choice >= 2;
push @extlib,'RPC' if $choice >= 3;
print "\n";
setup_sitedefs() if prompt("Do you want to install Ace::Browser? ","n") =~ /[yY]/;
my $headers = "./acelib/wh";
WriteMakefile(
'DISTNAME' => 'AcePerl',
'NAME' => 'Ace',
'VERSION_FROM' => 'Ace.pm', # finds $VERSION
'PMLIBDIRS' => ['GFF','Ace'],
'DIR' => \@extlib,
'DEFINE' => '',
'XSPROTOARG' => '-noprototypes',
Makefile.PL view on Meta::CPAN
chmod go+rwx $html_path/images
';
}
END
print qq(\n*** After "make install", run "make install-browser" to install acebrowser files. ***\n\n);
}
sub get_path {
my ($description,$pathref) = @_;
$$pathref = expand_twiddles(prompt("Directory for the $description (~username ok):",$$pathref));
return if -d $$pathref;
return if prompt("$$pathref does not exist. Shall I create it for you?",'y') !~ /[yY]/;
mkpath($$pathref) or warn "Couldn't create $$pathref. Please create it before installing.\n";
}
sub expand_twiddles {
my $path = shift;
my ($to_expand,$homedir);
return $path unless $path =~ m!^~([^/]*)!;
if ($to_expand = $1) {
$homedir = (getpwnam($to_expand))[7];
acebrowser/cgi-bin/generic/pic view on Meta::CPAN
}
END
;
PrintTop($obj,undef,$obj ? "Graphic display of: $obj" : "Graphic display",
'-Bgcolor' => '#FFFFFF', # important to have a white bg for the gifs
'-Style' => $style,
-Script => JSCRIPT
);
print_prompt();
AceNotFound() unless $obj;
display_object($obj,$click);
PrintBottom();
sub print_prompt {
print
start_form(-name=>'question'),
table(
TR (th('Name'),td(textfield(-name=>'name')),
th('Class'),td(textfield(-name=>'class',-size=>15,-onChange=>'document.question.submit()')),
td(submit({-style=>'background: white',-name=>'Change'}))),
),
end_form;
}
acebrowser/cgi-bin/generic/tree view on Meta::CPAN
unless ($obj) {
AceError(<<END) if param() && !param('name') && !param('class')
Call this script with URL parameters of
<VAR>name</VAR> and <VAR>class,</VAR> where
"name" and "class" correspond to the name and class of the
Ace object of interest.
END
}
PrintTop($obj);
print_prompt();
AceNotFound() unless $obj;
display_object($obj);
PrintBottom();
sub print_prompt {
print
start_form(-name=>'question'),
table(
TR (th('Name'),td(textfield(-name=>'name')),
th('Class'),td(textfield(-name=>'class',-size=>15,-onChange=>'document.question.submit()')),
td(submit({-style=>'background: white',-name=>'Change'}))),
),
end_form;
}
acebrowser/cgi-bin/moviedb/movie view on Meta::CPAN
use lib '..';
use vars '$DB';
use Ace 1.51;
use Ace::Browser::AceSubs;
use CGI 2.42 qw/:standard :html3 escape/;
my $movie = GetAceObject();
PrintTop($movie,'Movie');
print_prompt();
AceNotFound() unless $movie;
print_report($movie);
PrintBottom();
exit 0;
sub print_prompt {
print
start_form(),
p("Database ID",
textfield(-name=>'name'),
hidden(class=>'Movie'),
),
end_form;
}
sub print_report {
acebrowser/cgi-bin/moviedb/person view on Meta::CPAN
use strict;
use lib '..';
use vars '$DB';
use Ace 1.51;
use Ace::Browser::AceSubs;
use CGI 2.42 qw/:standard :html3 escape/;
my $person = GetAceObject();
PrintTop($person,'Person');
print_prompt();
AceNotFound() unless $person;
print_report($person);
PrintBottom();
sub print_prompt {
print
start_form({-name=>'form1',-action=>Url(url(-relative=>1))}),
p("Database ID",
hidden(class=>'Person'),
textfield(-name=>'name')
),
end_form;
}
sub print_report {
acelib/filsubs.c view on Meta::CPAN
UTIL_FUNC_DEF FILE *filqueryopen (char *dname, char *fname, char *end, char *spec, char *title)
{
Stack s ;
FILE* fil = 0 ;
int i ;
/* use registered routine if available */
if (queryOpenFunc)
return (*queryOpenFunc)(dname, fname, end, spec, title) ;
/* otherwise do here and use messprompt() */
s = stackCreate(50);
if (dname && *dname)
{ pushText(s, dname) ; catText(s,"/") ; }
if (fname)
catText(s,fname) ;
if (end && *end)
{ catText(s,".") ; catText(s,end) ; }
lao:
acelib/freeout.c view on Meta::CPAN
if (!isInitialised)
{ isInitialised = TRUE ;
outLevel = 0 ;
outCurr = 0 ;
outArray = arrayCreate (6, OUT) ;
freeOutSetFile (stdout) ;
outBuf = stackCreate (BUFSIZE) ;
messOutRegister (freeMessOut) ;
messErrorRegister (freeMessOut) ;
messExitRegister (freeMessOut) ;
/* what about prompt/query? */
}
}
/************************************************/
static int freeOutSetFileStack (FILE *fil, Stack s)
{ int i = 0 ;
freeOutInit () ;
while (array (outArray, i, OUT).magic) i++ ;
acelib/freesubs.c view on Meta::CPAN
answer != '\n')
answer = getchar () ;
return retval ;
}
else
return TRUE ;
}
/**********/
BOOL freeprompt (char *prompt, char *dfault, char *fmt)
{
if (isInteractive)
printf("%s ? > ",prompt);
freecard (0) ; /* just get a card */
if (freecheck (fmt))
return TRUE ;
else
{ messout ("input mismatch : format '%s' expected, card was\n%s",
fmt, card) ;
return FALSE ;
}
}
acelib/messubs.c view on Meta::CPAN
/***************************************************************/
/********* call backs and functions to register them ***********/
static VoidRoutine beepRoutine = 0 ;
static OutRoutine outRoutine = 0 ;
static OutRoutine dumpRoutine = 0 ;
static OutRoutine errorRoutine = 0 ;
static OutRoutine exitRoutine = 0 ;
static OutRoutine crashRoutine = 0 ;
static QueryRoutine queryRoutine = 0 ;
static PromptRoutine promptRoutine = 0 ;
static IsInterruptRoutine isInterruptRoutine = 0 ;
UTIL_FUNC_DEF VoidRoutine messBeepRegister (VoidRoutine func)
{ VoidRoutine old = beepRoutine ; beepRoutine = func ; return old ; }
UTIL_FUNC_DEF OutRoutine messOutRegister (OutRoutine func)
{ OutRoutine old = outRoutine ; outRoutine = func ; return old ; }
UTIL_FUNC_DEF OutRoutine messDumpRegister (OutRoutine func)
{ OutRoutine old = dumpRoutine ; dumpRoutine = func ; return old ; }
acelib/messubs.c view on Meta::CPAN
UTIL_FUNC_DEF OutRoutine messExitRegister (OutRoutine func)
{ OutRoutine old = exitRoutine ; exitRoutine = func ; return old ; }
UTIL_FUNC_DEF OutRoutine messCrashRegister (OutRoutine func)
{ OutRoutine old = crashRoutine ; crashRoutine = func ; return old ; }
UTIL_FUNC_DEF QueryRoutine messQueryRegister (QueryRoutine func)
{ QueryRoutine old = queryRoutine ; queryRoutine = func ; return old ; }
UTIL_FUNC_DEF PromptRoutine messPromptRegister (PromptRoutine func)
{ PromptRoutine old = promptRoutine ; promptRoutine = func ; return old ; }
UTIL_FUNC_DEF IsInterruptRoutine messIsInterruptRegister (IsInterruptRoutine func)
{ IsInterruptRoutine old = isInterruptRoutine ; isInterruptRoutine = func ; return old ; }
/***************************************************/
UTIL_FUNC_DEF BOOL messIsInterruptCalled (void)
{
if (isInterruptRoutine)
acelib/messubs.c view on Meta::CPAN
if (outRoutine)
(*outRoutine)(mesg_buf) ;
else
fprintf (stdout, "//!! %s\n", mesg_buf) ;
}
/*****************************/
UTIL_FUNC_DEF BOOL messPrompt (char *prompt, char *dfault, char *fmt)
{
BOOL answer ;
if (promptRoutine)
answer = (*promptRoutine)(prompt, dfault, fmt) ;
else
answer = freeprompt (prompt, dfault, fmt) ;
return answer ;
}
/*****************************/
UTIL_FUNC_DEF BOOL messQuery (char *format,...)
{
BOOL answer ;
char *mesg_buf = NULL ;
acelib/wh/regular.h view on Meta::CPAN
UTIL_FUNC_DCL BOOL freekey (KEY *kpt, FREEOPT *options) ;
UTIL_FUNC_DCL BOOL freekeymatch (char *text, KEY *kpt, FREEOPT *options) ;
UTIL_FUNC_DCL void freemenu (void (*proc)(KEY), FREEOPT *options) ;
UTIL_FUNC_DCL char *freekey2text (KEY k, FREEOPT *o) ; /* Return text corresponding to key */
UTIL_FUNC_DCL BOOL freeselect (KEY *kpt, FREEOPT *options) ;
UTIL_FUNC_DCL BOOL freelevelselect (int level,
KEY *kpt, FREEOPT *options);
UTIL_FUNC_DCL void freedump (FREEOPT *options) ;
UTIL_FUNC_DCL BOOL freestep (char x) ;
UTIL_FUNC_DCL void freenext (void) ;
UTIL_FUNC_DCL BOOL freeprompt (char *prompt, char *dfault, char *fmt) ;/* gets a card */
UTIL_FUNC_DCL BOOL freecheck (char *fmt) ; /* checks remaining card fits fmt */
UTIL_FUNC_DCL int freefmtlength (char *fmt) ;
UTIL_FUNC_DCL BOOL freequery (char *query) ;
UTIL_FUNC_DCL char *freepos (void) ; /* pointer to present position in card */
UTIL_FUNC_DCL char *freeprotect (char* text) ; /* protect so freeword() reads correctly */
UTIL_FUNC_DCL char* freeunprotect (char *text) ; /* reverse of protect, removes \ etc */
UTIL_VAR_DCL char FREE_UPPER[] ;
#define freeupper(x) (FREE_UPPER[(x) & 0xff]) /* table is only 128 long */
acelib/wh/regular.h view on Meta::CPAN
UTIL_FUNC_DCL void messbeep (void) ; /* make a beep */
UTIL_FUNC_DCL void messout (char *format, ...) ; /* simple message */
UTIL_FUNC_DCL void messdump (char *format, ...) ; /* write to log file */
UTIL_FUNC_DCL void messerror (char *format, ...) ; /* error message and write to log file */
UTIL_FUNC_DCL void messExit(char *format, ...) ; /* error message, write to log file & exit */
#define messcrash uMessSetErrorOrigin(__FILE__, __LINE__), uMessCrash
/* abort - but see below */
UTIL_FUNC_DCL BOOL messQuery (char *text,...) ; /* ask yes/no question */
UTIL_FUNC_DCL BOOL messPrompt (char *prompt, char *dfault, char *fmt) ;
/* ask for data satisfying format get results via freecard() */
UTIL_FUNC_DCL char* messSysErrorText (void) ;
/* wrapped system error message for use in messerror/crash() */
UTIL_FUNC_DCL int messErrorCount (void);
/* return numbers of error so far */
UTIL_FUNC_DCL BOOL messIsInterruptCalled (void);
/* return TRUE if an interrupt key has been pressed */
acelib/wh/regular.h view on Meta::CPAN
/*******************************************************************/
/************* some WIN32 debugging utilities **********************/
#if defined (WIN32)
#if defined(_DEBUG)
/* See win32util.cpp for these functions */
UTIL_FUNC_DCL const char *dbgPos( const char *caller, int lineno, const char *called ) ;
UTIL_FUNC_DCL void WinTrace(char *prompt, unsigned long code) ;
UTIL_FUNC_DCL void AceASSERT(int condition) ;
UTIL_FUNC_DCL void NoMemoryTracking() ;
#else /* !defined(_DEBUG) */
#define dbgPos(c,l,fil) (const char *)(fil)
#endif /* !defined(_DEBUG) */
#endif /* defined(WIN32) */
#endif /* defined(DEF_REGULAR_H) */
/******************************* End of File **********************************/
docs/ACEDB.HOWTO view on Meta::CPAN
// #### Working dir=/usr/local/acedb/elegans/
// #### clientTimeout=600 serverTimeout=600 maxbytes=102400 autoSaveInterval=600
The messages will stop, indicating that the server is waiting for
incoming connections.
In the other window, launch saceclient with this command:
% ~acedb/bin/saceclient localhost -port 5000
It will prompt you for a userid (type "admin") and a password (type
the password). If all goes well, you will get this prompt:
acedb@localhost>
and the server will accept queries. For example, try the command
"Find Model".
3) Try to communicate with the server using aceperl.
When you installed AcePerl, it should have installed a small interface
script named ace.pl. Confirm that it can talk to the server:
% ace.pl -host localhost -port 5000
By default, you will get an "anonymous" read only connection, and you
will see the prompt:
aceperl>
indicating that the database is ready to accept queries.
4) Shut down the server.
When you are ready, shut down the server like this:
% ace.pl -host localhost -port 5000 -user admin -pass acepass
docs/NEW_DB.HOWTO view on Meta::CPAN
interactive xace tool is this:
1) create a directory with the database's name
2) within that directory create a directory named "wspec" (where
the schema lives) and another named "database"
3) populate the wspec subdirectory with the schema files,
which you can copy from another database, such as
the C. elegans database
4) run xace, giving it the database's directory as its
command-line argument
5) xace will prompt you to reinitialize the database, say "OK"
6) using the edit menu, select "read .ace" file. Say "yes"
when prompted for write access
7) choose "Open ace file" from the dialog box, and locate
the file you wish to load
8) select "Read all"
9) when done, close the window and select "Save..." from the
main xace window
Read other .ace files in the same way.
Rather than launching xace, you can do it all with tace. Lines
surrounded by <angle brackets> represent user input: