source: gs2-extensions/tdb-edit/trunk/src/bin/script/TDBClient.pl@ 26988

Last change on this file since 26988 was 26988, checked in by jmt12, 11 years ago

Replaced hardcoded 'localhost' with hostname as variable

  • Property svn:executable set to *
File size: 1.8 KB
Line 
1#!/usr/bin/perl
2
3# Setup Environment
4BEGIN
5{
6 die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};
7 die "GSDLOS not set\n" unless defined $ENV{'GSDLOS'};
8
9 unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
10 unshift (@INC, "$ENV{'GSDLHOME'}/perllib/cpan");
11 unshift (@INC, "$ENV{'GSDLHOME'}/perllib/cpan/XML/XPath");
12 unshift (@INC, "$ENV{'GSDLHOME'}/perllib/plugins");
13 unshift (@INC, "$ENV{'GSDLHOME'}/perllib/classify");
14
15 if (defined $ENV{'GSDLEXTS'})
16 {
17 my @extensions = split(/:/,$ENV{'GSDLEXTS'});
18 foreach my $e (@extensions)
19 {
20 my $ext_prefix = "$ENV{'GSDLHOME'}/ext/$e";
21 unshift (@INC, "$ext_prefix/perllib");
22 unshift (@INC, "$ext_prefix/perllib/cpan");
23 unshift (@INC, "$ext_prefix/perllib/plugins");
24 unshift (@INC, "$ext_prefix/perllib/classify");
25 }
26 }
27 if (defined $ENV{'GSDL3EXTS'})
28 {
29 my @extensions = split(/:/,$ENV{'GSDL3EXTS'});
30 foreach my $e (@extensions)
31 {
32 my $ext_prefix = "$ENV{'GSDL3SRCHOME'}/ext/$e";
33 unshift (@INC, "$ext_prefix/perllib");
34 unshift (@INC, "$ext_prefix/perllib/cpan");
35 unshift (@INC, "$ext_prefix/perllib/plugins");
36 unshift (@INC, "$ext_prefix/perllib/classify");
37 }
38 }
39
40 # Manually installed CPAN package in GEXT*INSTALL
41 unshift (@INC, $ENV{'GEXTPARALLELBUILDING_INSTALLED'} . "/share/perl/5.12.4");
42}
43
44use strict;
45use warnings;
46
47use SocketsSwimmingThreadPoolClient;
48my $host = shift;
49my $port = shift;
50my $message = shift;
51die "Usage: perl client.pl <host> <port> <string>\n" unless defined($message) && defined($port);
52my $c= SocketsSwimmingThreadPoolClient->new(host=>$host,
53 port=>$port
54 );
55print "Contacting server on $host:$port\n";
56print "Sent: |$message|\n";
57print "Recv: |" . $c->query($message) . "|\n\n";
58exit;
Note: See TracBrowser for help on using the repository browser.