Bernie Cosell said:
I notice that you skipped over the comment about your patronizing Lucy
science lecture: indeed, I had done that same analysis (which is hardly
difficult) and STILL couldn't figure out why use vars worked but the
version I needed wouldn't.
This is mostly because the term 'Lucy science lecture' is not one I am
familiar with: I take it refers to the fact that my analysis, although
perhaps convincing, was incorrect? I apologise. As I said, I don't
think the final step was that hard to figure out, either.
[and it still leaves me a bit mystified
as to WHY the simple global-assignment doesn't work, but the
global-assignment *across* a package does. that means that somehow when
you do "$pack::var" perl does something a tiny bit different if you're *in*
package 'pack' or in some other package... Odd...
)]
Think about it. Use strict has to shout at you about using a global
unless
1. you have declared it with our,
2. it is fully qualified, or
3. it has been exported by some module.
This odd behaviour covers case 3, of which use vars is a special case.
} This is what I mean by 'modularity'. use vars is *not* a library: it
} is part of the language. The same goes for IO::*.
Gad, I hope you won't be part of the core implementation group -- I can
only assume that you'll argue that the documentation for 'open' should be
removed, since IO::File is "part of the language".
I don't think that documentation should ever be removed, unless it is
confusing and does more harm than good. I have also never used
IO::File, and (since the development of lexical FHs) can't see any
reason why I ever should.
} > I don't understand your point.
}
} Things that are undocumented are undocumented because they are not for
} public use....
You think that 'select()' shouldn't be for public use? None of the
available docs even hint at such a thing...
About the only sensible point in this discussion... yes, I was
suggesting that direct use of select() should be deprecated in favour
of IO::Select. I would say the same of IO::Socket and the low-level
socket functions.
} Myopic I may be (-10 and -12 dioptres, with astigmatism
, but I am
} not narrow-minded; and I have *certainly* never taken an undergraduate
} OOP class.
Well, sounds like it on two fronts:
1) you're apparently an advocate that there should only be ONE way to do
things. IO::File is there, and the direct use of 'open' is now, in your
world, deprecated. [oh, sorry, you were just making the parallel arg about
IO:Select and select()..
)]
There is an important difference between IO::Select and IO::File,
which is that IO::Select actually does something useful. As you found
out, doing a low-level select call yourself is fiddly and requires
some rather cryptic and unintuitive, not to mention C-like, operations
to construct the arguments and get the data back out. IO::Select is a
very thin wraper around that, that provides a Perlish interface. I'd
be willing to bet that if perl hadn't had select in the first place,
and IO::Select where to be implemented now as an extension, the
interface would be much as it is now; perhaps with a note in the
documentation saying 'the underlying select(2) call is available as
IO::Select::sysselect'.
IO::File, OTOH, gives you nothing over a simple open: indeed, I find
my $fh = IO::File->new("< file");
substantially harder to read than
open my $FH, "< file";
..
2) the recommendation at hand, to use IO::Select, basically forces a
[relatively] behemoth OO package
!!! hardly. Have you read the source? I can't be bothered to benchmark
it, but I bet if you did it would be no slower than doing all the
vec() stuff by hand.
down our throats, even if we happen not to want to be doing OO right
there -- again, the usual stance of the pedant, who believes that OO
is the only-true-right way to accomplish any task.
This is mudslinging, so I will only say that until I found Perl's OO,
which lets you do OO when it's convenient and not when it's not, I
would have said that OO was not something I would want to use.
It is one thing to carp about $^H, which is clearly documented:
$^H WARNING: This variable is strictly for internal
use only. Its availability, behavior, and con
tents are subject to change without notice.
but in IO::Select, it just says:
The "IO::Select" package implements an object approach to
the system "select" function call.
Which hardly sounds like "THIS IS THE ONLY APPROVED WAY TO DO SELECT IN
PERL", does it?
No. What I was suggesting was that, since the documentation for select
is (apparently) cryptic and inadequate to enable anyone without
intimate knowledge of perl internals to use it, it be changed to say
something more along those lines. Then perhaps we wouldn't get muppets
here asking questions whose answers require nothing more than a small
amount of thought.
Ben