Thanks! I can't find the file anywhere and I'm on NT. What would the name of this be (or equivalent) be on NT? Plus, as a "FYI", what does this file do? Thanks!
-----Original Message----- From: bob ackerman [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 16, 2002 3:02 PM To: [EMAIL PROTECTED] Subject: Re: Errors Running Learning Perl in Win32 Scripts On Tuesday, April 16, 2002, at 11:18 AM, Anthony Beaman wrote: > I did this and I'm now getting the following error: > > IO::Socket::INET: Unknown error at 415b.pl line 2 > Can't connect to daytime port at localhost at 415b.pl line 2. > > That's what I was getting last night (I changed various things and > compiled but got various errors each time). The problem, to me, lies with > the IO::Socket::INET statement (correct?). Any ideas? Thanks! > the daytime service has to be enabled. usually means uncommenting it in inetd.conf file. usually find it in /etc directory. > -----Original Message----- > From: bob ackerman [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, April 16, 2002 1:13 PM > To: [EMAIL PROTECTED] > Subject: Re: Errors Running Learning Perl in Win32 Scripts > > > On Tuesday, April 16, 2002, at 09:05 AM, Anthony Beaman wrote: > > > Thanks! I think your advice may apply to the following code > that I'm > > having trouble with: > > > > use Win32::NetAdmin; > > $username = Win32::LoginName; > > Win32::NetAdmin::UserGetAttributes("", $username, $password, > > $passwordage, $privilege, $homedir, $comment, $flags, > > $scriptpath); > > print "The homedir for $username is $homedir\n"; > > > > I tried this but got similar errors but I played with it and > tried to add > > the other "$"'s to the print statement but the only thing that > will print > > is the username (I'm logged onto NT Server 4 as Admin). > > > > Here's the other code that I'm having trouble with and it's > indicative of > > the problems that I'm having with the "IO::Socket::INET->new" > statement: > > > > use IO::Socket; > > $remote = IO::Socket::INET->new( > > Proto => "tcp"; > > PeerAddr => "localhost"; > > PeerPort => "daytime(13)", > > ) > > or die "Can't connect to daytime port at localhost"; > > while (<$remote>) {print} > > > > Now, I'm getting syntax errors: > > > > syntax error at 415b.pl line 3, near ""tcp";" > > syntax error at 415b.pl line 7, near ") > > " > > > > Any ideas? Remember, I'm a beginner. :-) (no flaming!) > > > > > > you want commas to separate list elements, not semicolons. > use IO::Socket; > $remote = IO::Socket::INET->new( > Proto => "tcp", > PeerAddr => "localhost", > PeerPort => "daytime(13)" > ) > > > Thanks! > > -----Original Message----- > > From: David Gray [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, April 16, 2002 11:38 AM > > To: [EMAIL PROTECTED]; Anthony Beaman > > Subject: RE: Errors Running Learning Perl in Win32 Scripts > > > > > Hi! I have version 5.005_03 and I'm using the Win32 version > > > of the Learning Perl book. I'm having trouble running a few > > > scripts. For example, when I run the following: > > > > > > Exercise 16.1 > > > > > > foreach $host (@ARGV) { > > > ($name, $aliases, $addrtype, $length, @addrs) = > > > gethostbyname($host); > > > print "$host:\n"; > > > > > > foreach $a (@addrs) { > > > print join(".", unpack("C4", $a)), "\n"; > > > } > > > } > > > > > > ....I get the following errors: > > > > > > Name "main::name" used only once: possible typo at 415.pl > > > line 5. Name "main::length" used only once: possible typo at > > > 415.pl line 5. Name "main::aliases" used only once: possible > > > typo at 415.pl line 5. Name "main::addrtype" used only once: > > > possible typo at 415.pl line 5. > > > > Those aren't errors, they're warnings which get generated because > > you're > > (wisely) asking for them by either having a -w at the end of the > > first > > line of your program or including the 'use warnings;' pragma > > somewhere. > > Your program should run correctly if those are the only > messages it > > generates. > > > > > What am I doing wrong? The scripts in the book are supposedly > > > for this version but I'm having trouble with this and similar > > > scripts. > > > > You shouldn't be declaring those variables as global if > you're only > > going to be using them in that one specific block. You don't even > > really > > need to get the values if you're not going to use them. > Use instead: > > > > my @addrs = (gethostbyname($host))[4]; > > > > Hope that helps some, and please ask more specific questions with > > relevant code attatched if I haven't answered what you > were wondering > > about. > > > > -dave > > > > > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]