Bernie Cosell said:
}
} The only needed addition is 'do not use this, use IO::Select instead'.
I disagree -- perhaps *AFTER* you clearly document how it actually works
and how it is supposed to be used you could refer users to
IO::Select,
The point is that it *isn't* supposed to be used. Since IO::Select was
made core, the select function it is based on should really be
considered internal to that module.
but having a ref like that in *place* of documenting the machinery
just ain't right, IMO
So do you want documentation on how 'use strict' works, or
Filter::Util::Call? The point of these modules is that you don't need
to know how the internals work.
I'll note that it was basically impossible [probably still is] to
figure out quite how "use vars" works -- the necessary tricks [which
I can't even remember] just aren't documented, and reading the code
for 'use vars' doesn't reveal the magic
Ummm.... as far as I can see it's perfectly clear. 'use vars
qw/$foo/;' (called from package 'My:
ack') chops the '$' off '$foo',
makes sure it's fully qualified, does some error checking and then
executes
*My:
ack::foo = \$My:
ack::foo;
.. The reason why this stops the error is not explained anywhere in the
perl docs, I grant you, but it isn't hard to figure out. strict 'vars'
gives an error for a given package variable iff it doesn't already
exist in the symbol table (at compile time). The expression above
causes the entry for $My:
ack::foo to be created; as it's happening
in a 'use' statement, code that is after it in the file will be
compiled with that variable existing.
At the risk of sounding arrogant, I would say that if you can't work
that out for yourself you are better off not knowing it. Hell, I
worked that out for myself and *I'd* probably be better off not
knowing it: certainly, I avoid using that knowledge whenever I can
(basically, always).
I'd prefer that there were _fewer_ "this is magic, use the module"
parts of Perl rather than more...
The point is that core modules like 'strict', 'vars', 'IO::Select' and
'IO::Socket' should be considered part of the Perl language, in the
same way as stdio is considered part of C. You do not need to know how
they work, just as you do not need to know how perly.c works.
If you want to find out, feel free to read the source and do so, and I
for one will be more than happy to tell you what I know (which isn't
much); but be careful to distinguish between 'finding out how the
internals work for curiosity's sake' and 'finding out how the
documented interface works for the sake of using it'.
Ben