in reply to Re: Scoping Issue
in thread Scoping Issue
Actually, that's not the problem at all. If you look at the OP, the first line of output after the "sdf" line shows that @command is in fact being set correctly. I was surprised too, but removing the parentheses and adding use warnings doesn't actually fix the problem.
The real problem, as best I can tell, has to do with connecting to this server using telnet(1) as your client. Somehow telnet is sending some special escapes which your program is choking on. Try adding the following line in "spawn" and you'll see what I mean: print "***$clientreq***\n";
Also, within your while loop you need to add this line, or else it will start spinning forever as soon as your first client disconnects:
last if !defined $clientreq;Update: By the way, the --debug option in your code won't work the way you think it will. use warnings is lexically scoped, so in fact it will have no effect at all the way you've written it. To see what I mean, try this:
if (1) { use warnings; } print undef;
Note that you don't get an "uninitialized value" warning like you might expect to. One way you can work around this is with:
BEGIN { if ($ARGV[0] eq '--debug') { require warnings; warnings->import(); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Scoping Issue
by castaway (Parson) on May 17, 2004 at 05:17 UTC | |
by webdorx (Initiate) on May 26, 2004 at 11:03 UTC |