Hair-pulling Switch bug ?

W

Willem

Hello! What is going wrong in the following example?
==================================
use IO::Socket;
use Switch;

$handle = IO::Socket::INET->new("smtp.utwente.nl:25")
or die "can't connect: $!";

while (defined ($line = <$handle>)) {
print STDOUT $line;
last;
}

# switch
==================================
This spits out:
IO::Socket::INET=GLOB(0x8341060)

If I remove the last "# switch\n" line, it works okay. Why does Switch mess
up IO::Socket and why isn't that comment ignored?

Perl v5.8.0
Switch v2.09

Thanks !
Willem
 
S

Steve Grazzini

Willem said:
==================================
use IO::Socket;
use Switch;

$handle = IO::Socket::INET->new("smtp.utwente.nl:25")
or die "can't connect: $!";

while (defined ($line = <$handle>)) {
print STDOUT $line;
last;
}

# switch
==================================
This spits out:
IO::Socket::INET=GLOB(0x8341060)

I think it has to be a bug in Switch. The line with "<$handle>" is
getting source-filter-borked into "< $handle>", which parses as a glob()
instead of a readline().
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,266
Messages
2,571,075
Members
48,772
Latest member
Backspace Studios

Latest Threads

Top