HELP: Finger script won't run on NT Perl 5.001 
Author Message
 HELP: Finger script won't run on NT Perl 5.001

I've been experimenting with writing Perl scripts that use sockets and
have chosen to begin with a simple Finger program.

I adapted the following code from something on CPAN and ran it on DEC
ULTRIX running Perl 5.001. It worked without a hitch. When I then ran
the exact same script (changing just the package name from Socket to
Winsock) on my NT workstation running NT Perl 5.001, it runs without
error, but it simply does not return any finger information. Is this a
bug in NT Perl or in my script?

Thanks ahead of time for any assistance you can lend.

Marc Jacobs
Information Technology Customer Services
University of Houston

--begin script--
#!/usr/bin/perl
use Winsock;
#use Socket;

sub mkport {

    local( $stemplate, $sock_struct );
    $stemplate = 'S n a4 x8';
    $sock_struct = pack( $stemplate, AF_INET, $dest_port, $dest_addr
);
    socket( FINGER_SERVER, AF_INET, SOCK_STREAM, IPPROTO_TCP ) ||
        return "socket:$!";
    connect( FINGER_SERVER, $sock_struct ) || return "connect:$!";
    select( FINGER_SERVER ); $|=1;
    select( STDOUT ); $|=1;
    return "OK";

Quote:
}


($name, $aliases, $port) = getservbyname("finger", 'tcp');
($name, $aliases, $type, $len, $thisaddr) = gethostbyname($node);
print "\n[$name]\n";
$status = &mkport($thisaddr, $port);
if ($status ne "OK") {
    print "$node:$status\n";
    next;
Quote:
} else {

    print FINGER_SERVER "$uname\r\n";
    while (<FINGER_SERVER>) {
        s/\015//;
        print "$_";
    }
    close FINGER_SERVER;
Quote:
}



Mon, 27 Apr 1998 03:00:00 GMT  
 HELP: Finger script won't run on NT Perl 5.001

Quote:

>I adapted the following code from something on CPAN and ran it on DEC
>ULTRIX running Perl 5.001. It worked without a hitch. When I then ran
>the exact same script (changing just the package name from Socket to
>Winsock) on my NT workstation running NT Perl 5.001, it runs without
>error, but it simply does not return any finger information. Is this a
>bug in NT Perl or in my script?

The code below uses a socket as a file handle.  Are you using an NTPerl
interpreter that was compiled with that feature enabled?  The distribution 0.90
and 0.91 binaries for i86 come with that disabled, attributed to Win95 problems.

Quote:
>    print FINGER_SERVER "$uname\r\n";
>    while (<FINGER_SERVER>) {

This may not be the only factor involved.  Winsock is not exactly Berkeley
sockets.

However, with NTPerl under Win95 I got everything of a basic Unix sockets
example program to work except the parts dependent on file-handleness of
sockets.  The alternative without f-h enabled is to use send() and recv().
send() is not so bad but recv() looks like a pain to apply in a program built
around line input.

-- SP



Wed, 29 Apr 1998 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Help: How to add users for Win NT thru Perl 5.001

2. Please Help:My script runs on win32, it won't run on Unix

3. Please Help: My script runs on win32, it won't run on Unix

4. PERL 5.001 on WIN NT 4.0 with IIS 3.0

5. Perl, version 5.001 Win 95 /NT?

6. My script runs on win32, it won't run on Unix

7. perl 4 script that won't run under perl 5

8. 5.001 won't compile on hp-ux

9. script won't run...displays script text

10. Perl CGI scripts won't run without -w switch (under Apache 1.3.x)

11. Perl scripts won't run on Linux

 

 
Powered by phpBB® Forum Software