At 10:27 AM 4/24/2001, you wrote:
>Another possible solution is to use Brian Ingerson's Inline.pm and code
>the reads &c. with C's lower level IO. I think a C getc() would do
>it....
>
>But be warned that, while it's actually quite friendly, a raw beginner
>might have some trouble with the Inline stuff, especially if they don't
>know C. I'd say look, maybe try, and decide based on your own
>confidence.
>
>Good luck.
Whoa there, Cowboy! : )
Inline is way cool, but it's not even really stable yet. I mess around
with it (when I want to be in awe of infinitely superior programming
prowess) but I don't think that people just getting into Perl want to be
worrying about things like finding the right .h file that defines their
system's getc function, and other such shenanigans. Plus, a lot of people
here might not even have a C compiler. (Remember, us Win32 punks usually
have to pay some bucks for a good one, or have to be compiler gurus
ourselves to get GCC set up.)
But all that's moot, considering that Perl has getc(), and will use your
system's if it can find it. But bear in mind, doing this you are bypassing
a lot of Perl's IO niceness, and will have to handle stuff that you don't
need to handle anyway. And it will break when you move the program
somewhere else, or if you decide you need to read Unicode or something.
So, I guess my point is, this is a solution, and TMTOWTDI, but there's a
pretty high bar to being able to implement this, not to mention that I
can't think of a really good reason to do it, beyond hubris, which usually
isn't a very good reason. I guess since this is a beginner's list we
should try to keep the ideas simple, flexible, and reliable.
I'm not suggesting that I'll always have the right answers. I've not been
writing Perl very long, and am discovering new stuff daily. I also have an
admittedly limited background in computer programming. But I think your
suggestion here isn't really a good one for a beginner, seeing as there is
a simpler way to the exact same functionality ( Perl's own getc() ) and
even that is harder to use than the module. Frankly, I was kinda scared of
the code put around getc() in the examples, and
Anyway, I just think we should keep advice (because that is really what we
are offering here) as generally useful and easy to follow as
possible. Just my $0.02.
Thank you for your time,
Sean.