home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-perl-addon-1.4.9-installer.exe / dbiproxy.bat < prev    next >
Encoding:
DOS Batch File  |  2004-07-06  |  5.7 KB  |  199 lines

  1. @rem = '--*-Perl-*--
  2. @echo off
  3. if "%OS%" == "Windows_NT" goto WinNT
  4. perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
  5. goto endofperl
  6. :WinNT
  7. perl -x -S %0 %*
  8. if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
  9. if %errorlevel% == 9009 echo You do not have Perl in your PATH.
  10. if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
  11. goto endofperl
  12. @rem ';
  13. #!perl
  14. #line 15
  15.  
  16. use strict;
  17.  
  18. my $arg_test    = shift(@ARGV)        if $ARGV[0] eq '--test';
  19. $ENV{DBI_TRACE} = shift(@ARGV) || 2    if $ARGV[0] =~ s/^--dbitrace=?//;
  20.  
  21. require DBI::ProxyServer;
  22.  
  23. # XXX these should probably be moved into DBI::ProxyServer
  24. delete $ENV{IFS};
  25. delete $ENV{CDPATH};
  26. delete $ENV{ENV};
  27. delete $ENV{BASH_ENV};
  28.  
  29. if ($arg_test) {
  30.     require RPC::PlServer::Test;
  31.     @DBI::ProxyServer::ISA = qw(RPC::PlServer::Test DBI);
  32. }
  33.  
  34. DBI::ProxyServer::main(@ARGV);
  35.  
  36. exit(0);
  37.  
  38.  
  39. __END__
  40.  
  41. =head1 NAME
  42.  
  43. dbiproxy - A proxy server for the DBD::Proxy driver
  44.  
  45.  
  46. =head1 SYNOPSIS
  47.  
  48.     dbiproxy <options> --localport=<port>
  49.  
  50.  
  51. =head1 DESCRIPTION
  52.  
  53. This tool is just a front end for the DBI::ProxyServer package. All it
  54. does is picking options from the command line and calling
  55. DBI::ProxyServer::main(). See L<DBI::ProxyServer(3)> for details.
  56.  
  57. Available options include:
  58.  
  59. =over 4
  60.  
  61. =item B<--chroot=dir>
  62.  
  63. (UNIX only)  After doing a bind(), change root directory to the given
  64. directory by doing a chroot(). This is usefull for security, but it
  65. restricts the environment a lot. For example, you need to load DBI
  66. drivers in the config file or you have to create hard links to Unix
  67. sockets, if your drivers are using them. For example, with MySQL, a
  68. config file might contain the following lines:
  69.  
  70.     my $rootdir = '/var/dbiproxy';
  71.     my $unixsockdir = '/tmp';
  72.     my $unixsockfile = 'mysql.sock';
  73.     foreach $dir ($rootdir, "$rootdir$unixsockdir") {
  74.     mkdir 0755, $dir;
  75.     }
  76.     link("$unixsockdir/$unixsockfile",
  77.      "$rootdir$unixsockdir/$unixsockfile");
  78.     require DBD::mysql;
  79.  
  80.     {
  81.     'chroot' => $rootdir,
  82.     ...
  83.     }
  84.  
  85. If you don't know chroot(), think of an FTP server where you can see a
  86. certain directory tree only after logging in. See also the --group and
  87. --user options.
  88.  
  89. =item B<--configfile=file>
  90.  
  91. Config files are assumed to return a single hash ref that overrides the
  92. arguments of the new method. However, command line arguments in turn take
  93. precedence over the config file. See the L<"CONFIGURATION FILE"> section
  94. below for details on the config file.
  95.  
  96. =item B<--debug>
  97.  
  98. Turn debugging mode on. Mainly this asserts that logging messages of
  99. level "debug" are created.
  100.  
  101. =item B<--facility=mode>
  102.  
  103. (UNIX only) Facility to use for L<Sys::Syslog (3)>. The default is
  104. B<daemon>.
  105.  
  106. =item B<--group=gid>
  107.  
  108. After doing a bind(), change the real and effective GID to the given.
  109. This is usefull, if you want your server to bind to a privileged port
  110. (<1024), but don't want the server to execute as root. See also
  111. the --user option.
  112.  
  113. GID's can be passed as group names or numeric values.
  114.  
  115. =item B<--localaddr=ip>
  116.  
  117. By default a daemon is listening to any IP number that a machine
  118. has. This attribute allows to restrict the server to the given
  119. IP number.
  120.  
  121. =item B<--localport=port>
  122.  
  123. This attribute sets the port on which the daemon is listening. It
  124. must be given somehow, as there's no default.
  125.  
  126. =item B<--logfile=file>
  127.  
  128. Be default logging messages will be written to the syslog (Unix) or
  129. to the event log (Windows NT). On other operating systems you need to
  130. specify a log file. The special value "STDERR" forces logging to
  131. stderr. See L<Net::Daemon::Log(3)> for details.
  132.  
  133. =item B<--mode=modename>
  134.  
  135. The server can run in three different modes, depending on the environment.
  136.  
  137. If you are running Perl 5.005 and did compile it for threads, then the
  138. server will create a new thread for each connection. The thread will
  139. execute the server's Run() method and then terminate. This mode is the
  140. default, you can force it with "--mode=threads".
  141.  
  142. If threads are not available, but you have a working fork(), then the
  143. server will behave similar by creating a new process for each connection.
  144. This mode will be used automatically in the absence of threads or if
  145. you use the "--mode=fork" option.
  146.  
  147. Finally there's a single-connection mode: If the server has accepted a
  148. connection, he will enter the Run() method. No other connections are
  149. accepted until the Run() method returns (if the client disconnects).
  150. This operation mode is usefull if you have neither threads nor fork(),
  151. for example on the Macintosh. For debugging purposes you can force this
  152. mode with "--mode=single".
  153.  
  154. =item B<--pidfile=file>
  155.  
  156. (UNIX only) If this option is present, a PID file will be created at the
  157. given location.
  158.  
  159. =item B<--user=uid>
  160.  
  161. After doing a bind(), change the real and effective UID to the given.
  162. This is usefull, if you want your server to bind to a privileged port
  163. (<1024), but don't want the server to execute as root. See also
  164. the --group and the --chroot options.
  165.  
  166. UID's can be passed as group names or numeric values.
  167.  
  168. =item B<--version>
  169.  
  170. Supresses startup of the server; instead the version string will
  171. be printed and the program exits immediately.
  172.  
  173. =back
  174.  
  175.  
  176. =head1 AUTHOR
  177.  
  178.     Copyright (c) 1997    Jochen Wiedmann
  179.                           Am Eisteich 9
  180.                           72555 Metzingen
  181.                           Germany
  182.  
  183.                           Email: joe@ispsoft.de
  184.                           Phone: +49 7123 14881
  185.  
  186. The DBI::ProxyServer module is free software; you can redistribute it
  187. and/or modify it under the same terms as Perl itself. In particular
  188. permission is granted to Tim Bunce for distributing this as a part of
  189. the DBI.
  190.  
  191.  
  192. =head1 SEE ALSO
  193.  
  194. L<DBI::ProxyServer(3)>, L<DBD::Proxy(3)>, L<DBI(3)>
  195.  
  196.  
  197. __END__
  198. :endofperl
  199.