[13172] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 582 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 19 01:07:19 1999

Date: Wed, 18 Aug 1999 22:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 18 Aug 1999     Volume: 9 Number: 582

Today's topics:
    Re: DBI-Problem: SELECT Statement with bind_param() (Alan Stewart)
    Re: Does anyone know Perl call PL/SQL store procedure U <weiming@wt.infi.net>
    Re: How do you create a directory??? (elephant)
    Re: How To change directories <kangas@anlon.com>
    Re: Is it possible to send oneway message to perl cgi? <kangas@anlon.com>
        mystified about Javascript failing in Perl output to fi <dnor@NOSPAMhiline.net>
    Re: net use won't work in perl (elephant)
        Perl Scripting Question about chat. (I Make Brandi's Puppies Jump!)
    Re: pushing an anonymous hash slice <uri@sysarch.com>
    Re: Question about date (Jimtaylor5)
    Re: Question about date <wyzelli@yahoo.com>
        Renaming Windows NT domain users (Michael Blackmore)
    Re: reverse() weirdness <kistler@fnmail.com>
        SQL Beautifier (K)
    Re: system() under Win32 (elephant)
    Re: system() under Win32 (elephant)
        UDP help (Kyle Davis)
    Re: UDP help <admin@t10.net>
        Unsafe... (was: Re: suggestions for CRAP) (David H. Adler)
    Re: Wacky Programming Tales (Was Re: Why use Perl when  <kistler@fnmail.com>
    Re: what does eq do on lists? <rick.delaney@home.com>
        What else that is nice about vi. <kangas@anlon.com>
    Re: What else that is nice about vi. (elephant)
    Re: which is better?(assignment(typeglob v ref)) <kistler@fnmail.com>
        While loop being ignored <wyzelli@yahoo.com>
    Re: While loop being ignored (elephant)
    Re: While loop being ignored <wyzelli@yahoo.com>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Thu, 19 Aug 1999 03:50:02 GMT
From: astewart@spawar.navy.mil (Alan Stewart)
Subject: Re: DBI-Problem: SELECT Statement with bind_param()
Message-Id: <37bb7dff.3470580@news.pwy1.sdca.home.com>

On Mon, 16 Aug 1999 09:04:53 +0200, Thomas Goesmann
<goesmann@do.isst.fhg.de> wrote:

[snip]
>
>which I think is generally possible with the bind_param function. But
>what is the exact syntax?
>
[snip]

Example from a DBI tutorial (found thru www.perl.com somewhere):

my @records = (
                [ 0, "Larry Wall",      "Perl Author",  "555-0101" ],
                [ 1, "Tim Bunce",       "DBI Author",   "555-0202" ],
                [ 2, "Randal Schwartz", "Guy at Large", "555-0303" ],
                [ 3, "Doug MacEachern", "Apache Man",   "555-0404" ] 
              );

my $sql = qq{ INSERT INTO employees VALUES ( ?, ?, ?, ? ) };
my $sth = $dbh->prepare( $sql );


for( @records ) {
  eval {
    $sth->bind_param( 1, @$_->[0], SQL_INTEGER );
    $sth->bind_param( 2, @$_->[1], SQL_VARCHAR );
    $sth->bind_param( 3, @$_->[2], SQL_VARCHAR );
    $sth->bind_param( 4, @$_->[3], SQL_VARCHAR );
    $sth->execute();
    $dbh->commit();
  };



------------------------------

Date: Wed, 18 Aug 1999 21:53:04 -0300
From: Weiming He <weiming@wt.infi.net>
Subject: Re: Does anyone know Perl call PL/SQL store procedure URL links?
Message-Id: <37BB556F.C97@wt.infi.net>

Makarand Kulkarni:

Thank you for your response. Can you point me the URL inks?

Weiming

> 
>             Makarand Kulkarni <makkulka@cisco.com>

Makarand Kulkarni wrote:
> 
> [ Weiming He wrote:
> 
> > Does anyone know Perl call PL/SQL store procedure URL links?
> > Especially for transaction PL/SQL procedure. If someone knows
> > please drop me lines. Thanks in advance.
> 
> This is clearly explained in the DBI FAQ ( items 5.3 and 5.4 ).
> 
> --Makarand


------------------------------

Date: Thu, 19 Aug 1999 13:06:30 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: How do you create a directory???
Message-Id: <MPG.12261fc077a51fa2989c4f@news-server>

Ben Valentine writes ..
>see subject.

whoa .. you either need to fix your system clock - or get a new newsfeed

read the documentation on perlfunc by typing the following at a command 
prompt

  perldoc perlfunc

you will see a bunch of functions for filehandles, files, or directories

-- 
 jason - elephant@squirrelgroup.com -


------------------------------

Date: Wed, 18 Aug 1999 23:13:27 -0500
From: Kangas <kangas@anlon.com>
Subject: Re: How To change directories
Message-Id: <37BB8467.7F0F0670@anlon.com>

lets say you had another perl script or whatever program in another directory...
did you try this?

$results = `d:\programs\aFolder\runner.pl $parameter1 $parameter2`;

hope it helps.

Yoann Esnaud wrote:

> Hi,
>
> (Win 95 - PC, Perl 5)
>
> I am creating a perl script and I would like to run an application but with
> a different working directory as the one I am executing the perl script
> from, any ideas how to do this? (I tried to use chroot, but it does not seem
> to work)
>
> Thanks.

--
Michael Kangas
Anlon Systems, Inc.
kangas@anlon.com




------------------------------

Date: Wed, 18 Aug 1999 23:19:27 -0500
From: Kangas <kangas@anlon.com>
Subject: Re: Is it possible to send oneway message to perl cgi?
Message-Id: <37BB85CF.BF873DB8@anlon.com>

you can try to use the $| variable. It will print all data immediately
without buffering.

have your script first use $|=1; and then send your response to the client.
Then your script will still run after the message is sent back to the client
and while the client is reading the message the script could possibly still
be running with the client ever knowing.

this may help.

yangsu@ustc.edu wrote:

> Maybe it sounds silly, but what I want is that when client sends
> a http request to perl cgi script, the client only cares about sending
> in the information and never cares about returning message, so after
> the client sends the message to server, it should return immediately
> (without waiting on the server processing)
> Is this possible? My experience is that it has to wait until cgi program
> finishes processing.
>
> Thanks for any enlightment.
>
> yang
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.

--
Michael Kangas
Anlon Systems, Inc.
kangas@anlon.com




------------------------------

Date: 18 Aug 1999 22:20:14 -0500
From: "99% Energy" <dnor@NOSPAMhiline.net>
Subject: mystified about Javascript failing in Perl output to file for html
Message-Id: <AIKu3.9261$Ce7.119206@newscene.newscene.com>

I made a Perl script that will run fine as cgi. It returns HTML with an
imbedded Javascript. The Javascript code runs fine when the script is called
from the browser:

http://localhost/myscript.pl

However if I convert all the print statements in the Perl script to sent it
to an html file instead (except the first line that contains the
"Content-type: text/html\n\n") and then try to load the file from the
browser like this:

http://localhost/myscriptoutput.html

the imbedded Javascript gets errors (invalid characters, etc). At first I
was completely baffled because I could not see anything wrong with the
scripts. Then I looked closely at the files with a hex editor and I couldn't
find anything unusual. I also tried to access the html file directly like
this:

c:/mywebpage/htdocs/myscriptoutput.html

And I still get Javascript errors. The rest of the page, which contains tons
of html tags looks perfectly fine.

I am running ActivePerl on windows 98, with an Apache server. (I gave up
with pws)

Whats up with that???

Thanks in advance

99% Energy




------------------------------

Date: Thu, 19 Aug 1999 13:10:20 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: net use won't work in perl
Message-Id: <MPG.122620a5de524f47989c50@news-server>

Bob Walton writes ..
>`net use t:\\\\srvrabc\\c\$ /user:administrator`

oh please .. no attributions .. stuffed up line wrapping (although in 
this article you seemed to have got it right) .. and now you're posting 
code that doesn't work !!

-- 
 jason - elephant@squirrelgroup.com -


------------------------------

Date: Wed, 18 Aug 1999 19:52:48 -0700 (PDT)
From: PuppyTrainer@webtv.net (I Make Brandi's Puppies Jump!)
Subject: Perl Scripting Question about chat.
Message-Id: <28602-37BB7180-15@newsd-213.iap.bryant.webtv.net>

Hi,
I have a question about a particular Perl Script and I was hoping
someone could help me.
I'm what you call (stupid) as far as Perl goes, I know lots of
JavaScript and HTML, but Perl is a little bit beyond my scope at this
point....what I want to do is make a perl script that will, when
executed, bring in a name of my specification an do things that I want
to be able to have it do.  For example, I want to bring in a name (like
a bot) and be able to tell it to do things for me - me being on WebTV
limits what I can do, and I'd like to have a cyber 'helper' for things
such as locating someone, kicking/banning someone, getting IP#, and
other things.  So I guess what I"m asking (and I know it can be done,
there's a few others who have done it but they're refusing to help
because they're selfish like that) is a script, that when executed, will
bring in a name to IRC and await functions, similar to the "Z" on
zuhNET.  Can anyone help me?  It's better to email, but I will try to
stop by here to see if anyone responds. 
Thanks in advance if you can help.
If this email address doesn't work, CEO@narc-daddy.org will.



------------------------------

Date: 18 Aug 1999 23:44:18 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: pushing an anonymous hash slice
Message-Id: <x7g11gxwml.fsf@home.sysarch.com>

>>>>> "GB" == Greg Bacon <gbacon@itsc.uah.edu> writes:

  GB> In article <x7so5gygsb.fsf@home.sysarch.com>,
  GB> Uri Guttman <uri@sysarch.com> writes:

  GB> :   GB> If @a and @b are different lengths, then you end up with undefs in the
  GB> :   GB> result.  There's also the minor gripe about the calling context
  GB> :   GB> propagating to the map().
  GB> : 
  GB> : i did mention the differing lengths issue. but it is not well defined
  GB> : how to interleave two arrays of differing lengths. do you truncate, pad
  GB> : or just append the tail of the longer one? all are valid but need
  GB> : different code.

  GB> Here's the MW definition of `interleave':

  GB> to arrange in or as if in alternate layers

but that is just an arbitrary definition regarding this function we are
playing with. i just was saying we have no official spec for what is
wanted and there are 3 ways to handle differing lengths. all have valid
uses and i wasn't positing any over the others. for the hash creation,
either truncation (of the values) or padding makes sense. appending the
longer list makes no sense if that is the values. that would make the
tail of the values a set of keys and values which is wrong.


  GB> :                 i assumed equal lengths in advance as you should check
  GB> : or know that before you merge in most cases. in the original post, the
  GB> : lengths were known to be equal as one list was keys and the other an
  GB> : array slice.

  GB> I disagree.  The real question when it comes to interleaving is "how
  GB> should I interleave the objects?".  Do I take three of one and two of
  GB> the other?  I'm still waiting for mjd (or Abigail?) to chime in with a
  GB> way to interleave an aribitrary number of arrays by arbitrary rules. :-)

i agree interleaving up to the equal lengths is that. what i was
commenting on was how to handle the extra tail of one of the lists. so
given 3 ways to do that, there is no right way for al cases. the problem
will dictate the right way.

  GB> : also propogating the calling context to the map is the user's
  GB> : problem.

  GB> That's an interesting approach to writing useful software.

no. if the function is defined to return a list, then if the user calls
it in a scalar context, you can't stop him. returning a real array or a
list will be wrong in a scalar context.

  GB> A reference to the resulting array?  A count of objects in the resulting
  GB> array?  Launching nethack? :-)  There are plenty of valid results in
  GB> scalar context.

yes if they are defined. i wasn't defining them. so what? i have done
many functions which return an array or its ref depending on
wantarray. but that is what is defined. my simple map version was
defined to return a list. caveat caller. you can break any function by
not calling it right.

  GB> :   GB> # 'twould be nice to have lazy eval here
  GB> : 
  GB> : or first.

  GB> The hypothetical first() implies the existence of lazy evaluation.

that is was i meant. one version of lazy eval was called first.

  GB> I like generality.

so do i in general.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.


------------------------------

Date: 19 Aug 1999 04:02:09 GMT
From: jimtaylor5@aol.com (Jimtaylor5)
Subject: Re: Question about date
Message-Id: <19990819000209.08662.00000298@ng-fn1.aol.com>

>> Can anyone tell me how I would check a date to see if two or more days have
>> passed? 
>
>Isn't the localtime() function sufficient for this?
>
>Chris.

maybe i didn't explain it well enough. I have written this program to write out
different text files depending on what someone selects. I want to delete the
file automatically after two days. Say it's july 31 (it will be any number, and
day). I am at a loss how to write code to let my program know when two days
have passed, no matter what day or month it is?
Can anyone help?


------------------------------

Date: Thu, 19 Aug 1999 13:39:23 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Question about date
Message-Id: <SrLu3.44$z44.10835@vic.nntp.telstra.net>

Jimtaylor5 <jimtaylor5@aol.com> wrote in message
news:19990819000209.08662.00000298@ng-fn1.aol.com...
> >> Can anyone tell me how I would check a date to see if two or more days
have
> >> passed?
> >
> >Isn't the localtime() function sufficient for this?
> >
> >Chris.
>
> maybe i didn't explain it well enough. I have written this program to
write out
> different text files depending on what someone selects. I want to delete
the
> file automatically after two days. Say it's july 31 (it will be any
number, and
> day). I am at a loss how to write code to let my program know when two
days
> have passed, no matter what day or month it is?
> Can anyone help?

How about if 'now' > 'date of writing file + 172,800' delete file?

ie :-

@Filestats = stat ($filename);
 $Filemodtime = $Filestats[9];

if localtime (time) > ($Filemodtime(9) + 172800) {
unlink $filename;
}

172,800 seconds = 2 days

Wyzelli




------------------------------

Date: Thu, 19 Aug 1999 04:21:39 GMT
From: michael.blackmore@kvaerner.com (Michael Blackmore)
Subject: Renaming Windows NT domain users
Message-Id: <37bb81b8.276891659@news.kvaerner.com>

Anybody know if it is possible to rename users within a Windows NT
domain?  I've looked at Win32::NetAdmin and Win32::API::Net.  These
can provide and change user details, but not it seems the username.  I
am developing a script to rename around 400 users.

Cheers,

Michael Blackmore

michael.blackmore@kvaerner.com


------------------------------

Date: Thu, 19 Aug 1999 02:18:26 +0200
From: Per Kistler <kistler@fnmail.com>
To: IGuthrie <iguthrie@aol.com>
Subject: Re: reverse() weirdness
Message-Id: <37BB4D52.92F0E77A@fnmail.com>

Hi

IGuthrie wrote:

> open(FILE, "$file") && print reverse(<FILE>)  || die "$! $file\n";

print happens only after the "||", so <FILE> is in scalar
context and gives only one line at a time. revers applied
to a string, reverses the string, so get all reversed.
If you use "or" instead of "||" then print happens before
the stuff after "or" and then <FILE> is in list context,
so reverse, reverses the line order.

-Per.
-- 
Per Kistler kistler@fnmail.com / kistler@gmx.net
------------------------------------------------------------


------------------------------

Date: Thu, 19 Aug 1999 03:33:32 GMT
From: kcounts1@helios.acomp.usf.edu (K)
Subject: SQL Beautifier
Message-Id: <37bb7b7f.174907162@news-server>

This is a stretch..but.. 

Does anyone know of a SQL Beautifier written in Perl? (or any
language)

I mean a SQL Beautifier as in analogous to the standard UNIX C
Beautifier.

Thanks,

Kevin Counts


------------------------------

Date: Thu, 19 Aug 1999 13:04:17 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: system() under Win32
Message-Id: <MPG.12261f3aab98ccdf989c4e@news-server>

John M. Dlugosz writes ..
>If the string contains
>    foo.exe arg arg arg
>
>it works just fine.
>
>If the string contains
>    "foo.exe" arg arg arg
>
>the spawning process fails to find the program.

I'm sorry John - but I don't believe you *8^) .. show us the code - I 
can't imagine anything that would do this with an *.exe file

