On 11/05/2011 01:38 PM, David Christensen wrote:
On 11/05/2011 02:00 AM, Uri Guttman wrote:
 > there was no actual error anywhere in his code.

Good. :-)


that was a very long post that missed the actual issue. ... he just
printed $! which happens to have some value in it (and all $! values
are some error text/number!).

Agreed. I was trying to figure out a way to make readline set $!, but
ended up with a sloppy mess that, upon further inspection, fails to save
$! after calling readline.

readline isn't a system call so it can't set $!.

$! maps to the errno of system calls and has both the text and numeric values of the actual error (only if one happens) of the last system call. perl itself can trigger errors in system calls easily but the internal errors don't set $! (they do set errno internally). e.g. loading a file that doesn't exist will generate a perl error (which can be caught with eval BLOCK) but the value of $! will still be meaningless.


 > <major snip>
also posting large chunks of the perldocs isn't too useful. post
appropriate snippets or refer to the docs instead.

1. http://en.wikiquote.org/wiki/Chinese_proverbs

授人以魚不如授人以漁(授人以鱼不如授人以渔)。(pinyin: Shòu rén yǐ yú bùrú
shòu rén yǐ yú)

* Literally: Teach a man to take a fish is not equal to teach a man
how to fish.
* Meaning: Give a man a fish and you feed him for a day. Teach a
man to fish and you feed him for a lifetime.


we all know that one. also you can build a fire and keep a man warm for a night or put him on fire and keep him warm for a lifetime! :)



2. I wanted to demonstrate my problem-solving process.

fine but point out the relevent docs or editing the quoted part is also showing skills. too much can be just as bad as too little.

3. Putting the perldoc output into the post makes for convenient reading.


and if every did that, no one would read the ginormous posts here. teaching newbies how to use the perldocs is a better approach.

4. 100 lines of documentation isn't too bad.

it is IMNSHO. :)

5. "RTFM print, $!, and readline" is curt, and inadequate for a newbie.


it was one post in a long thread. i was just demonstrating how you can print $! when there was no possible error. it didn't need to be longer than that.

6. Taking small pieces out of context can be misleading.

which is why editing the doc quote to the proper section to make a point is a skill to be learned. i have quoted the docs many times here but i try to keep it to a few lines or a paragraph and refer to the full doc for more (including context).

thanx,

uri

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to