AcePerl

 view release on metacpan or  search on metacpan

Ace.pm  view on Meta::CPAN

Name of user to log in as (when using socket server B<only>).  If not
provided, will attempt an anonymous login.

=item B<-pass>

Password to log in with (when using socket server).

=item B<-url>

An Acedb URL that combines the server type, host, port, user and
password in a single string.  See the connect() method's "single
argument form" description.

=item B<-cache>

AcePerl can use the Cache::SizeAwareFileCache module to cache objects
to disk. This can result in dramatically increased performance in
environments such as web servers in which the same Acedb objects are
frequently reused.  To activate this mechanism, the
Cache::SizeAwareFileCache module must be installed, and you must pass
the -cache argument during the connect() call.

Ace/Browser/AceSubs.pm  view on Meta::CPAN

use Carp 'cluck';

################ open a database #################
sub OpenDatabase {
  my $name = shift || get_symbolic();
  AceInit();
  $name =~ s!/$!!;
  my $db = $DB{$name};
  return $db if $db && $db->ping;

  my ($host,$port,$user,$password,
      $cache_root,$cache_size,$cache_expires,$auto_purge_interval)
    = getDatabasePorts($name);
  my @auth  = (-user=>$user,-pass=>$password) if $user && $password;
  my @cache = (-cache => { cache_root=>$cache_root,
			   max_size            => $cache_size || $Cache::SizeAwareCache::NO_MAX_SIZE || -1,  # hardcoded $NO_MAX_SIZE constant
			   default_expires_in  => $cache_expires       || '1 day',
			   auto_purge_interval => $auto_purge_interval || '6 hours',
			 } 
	      ) if $cache_root;
  $DB{$name} = Ace->connect(-host=>$host,-port=>$port,-timeout=>50,@auth,@cache);
  return $DB{$name};
}

Ace/SocketServer.pm  view on Meta::CPAN

use strict;
use Carp 'croak','cluck';
use Ace qw(rearrange STATUS_WAITING STATUS_PENDING STATUS_ERROR);
use IO::Socket;
use Digest::MD5 'md5_hex';

use vars '$VERSION';
$VERSION = '1.01';

use constant DEFAULT_USER    => 'anonymous';  # anonymous user
use constant DEFAULT_PASS    => 'guest';      # anonymous password
use constant DEFAULT_TIMEOUT => 120;          # two minute timeout on queries

# header information
use constant HEADER => 'L5a30';
use constant HEADER_LEN => 5*4+30;
use constant ACESERV_MSGREQ   => "ACESERV_MSGREQ";
use constant ACESERV_MSGDATA  => "ACESERV_MSGDATA";
use constant WORDORDER_MAGIC => 0x12345678;

# Server only, it may just be sending or a reply or it may be sending an

Ace/SocketServer.pm  view on Meta::CPAN

  }
  $self->{status} = STATUS_PENDING;
  return 1;
}
sub _handshake {
  my $self = shift;
  my ($user,$pass) = @_;
  $self->_send_msg(ACESERV_CLIENT_HELLO);
  my ($msg,$nonce) = $self->_recv_msg('strip');
  return unless $msg eq ACESERV_MSGOK;
  # hash username and password
  my $authdigest = md5_hex(md5_hex($user . $pass).$nonce);
  $self->_send_msg("$user $authdigest");
  my $body;
  ($msg,$body) = $self->_recv_msg('strip');
  return _error("server: $body") unless $body eq ACESERV_SERVER_HELLO;
  return 1;
}