-- 
 jason - elephant@squirrelgroup.com -


------------------------------

Date: Thu, 19 Aug 1999 13:03:15 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: system() under Win32
Message-Id: <MPG.12261efb54cadb17989c4d@news-server>

Bob Walton writes ..
>John M. Dlugosz writes ..
>> If the string contains
>>     foo.exe arg arg arg
>>
>> it works just fine.
>>
>> If the string contains
>>     "foo.exe" arg arg arg
>>
>> the spawning process fails to find the program.
>
>John, you can't really blame this one on Perl, but rather on Microsoft's
>braindead command interpreter (you are, I assume, using Win32 given the n
>of the command quoting you are attempting, even though you neglected to m
>what your OS is).  Note, for example, that if you type
>
>echo hi there
>
>at a command prompt, it works, and that if you type:
>
>"echo" hi there
>
>it doesn't work (it gives "Bad command or file name").

now - that actually does make sense .. basically that behaviour is 
saying that if you put quotes around it then it'll treat it as a file 
and go look for it .. 'echo' is a shell command - so it fails

>But if you have a file called "junk.bat", you can run it with either:
>
>junk
>
>or
>
>"junk"
>
>and that
>
>"junk junk"
>
>will work for "junk junk.bat".  Don't ask me why some commands can be quo
>others cannot -- ask Microsoft, they're the ones who blew it.

