[prev in list] [next in list] [prev in thread] [next in thread]
List: perl-win32-users
Subject: Help With Perl Syntax
From: "Scott K Purcell" <spurcell () dcspremedia ! com>
Date: 2000-01-31 14:40:58
[Download RAW message or body]
Hello,
I have the following code: posted below, which I could use a little help
understanding. If anyone could walk me through, what this is doing, then I
should be able to implement this into my new code. This was done by a
previous coder that no longer works here.
$fh is a filehandle from a socket::IO connection that I created.
###########################################################################
my $response;
while ($err < 50) {
if (read($fh, $cc, 1, 0) == 1) {
$header .= $cc;
if ($header =~ /^\%BEGIN\s+(\d+)\r?\n/) {
# we've acquired one line's worth of response
my $rspsize = $1; # how much response to read
if (read($fh, $response, $rspsize, 0)) {
if ($response =~ /RESPONSE\s*OK/) {
return (1, $response);
} else {
return (-1, $response);
}
} else {
return 0;
}
} elsif ($header =~ /\%CONTINUE\s*\r?\n/ || $header =~
/\%END\s*\r?\n/) {
undef $header;
} elsif ($header =~ /\n$/) {
&squawk("unknown mediabank response: $header");
return -1;
} else {
# keep going haven't hit a newline yet
}
} else {
$err++;
}
}
return 0;
As always any help is terrific. It is the only way to learn, and get
better.
Sincerely
Scott
---
You are currently subscribed to perl-win32-users as: [perl-win32-users@progressive-comp.com]
To unsubscribe, forward this message to
leave-perl-win32-users-90392J@lyris.ActiveState.com
For non-automated Mailing List support, send email to
ListHelp@ActiveState.com
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic