Any suggestions for how to create a test which checks if my readline
error handling is working properly? How can I get readline (or read
for that matter) to fail after open succeeds?
-- John Wiersba
1. Best way to handle readline errors?
Please enlighten. What is the best-practice way to handle read errors
when using <> or readline? What I'd really like is something like:
while ($data = <$fh>) {
# do something with $data
}
if ($fh->READLINE_ERROR) { # but this method doesn't exist
# handle readline error
} else {
# handle EOF
}
but I don't think there is anything like this that will work in
reality. Perldoc readline offers something like:
while (1) {
undef $!; # doesn't really undefine $!
$data = readline $fh; # or $fh->readline
if (!defined $data) {
last unless $!; # EOF
# handle readline error
}
# do something with $data
}
I believe this works properly, but it's kind of ugly. Is this really
the best or only way? I've found something like the following in
Stein's Network Programming with Perl:
undef $!;
while ($data = <$fh>) {
# do something with $data
}
if (defined $!) {
# handle readline error
}
This is almost identical to my preferred way, but seems buggy because:
1) undef $! doesn't really undefine $! -- defined($!) returns true
after undef($!) !!
2) if the "do something" part sets $! then this will fail
The Camel 3rd edition doesn't seem to mention readline errors. What
about using $fh->eof or $fh->error. They don't seem to work quite like
I want to handle this case. But they don't seem to be documented well
enough for me to tell for sure.
-- John Wiersba
2. xml read Error (while reading xml file with foriegn characters) - Perl
3. read() and IO:File->read() error
I have a file I am reading and when I get to a certain point read() and IO::File->read() return undef. I know I have not reached EOF. Is there anywhere I can find out why it can't read() or trap an error? Thanks in advance MS
4. "Invalid method in request" errors in Apache error log, was error - Perl
5. Answer to: test/ hyperlink to an Error in a column
Have a large document, want to find where error is asap & hyperlink to it?
also below, example of in-document link, to get you back to same spot,
every-time.
ANSWER TO: Find Error result in column, where calculated (pick a start
point & exclude a range), Hyperlink to it (with row number as friendly name
in hyperlink)
=HYPERLINK(IF(AND(
ISNA(INDEX(ROW($AX$173:$AX$540)-ROW(AX173)+1,MATCH(TRUE,EXACT($AX$173:$AX$540,"X"),0))),
ISNA(INDEX(ROW($AX$567:$AX$1168)-ROW(AX567)+1,MATCH(TRUE,EXACT($AX$567:$AX$1168,"X"),0)))),"",
"#"&CELL("address",OFFSET(INDIRECT(SUBSTITUTE(SUBSTITUTE(CELL("address",$W14),"$",""),ROW(),"")&INDEX(ROW($AX$173:$AX$1168),MATCH(TRUE,EXACT($AX$173:$AX$1168,"X"),0))),$W$1,0))),
IF($BX$15>0,IF(AND(
ISNA(INDEX(ROW($AX$173:$AX$540)-ROW(AX173)+1,MATCH(TRUE,EXACT($AX$173:$AX$540,"X"),0))),
ISNA(INDEX(ROW($AX$567:$AX$1168)-ROW(AX567)+1,MATCH(TRUE,EXACT($AX$567:$AX$1168,"X"),0)))),"",
INDEX(ROW($AX$173:$AX$1168),MATCH(TRUE,EXACT($AX$173:$AX$1168,"X"),0))),"-"))
note: $W14 is the row that that formula resides in, W is column you want
cursor to end up in.
Quantity of Errors:
=IF($G$7="x",SUMPRODUCT(--(LEFT($AX$173:$AX$540,1)="x"))+SUMPRODUCT(--(LEFT($AX$567:$AX$1168,1)="x")),
SUMPRODUCT(--(LEFT($AX$173:$AX$540,1)="x"),--($G$173:$G$540<>"x")))+SUMPRODUCT(--(LEFT($AX$567:$AX$1168,1)="x"),--($G$567:$G$1168<>"x"))
SAMPLE: Test for errors:
=IF(AND(S9<>".",OR($G$7="x",G9<>"x"),OR(CP9={"",0})),"X",
OTHER:
=HYPERLINK("#"&CELL("address",OFFSET($A$69,-1,1)),"top")
IN-DOCUMENT Hyperlink: GETS YOU BACK TO EXACT SAME SPOT, EVERYTIME.
=HYPERLINK(IF(ROW($A$607)<(ROW($A543)-($W$1/2)),"#"&CELL("address",OFFSET($A$607,-1,1)),"#"&CELL("address",OFFSET($A$607,$W$1,1))),"A")
($A50 is row formula resides in)
Utility: $W$1 method for screen size / from freezepane (any # minus size
of freezepane = rows showing)
=48-CELL("row",$A$17)
6. Pb solved dmake.exe: Error code 255, while making 'test'
7. JPEG test error found w/ CPAN Upload: N/NI/NI-S/Tk-804.025_beta11.tar.gz
8. "make test" Error for the Tk version 804.027 (system RH9)