well .. 'echo' is a command .. part of the shell .. so it can't be 
quoted .. junk.bat is a file - so it can .. the 'junk' shortcut is made 
possible through the PATHEXT environment variable

>                                                       If you can't do it
>command prompt, you can't do it in "system"; if you can do it at a comman
>prompt, you should be able to do it in "system", using exactly the same s

just have to be careful of GUI applications .. which when started from 
system() need to be started with 'start' otherwise they don't show up

btw .. Bob .. it's nice to (a) leave in attributions when posting to 
usenet so that it's clear who said what and (b) trimming your lines to 
72 chars (you'll notice that I've trucated the long lines in your post 
manually)

-- 
 jason - elephant@squirrelgroup.com -


------------------------------

Date: Thu, 19 Aug 1999 04:45:54 GMT
From: ltt_kinslayer@NOSPAM.usa.net (Kyle Davis)
Subject: UDP help
Message-Id: <MPG.12252cae3a22507a98968e@news.flash.net>

 Alright, I've been struggling with this all day and I just can't get it 
to work. What I'm trying to do is this: connect to a 'master server' that 
houses a list of IP addresses and ports of servers that are running games 
(in this case, Drakan). Split those apart, and then connect to each 
server and request information using UDP.

 I got the first part down. It's not perfect, but it works well enough 
