Another crazy idea.

> -----Original Message-----
> From: McMahon, Chris [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, October 22, 2003 3:24 PM
> To: [EMAIL PROTECTED]
> Subject: help with Very Small Perl? 
> 
> 
>  
>  
> Hello...
> I am booting a FreeBSD system from the network via PXE.
> On that FreeBSD system is Perl 5.005.  
> I want to use the IO::Socket::INET module in a script on that 
> system. (But
> I'd settle for Socket.pm)   
> The kicker is that the entire root filesystem must be less 
> than 50 megs.
> The other kicker is that I don't have a 5.005 installation to 
> copy from. 
> So I don't have room to install a whole Perl 5.8.  I spent a few hours
> trying to run my script; copy in the module it failed on; 
> hack the good code
> in that module; repeat:  but I eventually lost my mind trying 
> to find all
> the things that IO::Socket::INET requires.
> Can anyone suggest either:  a way to make IO::Socket::INET work in the
> simplest possible way on 5.005; or a way to install the 
> smallest possible
> 5.8; or something I haven't thought of?   
> Any suggestion (no matter how crazy!) is welcome...
> -Chris       

I also have 1 system where I cannot upgrade perl, it is 5.001, and I cannot
add modules, even locally.
  
So, I used the low level socket routines to write to the remote system like
so:

use Socket;

...

my $port = 50001;

socket(SOCK,PF_INET,SOCK_STREAM,getprotobyname('tcp'))
        or LogAndDie($logF, "Cannot make socket: $!");
my @inet_addr = (192,10,10,10);
my $packed_addr = pack('S n C4 x8',PF_INET,$port,@inet_addr);
connect(SOCK,$packed_addr) or LogAndDie($logF, "Cannot connect: $!");
no strict "refs";
my $oldfh = select(SOCK);
$| = 1; # autoflush the old fashioned way
select($oldfh);
use strict "refs";

...

print SOCK, "$whatever\n";

This is on a RISC processor, I think you may need to pack differently on
Intel, but I'm not sure, I haven't tried it.

-Mark

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to