sub _send_msg {
  my ($self,$msg,$parse) = @_;

README.ACEBROWSER  view on Meta::CPAN


This is the network port on which the desired acedb server is
listening.  Network ports in the range 1024-65535 are assumed to
correspond to the newer socket-based sgifaceserver.  Ports in the
range 65536-4,294,967,296 are assumed to correspond to the older
RPC-based gifaceserver.

 $USERNAME = '';
 $PASSWORD = '';

For password-protected ACEDB databases, these variables contain the
username and password.

 $STYLESHEET = "$DOCROOT/stylesheets/aceperl.css";

This is the cascading stylesheet used to set the background color,
font, table colors, and so forth.  You probably don't need to change
this, but you might want to modify the stylesheet itself.

 @PICTURES = ($IMAGES => "$HTML_PATH/images");

This array indicates the location of the "images" subdirectory.  The

docs/ACEDB.HOWTO  view on Meta::CPAN

"sgifaceserver."

A full description of installing s(gif)aceserver is given in the ACEDB
web pages at:

  http://www.acedb.org/Development/wdoc/Socket_Server/SOCKET_aceserver.html

However, it is a rather technical description.  Here's a brief summary
of what you need to do:

1) Set up server password permissions:
	a. Choose an administrative username and password.  For example "admin"
	   and "acepass"

	b. Generate a "hash" of the username and password using the makeUserPasswd
	   program (this comes with the acedb binaries):
               % makeUserPasswd admin
		// Please enter passwd: ******
		// Please re-enter passwd: ******
		// The following line is a valid entry for wspec/serverpasswd.wrm

		admin e5cc20aa1a8f3e7e5b29728bbd1355d8

        c. Find the file named serverpasswd.wrm located in the wspec/ subdirectory
	   of the acedb database directory.  Add these two lines to the end of the file:

                admin: admin
	        admin e5cc20aa1a8f3e7e5b29728bbd1355d8

            The first line tells the server that the "admin" user has administrative
            access, and can start and stop the server.  The second line says that
	    "admin" has the password encoded in the numbers.

        d. If you want to create additional users with read-only or read/write,
           permissions, you can do so by generating more user names and password
	   hashes with makeUserPasswd, and entering them into the serverpasswd.wrm
	   file as described before.  Here is an example that grants "fred" and "ethel"
           read/write access, and grants "ricky" read-only access:

           admin: admin
           write: fred ethel
           read: ricky

 	   admin e5cc20aa1a8f3e7e5b29728bbd1355d8
           fred 08b622ddf7eb7c8e44cdb3bd6362f966

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:

examples/ace.pl  view on Meta::CPAN

use constant DEBUG => 0;

my ($HOST,$PORT,$PATH,$TCSH,$URL,$AUTOSAVE,$USER,$PASS,@EXEC);
GetOptions('host=s' => \$HOST,
	   'port=i' => \$PORT,
	   'path=s' => \$PATH,
	   'tcsh'   => \$TCSH,
	   'url'    => \$URL,
	   'login:s'  => \$USER,
	   'user:s'   => \$USER,
	   'password:s' => \$PASS,
	   'save'   => \$AUTOSAVE,
	   'exec=s' => \@EXEC,
	  ) || die <<USAGE;
Usage: $0 [options] [URL]
Interactive Perl client for ACEDB

Options (can be abbreviated):
       -host <hostname>  Server host (localhost)
       -port <port>      Server port (200005)
       -path <db path>   Local database path (no default)

examples/ace.pl  view on Meta::CPAN

    $h=~s/\0+\Z//; # get rid of nulls in data stream!
    print $h;
  }
}

sub get_passwd {
  my $user = shift;
  local $| = 1;
  chomp(my $settings = `stty -g </dev/tty`);
  system "stty -echo </dev/tty";
  print $ENV{EMACS} ? "password: " : "$user password: ";
  chomp(my $password = <STDIN>);
  print "\n";
  system "stty $settings </dev/tty";
  return $password;
}

util/ace.PLS  view on Meta::CPAN

use constant DEBUG => 0;

my ($HOST,$PORT,$PATH,$TCSH,$URL,$AUTOSAVE,$USER,$PASS,@EXEC);
GetOptions('host=s' => \$HOST,
	   'port=i' => \$PORT,
	   'path=s' => \$PATH,
	   'tcsh'   => \$TCSH,
	   'url'    => \$URL,
	   'login:s'  => \$USER,
	   'user:s'   => \$USER,
	   'password:s' => \$PASS,
	   'save'   => \$AUTOSAVE,
	   'exec=s' => \@EXEC,
	  ) || die <<USAGE;
Usage: $0 [options] [URL]
Interactive Perl client for ACEDB

Options (can be abbreviated):
       -host <hostname>  Server host (localhost)
       -port <port>      Server port (200005)
       -path <db path>   Local database path (no default)

util/ace.PLS  view on Meta::CPAN

    $h=~s/\0+\Z//; # get rid of nulls in data stream!
    print $h;
  }
}

sub get_passwd {
  my $user = shift;
  local $| = 1;
  chomp(my $settings = `stty -g </dev/tty`);
  system "stty -echo </dev/tty";
  print $ENV{EMACS} ? "password: " : "$user password: ";
  chomp(my $password = <STDIN>);
  print "\n";
  system "stty $settings </dev/tty";
  return $password;
}
__END__
!NO!SUBS!
close OUT or die "Can't close $file: $!";
chmod 0755, $file or die "Can't reset permissions for $file: $!\n";
exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';
chdir $origdir;



( run in 0.505 second using v1.01-cache-2.11-cpan-49f99fa48dc )