for me to see that the second part doesn't. :)

 I'm not sure what it is I'm doing wrong, but any pointers would be much 
appreciated. Many thanks in advance...

 - Kyle Davis


#!/usr/bin/perl -w
use IO::Socket;       # used for the fetching of the master list
use Socket;           # used for UDP -- don't know how using IO::Socket

#######################################################################
# download master list

 $cserver = -1;
 $remote = IO::Socket::INET->new( Proto    => "tcp",
                                  PeerAddr => "master.mplayer.com",
                                  PeerPort => "http(80)", );
 print $remote "GET /drakan/servers.txt HTTP/1.0\015\012\015\012";

 while ($line = <$remote>)
 {
   if ($line =~ /text\/plain/i)     # the server IPs start
   {
     $cserver = 0;                  # start recording IPs
   }
   elsif ($cserver != -1)           # IP incoming
   {
     $allinfo[$cserver] = $line;
     $cserver++;
   }
 }

 close $remote;

#######################################################################
# set globals and print header information

 $numservs = (@allinfo - 2);              # account for lame lines I'm
                                          # too lazy to filter out
 print "Content-type: text/html\n\n";

 print "Total number of servers: $numservs\n";
 print "<br>\n";
 print "Server information:\n<pre>@allinfo</pre>";

#########################################################################
####
# cycle through each server and get information

 $cserver = 0;                     # current server number
 $scal    = "";                    # theoretically, server's response

 while ($cserver < $numservs)
 {
   ($serverip, $portx, $porty) = split(/ /, $allinfo[$cserver+1], 3);

   print "<hr noshade width=\"100%\" size=3>\n";
   print "<strong>$serverip</strong> ($portx):<p>\n";

   $port  = $portx;                        # port number
   $iaddr = inet_aton($serverip);          # convert from ASCII
                                           # dotted to numeric
   $paddr = sockaddr_in(27046, $iaddr);    # open local side
  #$proto = getprotobyname('udp');         # = needed?

   socket(SOCK, PF_INET, SOCK_DGRAM, IPPROTO_UDP);
  #bind(SOCK, $paddr);                     # = needed?

#######################################################################
# Allright, all this is what I'm fairly unsure of. The packet with
# "\status\" might or might not actually be getting off, but I'm 99%
# sure that there is something wrong with the recv() call (or something
# wrong with opening the port above). At the moment, the script claims
# to send the request and then just pauses for an indefinate amount of
# time. Ideally, the server should respond with information about the
# players, level, server configuration, etc.
#
# This is where I really need the help. I have the feeling it's some-
# thing stupid I'm overlooking...

   send(SOCK, "\\status\\\r\n", 0, $paddr) || die "send: $!\n";
   print "Sent request <tt>\\status\\</tt>...<br>\n";
   print "Waiting for response...\n";

   ($senderip = recv(SOCK, $scal, 2, 0)) || die "recv: $!\n";
   print "\nReceived response: <tt>$scal</tt>...<br>\n";

#######################################################################
# And back to sensical code...

   closesocket(SOCK);                      # = close socket
   $cserver++;                             # and onward...
 }


