From 922491a8991b68b8e51f258ed20d015f2db96cee Mon Sep 17 00:00:00 2001 From: Graham Barr Date: Tue, 29 May 2001 12:40:05 +0000 Subject: Remove DummyInetd --- MANIFEST | 2 - Net/DummyInetd.pm | 152 ------------------------------------------------------ 2 files changed, 154 deletions(-) delete mode 100644 Net/DummyInetd.pm diff --git a/MANIFEST b/MANIFEST index 5852cec..9d93a4e 100644 --- a/MANIFEST +++ b/MANIFEST @@ -7,7 +7,6 @@ Makefile.PL Net/Cmd.pm Net/Config.pm Net/Domain.pm DNS Domain name lookup -Net/DummyInetd.pm Net/FTP.pm File Transfer Protocol Client Net/FTP/A.pm Net/FTP/E.pm @@ -31,7 +30,6 @@ demos/time htdocs/Net/Cmd.html htdocs/Net/Config.html htdocs/Net/Domain.html -htdocs/Net/DummyInetd.html htdocs/Net/FTP.html htdocs/Net/NNTP.html htdocs/Net/Netrc.html diff --git a/Net/DummyInetd.pm b/Net/DummyInetd.pm deleted file mode 100644 index 7d170df..0000000 --- a/Net/DummyInetd.pm +++ /dev/null @@ -1,152 +0,0 @@ -# Net::DummyInetd.pm -# -# Copyright (c) 1995-1997 Graham Barr . All rights reserved. -# This program is free software; you can redistribute it and/or -# modify it under the same terms as Perl itself. - -package Net::DummyInetd; - -require 5.002; - -use IO::Handle; -use IO::Socket; -use strict; -use vars qw($VERSION); -use Carp; - -$VERSION = "1.06"; # $Id: //depot/libnet/Net/DummyInetd.pm#5 $ - - -sub _process -{ - my $listen = shift; - my @cmd = @_; - my $vec = ''; - my $r; - - vec($vec,fileno($listen),1) = 1; - - while(select($r=$vec,undef,undef,undef)) - { - my $sock = $listen->accept; - my $pid; - - if($pid = fork()) - { - sleep 1; - close($sock); - } - elsif(defined $pid) - { - my $x = IO::Handle->new_from_fd($sock,"r"); - open(STDIN,"<&=".fileno($x)) || die "$! $@"; - close($x); - - my $y = IO::Handle->new_from_fd($sock,"w"); - open(STDOUT,">&=".fileno($y)) || die "$! $@"; - close($y); - - close($sock); - exec(@cmd) || carp "$! $@"; - } - else - { - close($sock); - carp $!; - } - } - exit -1; -} - -sub new -{ - my $self = shift; - my $type = ref($self) || $self; - - my $listen = IO::Socket::INET->new(Listen => 5, Proto => 'tcp'); - my $pid; - - return bless [ $listen->sockport, $pid ] - if($pid = fork()); - - _process($listen,@_); -} - -sub port -{ - my $self = shift; - $self->[0]; -} - -sub DESTROY -{ - my $self = shift; - kill 9, $self->[1]; -} - -1; - -__END__ - -=head1 NAME - -Net::DummyInetd - A dummy Inetd server - -=head1 SYNOPSIS - - use Net::DummyInetd; - use Net::SMTP; - - $inetd = new Net::DummyInetd qw(/usr/lib/sendmail -ba -bs); - - $smtp = Net::SMTP->new('localhost', Port => $inetd->port); - -=head1 DESCRIPTION - -C is just what it's name says, it is a dummy inetd server. -Creation of a C will cause a child process to be spawned off -which will listen to a socket. When a connection arrives on this socket -the specified command is fork'd and exec'd with STDIN and STDOUT file -descriptors duplicated to the new socket. - -This package was added as an example of how to use C to connect -to a C process, which is not the default, via SIDIN and STDOUT. -A C package may be available in a future release of C - -=head1 CONSTRUCTOR - -=over 4 - -=item new ( CMD ) - -Creates a new object and spawns a child process which listens to a socket. -C is a list, which will be passed to C when a new process needs -to be created. - -=back - -=head1 METHODS - -=over 4 - -=item port - -Returns the port number on which the I object is listening - -=back - -=head1 AUTHOR - -Graham Barr - -=head1 COPYRIGHT - -Copyright (c) 1995-1997 Graham Barr. All rights reserved. -This program is free software; you can redistribute it and/or modify -it under the same terms as Perl itself. - -=for html
- -I<$Id: //depot/libnet/Net/DummyInetd.pm#5 $> - -=cut -- cgit v1.2.3-24-ge0c7