[10546] in Perl-Users-Digest
Perl-Users Digest, Issue: 4138 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 3 03:07:23 1998
Date: Tue, 3 Nov 98 00:00:30 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 3 Nov 1998 Volume: 8 Number: 4138
Today's topics:
Re: custom log file parsing (Tad McClellan)
Re: custom log file parsing (Ronald J Kimball)
Re: general questions about perl from newbie birgitt@my-dejanews.com
Re: Installing large quantities of modules (Ilya Zakharevich)
Re: Loading Math::Random Module (Ronald J Kimball)
Re: Not to start a language war but.. (Sam Holden)
Re: Not to start a language war but.. (William Tanksley)
Re: Not to start a language war but.. (Sam Holden)
Re: Not to start a language war but.. <zenin@bawdycaste.org>
Re: Not to start a language war but.. <zenin@bawdycaste.org>
Re: Not to start a language war but.. <zigron@jps.net>
Re: Outputting HTML/JAVA SCRIPT though Server Side Incl (Martien Verbruggen)
Perl Upload Script Needed Badly (Tim Schaab)
Perl Usage Survey - early standings (Rich Morin)
Re: Reading a single line from a socket (Ronald J Kimball)
Re: Turning on/off "use diagnostics;" (Ronald J Kimball)
Re: use and require (Ronald J Kimball)
Win32::ODBC - field names dfk@my-dejanews.com
Re: Win32::ODBC - field names (Sam Holden)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 3 Nov 1998 00:38:04 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: custom log file parsing
Message-Id: <cc8m17.n96.ln@flash.net>
Harold Reed (hareed@bellsouth.net) wrote:
: I need to match up the PRE and POST sections and check values from each.
: print OUTPUT if /\[\[PRE/ .. /\[\[\/PRE/;
: but can't quite seem to get the things inbetween into a usable form. I tried
: reading in into a variable
: $variable = /\[\[PRE/ .. /\[\[\/PRE/;
: and then splitting the variable into array values, but no luck.
You have to build up each record yourself.
-----------------------------
#!/usr/bin/perl -w
while (<DATA>) {
$record = '' if /^\Q[[PRE/; # start a new record
$record .= $_ if /\Q[[PRE/ .. m#\Q[[/PRE#; # add line to record
if ( m#^\Q[[/PRE# ) { # process the record
print "==>$record<==\n\n";
}
}
-----------------------------
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 3 Nov 1998 01:26:59 -0500
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: custom log file parsing
Message-Id: <1dhw80f.a3qhxynal7a3N@bay1-440.quincy.ziplink.net>
[posted and mailed]
Harold Reed <hareed@bellsouth.net> wrote:
> I need to match up the PRE and POST sections and check values from each.
> From the Perl Cookbook, I gleaned:
> print OUTPUT if /\[\[PRE/ .. /\[\[\/PRE/;
>
> but can't quite seem to get the things inbetween into a usable form. I tried
> reading in into a variable
> $variable = /\[\[PRE/ .. /\[\[\/PRE/;
> and then splitting the variable into array values, but no luck.
In a scalar context, .. appears to return either the number of times
that it has evaluated to true, for a true value, or the null string, for
a false value.
For example:
foreach (qw(aaa bbb ccc ddd eee abc def ghi)) {
$x = /b/ .. /d/;
print "$x\n";
}
__END__
1
2
3
1
2
> Any suggestions?
How about:
push @pre, $_ if /\[\[PRE/ .. /\[\[\/PRE/;
If you document has multiple PRE and POST sections, you'll need to do it
a little different, in order to keep each section distinct.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Tue, 03 Nov 1998 06:59:19 GMT
From: birgitt@my-dejanews.com
Subject: Re: general questions about perl from newbie
Message-Id: <71m9k7$5k4$1@nnrp1.dejanews.com>
In article <71i43p$h1f$1@csnews.cs.colorado.edu>,
tchrist@mox.perl.com (Tom Christiansen) wrote:
>
> --tom, who thinks he'd better find himself a
> `Non-Technicalese as a Second Language' course
> really soon now.
It's there for free to you ....just listen to your kids
or grandparents....
What is this really - "programming" - my 79 year old mother asked me
yesterday ?
B.Funk
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 3 Nov 1998 07:05:30 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Installing large quantities of modules
Message-Id: <71m9vq$1g5$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to
<mlehmann@prismnet.com>],
who wrote in article <71m194$rb7$1@nnrp1.dejanews.com>:
> h2xs -A -X -n To_Much_Jolt
>
> This builds a directory tree for me, some boilerplate files, and a Makefile.PL
> file for me. I can easily install this one package with the commands:
>
> perl Makefile.PL
> make install
>
> But I will have dozens of these packages and I need to be able to
> conveniently tar them up into an install package, then move that code to
> multiple remote computers, untar the files on the remote machine, and then
> install all of the packages. How is this done. I've looked through the
Try coping the .pm files into the directory with Makefile.PL, add them
to MANIFEST, then type
make dist
Enjoy,
Ilya
------------------------------
Date: Tue, 3 Nov 1998 01:27:00 -0500
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Loading Math::Random Module
Message-Id: <1dhw8m6.iqobhx5uqxkgN@bay1-440.quincy.ziplink.net>
[posted and mailed]
Tien Pham <tpham@ee.gatech.edu> wrote:
> Recently I tried to load the Math::Random module
>
> (which I obtained from CPAN) but got no success.
>
> I got the following error message:
>
> -----------------
>
> Can't locate Math/Random.pm in @INC
>
> (@INC contains: /usr/local/lib/perl5.004/lib/sun4-solaris/5.00404
>
> /usr/local/lib/perl5.004/lib
>
> /usr/local/lib/perl5.004/lib/site_perl/sun4-solaris
>
> /usr/local/lib/perl5.004/lib/site_perl .) at example.pl line 4.
>
> BEGIN failed--compilation aborted at example.pl line 4.
>
> -------------------
>
> I tried to modify the code to include the path to Math::Random:
Yup, you've diagnosed the problem correctly.
Now let's get it fixed!
> #!/usr/local/bin/perl -w -I/home/tpham/tmp/MathRandom
>
> but got no success.
Is that really where the module is?
> I also tried to modify @INC explicitly
>
> ---------------------
>
> unshift (@INC, "/a/elijah/export1/home/tpham/tmp/Math");
That's almost certainly not where Math::Random is. If the file
Random.pm is in "/a/elijah/export1/home/tpham/tmp/Math", then
Math::Random is in "/a/elijah/export1/home/tpham/tmp", which is the
directory you should add to @INC.
> for $oho (0..$#INC) {
> print STDOUT "$INC[$oho]\n";
> }
> use Math::Random qw(:all);
But that way wouldn't work anyway. The unshift(@INC, ...) happens at
runtime, long after Perl has tried to execute use Math::Random, which
happens at compile time.
The proper way to add to @INC is:
use lib '/a/elijah/export1/home/tpham/tmp';
> ----------------------
>
> but also got no success. (Same error message).
>
> When I obtained the tar file from CPAN, after gunziping & untar, I got
>
> a dir called MathRandom. Since the error complains not be able to find
>
> the Math/Random.pm, I change MathRandom to Math. This still does not work.
Did you follow the instructions in the INSTALL file? There is probably
more you need to do to properly install the module.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 3 Nov 1998 05:02:37 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Not to start a language war but..
Message-Id: <slrn73t3jc.hgq.sholden@pgrad.cs.usyd.edu.au>
On Mon, 02 Nov 1998 11:45:06 -0700, Andrew Dalke <dalke@bioreason.com> wrote:
>(Figured that if I broke my vow not to enter this thread, I might
>as well continue.)
>
>The story thus far ....
<snip the story so far>
Oops snipped to far...
Sam wrote :
>> $SIG{__WARN__} can do whatever it likes with it (useful in things such
>> as CGI (though you should just use CGI.pm)).
>> [...]
>> So the equivelant python is...?
>
>(Even though we were talking about handling exceptions from "open",
>but I can deal with changes of subject.)
>
>This author, being of the masochistic sort, decided to implement the
>request by writing a Perl semantic emulation module. (MMmmmm. Beat
>me, hurt me, make me write bad checks!) Here's my solution (assuming
>for testing the code that surrounds it):
<snip code and output>
>I trust that is sufficent emulation? :)
That seems to do the trick . Well enough for me anyway.
Of course you would never actually do that in python, since in perl
$SIG{__WARN__} is called for warnings created by calling warn as well
as warnings created by perl itself (compile warnings for example).
This is of course because perl and python have chosen different routes,
I prefer perl's choice, everyone else in my office prefers python's.
> # I don't know the "real" way to get the caller's line number
> # but this works.
> try:
> 1/0
> except ZeroDivisionError:
> x = sys.exc_info()[2]
Had to leave this in since it is just nice... and I'm sure it will come
back and haunt you ;)
--
Sam
Can you sum up plan 9 in layman's terms? It does everything Unix does
only less reliably.
--Ken Thompson
------------------------------
Date: Tue, 03 Nov 1998 06:02:02 GMT
From: wtanksle@cx930311-b.ocnsd1.sdca.home.com (William Tanksley)
Subject: Re: Not to start a language war but..
Message-Id: <slrn73t72p.b16.wtanksle@cx930311-b.ocnsd1.sdca.home.com>
In article <71lvf0$6v3$1@csnews.cs.colorado.edu>, Tom Christiansen wrote:
> [courtesy cc of this posting sent to cited author via email]
>In comp.lang.perl.misc,
> wtanksle@cx930311-b.ocnsd1.sdca.home.com (William Tanksley) writes:
>:Perl supports passing scalars to a function... Sort of. Arrays? You're on
>:your own, try implementing your own function passing protocol.
>I beg your pardon? Who told you this very silly thing? It's
>so far from accurate that I cannot believe it's in an intentional lie.
Perhaps all those Perl book I've been reading ARE just that mendacious.
They're trying to make me stop learning Perl. :-)
Hmm, from your tone I can see that I've gotten a little too strident again.
Yup, my message did go overboard. My apologies; I've always had a problem
with judging the tone of my messages. Mea culpa.
>Therefore, I can only surmise that you don't understand pass-by-reference
>semantics. Please consult perlsub.
I understand them quite well. I use 'em, too. I wish that I didn't have to
understand them and type them every time in order to use them. The same
goes for so many of the little things. Yeah, I can learn to ignore them,
since the big things Perl does well are cool. Is that the correct solution,
though? Or are the things that look like minor, repeated irritations
actually the source of Perl's coolness?
I've seen many other languages that worked that way, and learned to like
them. Implicit parameter passing and total syntactic freedom in Forth
(disguised as RPN notation); syntactic smoothness and flexibility in Scheme
(disguised as lots of irritating spurious parentheses); and automatic
iteration in J and K (disguised as line noise). I hope I can learn to enjoy
Perl as much.
>:My point is that Perl is
>:not very good at handling data because it can't handle arbitrary structures
>:very well.
>:Don't get me wrong: it handles them, all you have to do is work with it.
>I dunno. I write things like
> $tv_show{"Flintstones"}{"kids"}[0]{"age"}++
You quite likely don't pass them to functions, though. What would the
recipient function look like?
sub whatever { my %tv_show = %{[$@_[0]]};
# yadda.
}
I sure am illiterate. Let me try that again.
my %tv_show = %{[shift]};
Doggone it, I wish I'd brought my book with me. It's nice to have more than
one way to do things, even this; I don't consider it so nice to not have any
simple ways to do what seems to be simple things. Sigh; I'm typing angry
again. I didn't mean that.
>Or even the classic linked-list traversal:
> for ($node = $head; $node; $node = $node->{LINK}) {
> printf "I am %d.\n", $node->{VALUE};
> }
>without having to "work with it" all that much. What's your gripe?
Linked lists are so cool that Perl provides them as a primitive type. Cool.
And then it doesn't let you pass them to functions unless you pass only that
one list. If you want to pass more than one list, you have to actually pass
references or some other trick. Why? There is some balancing benefit, right?
>--tom
-Billy
------------------------------
Date: 3 Nov 1998 06:16:19 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Not to start a language war but..
Message-Id: <slrn73t7ti.ma9.sholden@pgrad.cs.usyd.edu.au>
On Tue, 03 Nov 1998 06:02:02 GMT, William Tanksley
<wtanksle@cx930311-b.ocnsd1.sdca.home.com> wrote:
>In article <71lvf0$6v3$1@csnews.cs.colorado.edu>, Tom Christiansen wrote:
>
>>I dunno. I write things like
>> $tv_show{"Flintstones"}{"kids"}[0]{"age"}++
>
>You quite likely don't pass them to functions, though. What would the
>recipient function look like?
>
>sub whatever { my %tv_show = %{[$@_[0]]};
> # yadda.
>}
>
>I sure am illiterate. Let me try that again.
>
>my %tv_show = %{[shift]};
sub whatever { my $tv_show = shift;
# yadda
}
Is probably what I'd use, but I like references...
>Linked lists are so cool that Perl provides them as a primitive type. Cool.
>And then it doesn't let you pass them to functions unless you pass only that
>one list. If you want to pass more than one list, you have to actually pass
>references or some other trick. Why? There is some balancing benefit, right?
Where does perl provide linked lists as a primitive type?
I assume you mean arrays (which are completely different beasts).
The benefit is that perl's collapsing of multiple arrays into one array (which
it consistantly does in places other than subroutine calls) is extremely useful.
@bigarray = (@smallarray, @littlearray);
Is a great feature...
@standard_args = ( ... );
# now add things or remove things from @standard_args...
for $item (@array)
{
my_sub(@standard_args, $item);
}
Is very nice as well
--
Sam
Of course, in Perl culture, almost nothing is prohibited. My feeling is
that the rest of the world already has plenty of perfectly good
prohibitions, so why invent more? --Larry Wall
------------------------------
Date: 3 Nov 98 06:13:09 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Not to start a language war but..
Message-Id: <910073942.392381@thrush.omix.com>
Andrew Dalke <dalke@bioreason.com> wrote:
: The story thus far ....
: David Formosa <dformosa@zeta.org.au> mentioned a perl snippet he uses:
: > if (not open ARTICAL,"<$filename") {
: > warn "Can't open artical file $filename because $!";
: > next;
: > }
:
: Jason Orendorff <jorendorff@ixl.com> gave a solution in Python that
: used sys.stderr as a way to implement warn.
Which was incorrect, as Jason didn't understand what warn() really
does.
: Sam Holden <sholden@pgrad.cs.usyd.edu.au>, who is perhaps more
: knowledgeable about the details of Perl semantics than your typical
: Python developer said:
: > Except of course that warn does not have to output to stderr...
: > $SIG{__WARN__} can do whatever it likes with it (useful in things such
: > as CGI (though you should just use CGI.pm)).
>snip<
: Here's my solution (assuming for testing the code that surrounds it):
>snip<
: I trust that is sufficent emulation? :)
Close, very close.
>snip<
: # I don't know the "real" way to get the caller's line number
: # but this works.
: try:
: 1/0
: except ZeroDivisionError:
: x = sys.exc_info()[2]
*grin*
: def warn(message):
: # defer action to the current value in SIG
: # This lets someone else override it. Not very thread-safe,
: # if you ask me, but I guess you aren't :)
: action = SIG[__WARN__]
: if action:
: action(message)
Ahh, but %SIG is thread safe AFAIK. It is also scopeable:
$SIG{__WARN__} = sub { some handler, with lambda context binding }
...some code that warn()s...
{
local $SIG{__WARN__} = sub { some handler, with lambda context binding }
...code that warn()s
} ## back to $SIG{__WARN__} here, as we are out of the lexical block.
Harder to do with a class variable. You could reset it yourself of
course, but you still have the context binding issues.
>snip<
: Yeah, there's probable things I'm missing,
Yep. :-)
: like getting the right
: call parameters to the signal handler. But the point is, if you want
: to have specific semantics, wrap it up in a module and use those
: functions.
It's the best stab I've seen so far, and pretty darn close.
--
-Zenin (zenin@archive.rhps.org) From The Blue Camel we learn:
BSD: A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts. Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.) The full chemical name is "Berkeley Standard Distribution".
------------------------------
Date: 03 Nov 1998 06:42:49 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Not to start a language war but..
Message-Id: <910075415.593005@thrush.omix.com>
William Tanksley <wtanksle@cx930311-b.ocnsd1.sdca.home.com> wrote:
>snip<
: >I dunno. I write things like
: > $tv_show{"Flintstones"}{"kids"}[0]{"age"}++
:
: You quite likely don't pass them to functions, though. What would the
: recipient function look like?
:
: sub whatever { my %tv_show = %{[$@_[0]]};
: # yadda.
: }
:
: I sure am illiterate. Let me try that again.
: my %tv_show = %{[shift]};
I'd probably code that as:
my $tv_show = shift;
$tv_show->{some_key} = "some value".
If you need your own unique copy I'll admit it could be a bit funky,
but not too much.
>snip<
: Linked lists are so cool that Perl provides them as a primitive type. Cool.
: And then it doesn't let you pass them to functions unless you pass only that
: one list. If you want to pass more than one list, you have to actually pass
: references or some other trick.
Yes, you do, but it doesn't have to look that way:
$ cat foo.pl
sub foo (\@\@) {
my $one = shift;
my $two = shift;
$one->[1] = uc $one->[1];
$two->[2] = uc $two->[2];
}
my @one = qw(foo bar dog);
my @two = qw(this that baz);
foo (@one, @two);
print "@one @two\n";
$ perl foo.pl
foo BAR dog this that BAZ
--
-Zenin (zenin@archive.rhps.org) From The Blue Camel we learn:
BSD: A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts. Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.) The full chemical name is "Berkeley Standard Distribution".
------------------------------
Date: Mon, 02 Nov 1998 22:48:19 -0800
From: ZigroN <zigron@jps.net>
Subject: Re: Not to start a language war but..
Message-Id: <363EA733.E8FC1E21@jps.net>
Zenin wrote:
(snip)
> : Equivalent Python code:
> :
> : try:
> : article = open(filename, 'r')
> : except IOError, oops:
> : sys.stderr.write("Can't open article file %s because %s" %
> : (filename, oops.strerror))
> : continue
>
> Incorrect, this is not the same at all.
>
> The perl warn() can be cought by the caller with a WARN
> handler (eg, $SIG{'__WARN__'} = sub { handler_code }). This
> is highly useful for redirecting and reformatting code warnings
> to a more usable place then simply stderr. The CGI::Carp module
> uses this feature to add time stamps and other pretty formating
> to all warnings and exceptions that get written to the server's
> error logs as well as (on programmer's request) reformating errors
> for proper display to the browser (great for CGI debugging). This
> feature can even catch syntax errors and redirect/format them.
> Tk::Error is another fine example of this power in real world
> practice.
What precisely is stopping you from doing _Any_ of this in Python?
Now, I'm a Python newbie, and have never used Exceptions at all in my
code.
But, I know enough Python, and the basics of exceptions, to be able to
figure such things out.
Take this chunk of code:
> : sys.stderr.write("Can't open article file %s because %s" %
> : (filename, oops.strerror))
And that would just be the default thing to do. You don't have to
write it out to stderr; what's making you? If in your CGI program (a la
your example of what Perl's cgi program does) you want it to do
everything
which you described, timestamps, etc, simply add that in there instead
of
simply writing flatly out into stderr.
If you don't want to write out to stderr, you could just do nothing
and let the program continue as it was (or maybe try to open a different
file, or a "Default" file if that above file didn't work right.), or
..just..
do..anything.
I love Python :-) I just adore how you can customize, mimic, fake, and
do
basically annnything. :-)
--
Stephen Hansen
zigron@jps.net
http:// -- Homepage down temporarily :~(
ICQ: 8391641
"Live ye must, and let to Live"
"An harm ye none; Do as ye will"
!!! KTBSPA !!!
------------------------------
Date: Tue, 03 Nov 1998 05:20:27 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Outputting HTML/JAVA SCRIPT though Server Side Includes Perl file.
Message-Id: <vow%1.106$NU5.390653@nsw.nnrp.telstra.net>
In article <363e791a.41150253@news.mtt.net>,
dico@internetworks.ca (Dico Reyers) writes:
> Hello there...
>
> Is it possible to have a Server Side Included call that runs a perl
> script that output some stuff to the web page including java script?
Yes.
What happened when you tried?
> Or does the java script have to be part of the original HTML file?
No.
> Also, how does one print out a whole bunch of HTML through a perl
> script. Rather then typing...
>
> print "this that and the other thing\n";
> print "and then some more....\n";
> print "and yet some more...\n";
# perldoc perldata
/here-doc
A line-oriented form of quoting is based on the shell
"here-doc" syntax. Following a << you specify a string to
terminate the quoted material, and all lines following the
current line down to the terminating string are the value of
the item.
[snip]
The terminating string must appear by itself
(unquoted and with no surrounding whitespace) on the
terminating line.
[snip]
print <<EOF;
The price is $Price.
EOF
> Is there something where I can just type some Perl stuff and then cut
> and paste in a half page of HTML/Javascript and then end the pasting?
A text editor?
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: Tue, 03 Nov 1998 05:50:49 GMT
From: taschaab@students.wisc.edu (Tim Schaab)
Subject: Perl Upload Script Needed Badly
Message-Id: <363e9928.48982376@news.doit.wisc.edu>
Hi
I'm in need of a perl script to ulpoad binary files via the web.
I'm running the Pi3 Web server and am using Perl on windows. Any and
all help anyone can give me would be greatly appreciated. Please email
me at schaab@cs.wisc.edu if you have any information that can help me
out. Thank you very much.
Tim Schaab
------------------------------
Date: Mon, 02 Nov 1998 21:41:00 -0800
From: rdm@cfcl.com (Rich Morin)
Subject: Perl Usage Survey - early standings
Message-Id: <rdm-0211982141010001@140.174.42.30>
After only a couple of days, the Perl Usage Survey is starting to warm up a
bit. In fact, the odor of sweating camels has already caused some of our
more delicate audience members to retire to the delightful bistros that line
the avenues of our fair village.
So, for their benefit, here is an early report from the crowded, raucous
stadium (located at http://www.perl.org/cgi-bin/survey).
Linux, a "dark camel" entry from the crowded bazaar, has dominated the race
so far. This animal, of no certain breed, seems to have an overwhelming
energy and an imaginative, aggressive racing style. Clearly, this is a
camel to watch!
Grand Sultans Gates and McNealy are cheering on their contenders, WinStar
and Solaris. These pampered but powerful beasts are in a rough tie for
second place. WinStar's owner has been accused of cheating, however, and
his ultimate fate may lie with the judges...
Meanwhile, Mac OS and SunOS are slugging it out for fourth place. Mac OS
is a relative newcomer to Perl racing circles, but he is showing a brash
enthusiasm which may win him the crowd's attention in time. SunOS is an
old camel, no longer favored by Grand Sultan McNealy. He can still race
with the younger contenders, however, as the standings demonstrate!
HP-UX, a rather heavy-set animal, has sixth place free and clear. He has
the clear look of a long-distance slogger. It will take a real upset to
push him out of his place.
Finally, StarBSD and IRIX are in a pitched battle for seventh place, with
AIX and DecStar close upon their heels. It's a real fracas back there;
there's no way of predicting how it will turn out...
It's a real mess on the field, with Camels slogging through a track left
muddy by the early November rains. I'll have more reports as the race
continues -- don't touch that dial!
Respondents so far: 763
Top 10 most used platforms
Linux 459
Win 95, 98, NT 374
Solaris 343
MacOS 217
SunOS 217
HP-UX 137
Free-, Net-, OpenBSD 100
IRIX 100
AIX 91
DEC Unix, OSF/1 83
--
Canta Forda Computer Laboratory | Prime Time Freeware - quality
UNIX consulting, training, & writing | freeware at affordable prices
+1 650-873-7841 | +1 408-433-9662 -0727 (Fax)
Rich Morin, rdm@cfcl.com | www.ptf.com, info@ptf.com
------------------------------
Date: Tue, 3 Nov 1998 00:20:51 -0500
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Reading a single line from a socket
Message-Id: <1dhw4ux.wi3wil1yggkqjN@bay1-440.quincy.ziplink.net>
Justin B. Harvey <jbharvey@corp.home.net> wrote:
> Try making your pipes hot. This is a helpful idiom:
>
> $oldfh = select(S); $| = 1; select($oldfh);
>
> There is a very helpful article on making pipes autoflush "hot" in last
> month's Perl Journal, check it out.
The English name of the $| special variable is $OUTPUT_AUTOFLUSH.
I don't expect that setting it to 1 will be much help when using the
filehandle for *input*.
The best way to return only the first line is to read only the first
line.
print scalar <S>;
Beyond that, four-argument select() is called for.
(Or the IO::Select module.)
> keydet89@yahoo.com wrote:
> >
> > The server spits out a greeting, and then waits for user input...much
> > like SMTP. What I need to do is write a small testing script that will
> > connect to the port and return only the first line.
> > I have tried using:
> >
> > while(<S>) {
> > print;
> > }
> >
> > ...but that hangs b/c the server is awaiting for user input.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Tue, 3 Nov 1998 00:20:52 -0500
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Turning on/off "use diagnostics;"
Message-Id: <1dhw5ib.1ha6vnt1e041gjN@bay1-440.quincy.ziplink.net>
<junsc@sysic.hei.co.kr> wrote:
> if($debug) {
> use diagnostics;
> }
> ###############################
> But it seems that "use" isn't affected by the above branch scheme.
> Is there any way to accomplish this compiling diagnostics option.
use is a compile time directive. Long before the if statement is
evaluated, the diagnostics pragma has already been loaded.
Change 'use' to 'require diagnostics; import diagnostics;' and put the
whole thing in a BEGIN statement.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Tue, 3 Nov 1998 00:20:53 -0500
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: use and require
Message-Id: <1dhw5s1.14xx57k1u6lj6dN@bay1-440.quincy.ziplink.net>
Nico <info@edoc.co.za> wrote:
> when does one use "use" and when "require"?
'use' is simply a 'require' and an 'import' in a BEGIN{} block.
Use whichever is appropriate for your needs.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Tue, 03 Nov 1998 06:23:19 GMT
From: dfk@my-dejanews.com
Subject: Win32::ODBC - field names
Message-Id: <71m7gn$2se$1@nnrp1.dejanews.com>
I have an MS Access 97 database table (fields are: GazetteerID, ID, Sequence
and f-bd-entry) that I am trying to manipulate with Win32::ODBC from perl.
When my perl SQL statement is:
$sql_statement = "SELECT GazetteerID, ID, Sequence FROM BIDATA_entries";
everything is fine (ie. perl/odbc works) and I can manipulate the data.
But when I want to include the f-bd-entry field using the following SQL
statement:
$sql_statement =
"SELECT GazetteerID, ID, Sequence, f-bd-entry FROM BIDATA_entries";
I get the following Win32::ODBC error:
Error Number: -3010
Error String: [Microsoft][ODBC Microsoft Access 97 Driver] Too Few
Parameters. Expected 3.
Connection Number: 1
Can anyone tell me what I am doing? I guess that it must have something to do
with escaping the f-bd-field name.
Thanks in advance,
Daniel
PS: A SELECT * statement is not an option as I want to add the following
'WHERE f-bd-entry like "AFA %"' to the above SQL statement.
-------------------------------------------------------------------------------
Daniel Koehne
PO Box 915
Kensington, NSW 2033
-------------------------------------------------------------------------------
Australia
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 3 Nov 1998 06:39:35 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Win32::ODBC - field names
Message-Id: <slrn73t997.ndu.sholden@pgrad.cs.usyd.edu.au>
On Tue, 03 Nov 1998 06:23:19 GMT, dfk@my-dejanews.com <dfk@my-dejanews.com>
wrote:
> $sql_statement =
> "SELECT GazetteerID, ID, Sequence, f-bd-entry FROM BIDATA_entries";
>
>I get the following Win32::ODBC error:
> Error Number: -3010
> Error String: [Microsoft][ODBC Microsoft Access 97 Driver] Too Few
> Parameters. Expected 3.
> Connection Number: 1
>
>Can anyone tell me what I am doing? I guess that it must have something to do
>with escaping the f-bd-field name.
You could try something like :
SELECT GazetteerID, ID, Sequence, [f-bd-entry] FROM BIDATA_entries
I've found that some of my fields need to be put in []s for Access (which of
cource makes it work for only Access) when for some reason or another Access
doesn't like the real name. Spaces in the name are one example. A field
called 'Note' was another recent case which burnt me.
Sorry I can't test, but thankfully I'm far away from a windows machine...
--
Sam
So I did some research. On the Web, of course. Big mistake...
--Larry Wall
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 4138
**************************************