------------------------------

Date: Wed, 18 Aug 1999 23:02:27 -0600
From: "Eric" <admin@t10.net>
Subject: Re: UDP help
Message-Id: <T6Mu3.726$jp4.109533@news.uswest.net>

If there is a program available to do this, turn it on and
run a sniffer (tcpdump). Look at what the program is sending
and receiving, etc... .

My brother and I used a program called Gamespy that shows
Quake games. We sniffed the packets and saw what it was sending, etc...


Kyle Davis wrote in message ...
> Alright, I've been struggling with this all day and I just can't get it
>to work. What I'm trying to do is this: connect to a 'master server' that
>houses a list of IP addresses and ports of servers that are running games
>(in this case, Drakan). Split those apart, and then connect to each
>server and request information using UDP.
>
> I got the first part down. It's not perfect, but it works well enough
>for me to see that the second part doesn't. :)
>
> I'm not sure what it is I'm doing wrong, but any pointers would be much
>appreciated. Many thanks in advance...
>
> - Kyle Davis
>
>
>#!/usr/bin/perl -w
>use IO::Socket;       # used for the fetching of the master list
>use Socket;           # used for UDP -- don't know how using IO::Socket
>
>#######################################################################
># download master list
>
> $cserver = -1;
> $remote = IO::Socket::INET->new( Proto    => "tcp",
>                                  PeerAddr => "master.mplayer.com",
>                                  PeerPort => "http(80)", );
> print $remote "GET /drakan/servers.txt HTTP/1.0\015\012\015\012";
>
> while ($line = <$remote>)
> {
>   if ($line =~ /text\/plain/i)     # the server IPs start
>   {
>     $cserver = 0;                  # start recording IPs
>   }
>   elsif ($cserver != -1)           # IP incoming
>   {
>     $allinfo[$cserver] = $line;
>     $cserver++;
>   }
> }
>
> close $remote;
>
>#######################################################################
># set globals and print header information
>
> $numservs = (@allinfo - 2);              # account for lame lines I'm
>                                          # too lazy to filter out
> print "Content-type: text/html\n\n";
>
> print "Total number of servers: $numservs\n";
> print "<br>\n";
> print "Server information:\n<pre>@allinfo</pre>";
>
>#########################################################################
>####
># cycle through each server and get information
>
> $cserver = 0;                     # current server number
> $scal    = "";                    # theoretically, server's response
>
> while ($cserver < $numservs)
> {
>   ($serverip, $portx, $porty) = split(/ /, $allinfo[$cserver+1], 3);
>
>   print "<hr noshade width=\"100%\" size=3>\n";
>   print "<strong>$serverip</strong> ($portx):<p>\n";
>
>   $port  = $portx;                        # port number
>   $iaddr = inet_aton($serverip);          # convert from ASCII
>                                           # dotted to numeric
>   $paddr = sockaddr_in(27046, $iaddr);    # open local side
>  #$proto = getprotobyname('udp');         # = needed?
>
>   socket(SOCK, PF_INET, SOCK_DGRAM, IPPROTO_UDP);
>  #bind(SOCK, $paddr);                     # = needed?
>
>#######################################################################
># Allright, all this is what I'm fairly unsure of. The packet with
># "\status\" might or might not actually be getting off, but I'm 99%
># sure that there is something wrong with the recv() call (or something
># wrong with opening the port above). At the moment, the script claims
># to send the request and then just pauses for an indefinate amount of
># time. Ideally, the server should respond with information about the
># players, level, server configuration, etc.
>#
># This is where I really need the help. I have the feeling it's some-
># thing stupid I'm overlooking...
>
>   send(SOCK, "\\status\\\r\n", 0, $paddr) || die "send: $!\n";
>   print "Sent request <tt>\\status\\</tt>...<br>\n";
>   print "Waiting for response...\n";
>
>   ($senderip = recv(SOCK, $scal, 2, 0)) || die "recv: $!\n";
>   print "\nReceived response: <tt>$scal</tt>...<br>\n";
>
>#######################################################################
># And back to sensical code...
>
>   closesocket(SOCK);                      # = close socket
>   $cserver++;                             # and onward...
> }




------------------------------

Date: 19 Aug 1999 05:02:23 GMT
From: dha@panix7.panix.com (David H. Adler)
Subject: Unsafe... (was: Re: suggestions for CRAP)
Message-Id: <slrn7rn3uv.hvs.dha@panix7.panix.com>

In article
<Pine.GSO.4.10.9908130954250.3761-100000@crusoe.crusoe.net>, Jeff
Pinyan wrote:

>
>I'll let you get back to driving your Pinto down memory lane.  (Hmm, that
>was an "Unsafe at Any Speed" reference.  I learned something in school.)

[note to the picky - yes, I'm coming in late here.  Hey, I've been out
of town...]

No offence to the school system or anything, but shouldn't that be a
Corvair, rather than a Pinto?  :-)

HTH

dave

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
perl -e 'print "Just another P$0-r-l hacker"'


------------------------------

Date: Wed, 18 Aug 1999 11:19:28 +0200
From: Per Kistler <kistler@fnmail.com>
Subject: Re: Wacky Programming Tales (Was Re: Why use Perl when we've got  Python?!)
Message-Id: <37BA7AA0.1C67A7A6@fnmail.com>

Such things are still harmless compared to the macros of the
C++ compilier of HP-UX. They put a variation of the standard template
library into macros (,in certain include files).
They argue, it's not ansi c++, which does not help me that much,
and neither reduces the price of the compiler. (To say something
nice about HP, the 8cpu machine runs quite nicely:-).

And a small positive statement about Perl and Python: Both are
not Tcl:-) (, and no one from comp.lang.tcl can read this:-)
And I like both, Perl and Python. Perl and Tcl brought me some
money already and Python will sure do so in the future as well. 
If one collects the advantages of all three scripting languages, 
one can do nearly everything.

-Per.

"T. C. Mits" wrote:
> ...
> you don't use a good lint, because the boss won't buy one), #define EQ ==,
> is not a sin.   Well, yes it is, but its not, but.....

> >   #define AND &&
> >   #define OR  ||


-- 
Per Kistler kistler@fnmail.com / kistler@gmx.net
------------------------------------------------------------


------------------------------

Date: Thu, 19 Aug 1999 04:12:41 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: what does eq do on lists?
Message-Id: <37BB8420.9EE3496B@home.com>

[posted & mailed]

[@a[0..3] is a list, not an array]

Sam Holden wrote:
> 
> But this begs the question why is it called an 'array slice'.

Not really.  It _is_ a slice of an array.  But the word slice in Perl
means list and it is the noun in this phrase.

An array slice is not an array.
A hash slice is not a hash.
A pizza slice is not a pizza.

-- 
Rick Delaney
rick.delaney@home.com


------------------------------

Date: Wed, 18 Aug 1999 23:05:28 -0500
From: Kangas <kangas@anlon.com>
Subject: What else that is nice about vi.
Message-Id: <37BB8288.61F81222@anlon.com>

If you need to take it somewhere....
no matter what version you use VIM, xvi, and any other flavor you can think of
is that you can plop it onto a disk or email it very easily. The main
executable fo the program is never much more than 150K.


Ken Snyder wrote:

> What editors are folks using for PerlScript development under Windows?  I
> have had some success with Homesite but would like to use Visual Interdev.
> Is there anyway to get Interdev to parse Perl?  Is there a better editor I
> should use instead?
>
> ken

--
Michael Kangas
Anlon Systems, Inc.
kangas@anlon.com




------------------------------

Date: Thu, 19 Aug 1999 14:38:04 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: What else that is nice about vi.
Message-Id: <MPG.122635358941f91f989c53@news-server>

Kangas writes ..
>Ken Snyder wrote:
>> What editors are folks using for PerlScript development under Windows?
-
>If you need to take it somewhere....
>no matter what version you use VIM, xvi, and any other flavor you can think of
>is that you can plop it onto a disk or email it very easily. The main
>executable fo the program is never much more than 150K.

HA! .. while I'm a great fan of vim - your claim here is certainly 
incorrect .. the latest (5.4) version of vim on my WindowsNT machine 
with GUI/OLE/PERL compiled in is ~ 706kB and it's ~629kB unflavoured .. 
5.3 was ~ 602kB with only GUI

don't get me wrong .. I prefer no text editor more than vim .. but 150kB 
is a bit of a stretch of the imagination

AND .. learn how to post better .. (a) changing the subject without 
including a (was: ) note is poor form and (b) putting a response above 
what you're responding to is pathetic .. see TomC's regular post 
"Quoting Strategies and the Jeopardy Game" in this group

AND .. this is now off-topic .. followup set

-- 
 jason - elephant@squirrelgroup.com -


------------------------------

Date: Thu, 19 Aug 1999 02:32:56 +0200
From: Per Kistler <kistler@fnmail.com>
To: David L Rubin <davidrubin@lucent.com>
Subject: Re: which is better?(assignment(typeglob v ref))
Message-Id: <37BB50B8.16DCEDF8@fnmail.com>

Hi

David L Rubin wrote:

> 1. ($err, @array) = foo();      # having err first irks me, so I don't like this soln
> 2. ($arrayref, $err) = foo();   # now I have to use $$arrayref[$i] or @$arrayref
> 3. (*array, $err) = foo();      # I can still use $array[$i] or @array

I'd use "2." and refer to elements like: $arrayref->[$i]
This may not be Tom->guruWayOfDoingTasks(Task), but it's a
standard way of programming.

But if one really wanted Perl, then one may use an eval{} and
throw an exception with die().

Or one might return a ref to either an err string or the array
and then ask for the ref() type.

One could as well return $err only and hand the arr as arg:
$err = foo(\@arr); # like it's done in PerlMagick

And you probably get a hundred more ways of doing it 
in comp.lang.perl.misc

-Per.
-- 
Per Kistler kistler@fnmail.com / kistler@gmx.net
------------------------------------------------------------


------------------------------

Date: Thu, 19 Aug 1999 13:11:13 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: While loop being ignored
Message-Id: <s1Lu3.43$z44.10919@vic.nntp.telstra.net>

Below is a section of code which I am having trouble with.

Basically when I run the script, The first file gets opened, the second file
gets created, then the whole while loop gets ignored
and the script goes straight to the first file close.

Any ideas?

(The 'flocks' are commented for testing on my Windows98 PC).

Wyzelli



open (MAIL,"<$MailLoginFile") or die "Unable to open file $MailLoginFile.
$!\n";
#flock (MAIL, LOCK_EX);
open (MAILTEMP,">$Mailtemp") or die "Unable to create $Mailtemp. $!\n";
#flock (MAILTEMP, LOCK_EX);

while (<MAIL>) {
 $errmsg = "<p>Username not found!</p>";
 ($ExistMailUser, $RestOfMailFile) = split (/ /,$_, 2);
 if ($ExistMailUser ne $Username) { #check for correct user
  print MAILTEMP $_;
  $message = $errmsg.$message;
  $found_err = 1;
 }
}

#flock (MAIL,LOCK_UN);
close MAIL;
#flock (MAILTEMP,LOCK_UN);
close MAILTEMP;






------------------------------

Date: Thu, 19 Aug 1999 14:23:13 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: While loop being ignored
Message-Id: <MPG.122631c0ca1b499a989c52@news-server>

Wyzelli writes ..
>Basically when I run the script, The first file gets opened, the second file
>gets created, then the whole while loop gets ignored
>and the script goes straight to the first file close.
-
>open (MAIL,"<$MailLoginFile") or die "Unable to open file $MailLoginFile.
>$!\n";
>#flock (MAIL, LOCK_EX);
>open (MAILTEMP,">$Mailtemp") or die "Unable to create $Mailtemp. $!\n";
>#flock (MAILTEMP, LOCK_EX);
>
>while (<MAIL>) {
> $errmsg = "<p>Username not found!</p>";
> ($ExistMailUser, $RestOfMailFile) = split (/ /,$_, 2);
> if ($ExistMailUser ne $Username) { #check for correct user
>  print MAILTEMP $_;
>  $message = $errmsg.$message;
>  $found_err = 1;
> }
>}
>
>#flock (MAIL,LOCK_UN);
>close MAIL;
>#flock (MAILTEMP,LOCK_UN);
>close MAILTEMP;

in your while loop - the print statements are relying on your 
conditional .. in other words - it may be looping successfully - but 
you're not seeing anything because the logic in your split and if is 
broken .. the only reason that the while loop would be being skipped is 
if the $MailLoginFile contained no lines

try adding in a print statement that's outside of the conditional .. you 
can combine this with a little debugging information .. eg.

while (<MAIL>) {
  $errmsg = "<p>Username not found!</p>";
  ($ExistMailUser, $RestOfMailFile) = split (/ /,$_, 2);

  print STDERR "EMU: $ExistMailUser\tU: $Username\n"; #DEBUG

  if ($ExistMailUser ne $Username) { #check for correct user
    print MAILTEMP $_;
    $message = $errmsg.$message;
    $found_err = 1;
  }
}


this will probably shed a lot of light on your situation

-- 
 jason - elephant@squirrelgroup.com -


------------------------------

Date: Thu, 19 Aug 1999 14:28:24 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: While loop being ignored
Message-Id: <Y9Mu3.47$z44.10939@vic.nntp.telstra.net>

elephant <elephant@squirrelgroup.com> wrote in message
news:MPG.122631c0ca1b499a989c52@news-server...
> Wyzelli writes ..
> >Basically when I run the script, The first file gets opened, the second
file
> >gets created, then the whole while loop gets ignored
> >and the script goes straight to the first file close.
> -
> >open (MAIL,"<$MailLoginFile") or die "Unable to open file $MailLoginFile.
> >$!\n";
> >#flock (MAIL, LOCK_EX);
> >open (MAILTEMP,">$Mailtemp") or die "Unable to create $Mailtemp. $!\n";
> >#flock (MAILTEMP, LOCK_EX);
> >
> >while (<MAIL>) {
> > $errmsg = "<p>Username not found!</p>";
> > ($ExistMailUser, $RestOfMailFile) = split (/ /,$_, 2);
> > if ($ExistMailUser ne $Username) { #check for correct user
> >  print MAILTEMP $_;
> >  $message = $errmsg.$message;
> >  $found_err = 1;
> > }
> >}
> >
> >#flock (MAIL,LOCK_UN);
> >close MAIL;
> >#flock (MAILTEMP,LOCK_UN);
> >close MAILTEMP;
>
> in your while loop - the print statements are relying on your
> conditional .. in other words - it may be looping successfully - but
> you're not seeing anything because the logic in your split and if is
> broken .. the only reason that the while loop would be being skipped is
> if the $MailLoginFile contained no lines
>
> try adding in a print statement that's outside of the conditional .. you
> can combine this with a little debugging information .. eg.
>
> while (<MAIL>) {
>   $errmsg = "<p>Username not found!</p>";
>   ($ExistMailUser, $RestOfMailFile) = split (/ /,$_, 2);
>
>   print STDERR "EMU: $ExistMailUser\tU: $Username\n"; #DEBUG
>
>   if ($ExistMailUser ne $Username) { #check for correct user
>     print MAILTEMP $_;
>     $message = $errmsg.$message;
>     $found_err = 1;
>   }
> }
>
>
> this will probably shed a lot of light on your situation
>
> --
>  jason - elephant@squirrelgroup.com -

Hmmm..
Nice try but...

I change it to

while (<MAIL>){
    print MAILTEMP $_;
}

And still get nothing...

There is definitely something in the source file

What I have found is that a debugger break-point set at the while statement
is skipped as if it is a comment...

This is driving me BATTY

Wyzelli




------------------------------

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. Due to their sizes, neither the Meta-FAQ nor
the FAQ are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq" from
almanac@ruby.oce.orst.edu. 

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 582
*************************************


home help back first fref pref prev next nref lref last post