[12478] in Perl-Users-Digest
Perl-Users Digest, Issue: 6079 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 21 15:07:17 1999
Date: Mon, 21 Jun 99 12:01:31 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 21 Jun 1999 Volume: 8 Number: 6079
Today's topics:
Re: Problem with DB_File (Anno Siegel)
Re: problems receiving datastream via a socket <trader@underwear.heuristics.com>
Question about TTY's... (Mitch)
Re: Question about TTY's... <aperrin@mcmahon.qal.berkeley.edu>
Re: Search script performance (Benjamin Franz)
Re: Statistics for comp.lang.perl.misc (Lee)
Re: Statistics for comp.lang.perl.misc (Randal L. Schwartz)
Re: Total Newbie Question <jddemme@technologist.com>
Trying again... (Mitch)
What is First line in Perl5 in Sun Micro... (Sai Chimakurty)
Re: What is First line in Perl5 in Sun Micro... (Dave Cross)
Re: When is Sybperl a good choice (Abigail)
Re: why wont this work? (Michael Stevens)
Re: why wont this work? <aqumsieh@matrox.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 21 Jun 1999 18:26:56 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Problem with DB_File
Message-Id: <7km05g$8eo$1@lublin.zrz.tu-berlin.de>
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote in comp.lang.perl.misc:
>Well, I'm having a whale ( tr/aew/el/d ) of a time debugging this
>DB_File application. I'll reproduce a complete demo script at
Well, apparently there is indeed a bug in some versions of Berkeley DB.
Paul Marquess, whom some of you may know, sent me mail to that effect,
saying that he could reproduce the buggy behavior with v 1.85, but
not with 2.7.5. The version I used is 2.0.7, so apparently it was
fixed some time in between.
So far, I had no luck linking 2.7.5 (available from www.sleepycat.com)
to perl. The interface has changed and the dbopen function perl
expects is no longer supported. So I guess I'll have to rebuild
perl in the bargain. And here I thought dynamic linking was there
to avoid this sort of thing...
Anno
------------------------------
Date: Mon, 21 Jun 1999 14:27:12 -0400
From: trader <trader@underwear.heuristics.com>
Subject: Re: problems receiving datastream via a socket
Message-Id: <376E8400.5014849C@underwear.heuristics.com>
Tom Phoenix wrote:
>
> On Wed, 16 Jun 1999, trader wrote:
> > united parcel service has an on-line shipping calculator where you can
> > post some variables about a shipment and it will return the shipping
> > cost. in the instructions ups provides, there's a perl script that
> > supposedly can be implemented so you don't have to access their cgi
> > through a web browser. here's a snippet of the code they've supplied:
> >
> > $AF_INET = 2;
> > $SOCK_STREAM = 2;
> > $sockaddr = "S n a4 x8";
>
> They should really be using LWP::Simple.
>
ok, i got it to work but used LWP::UserAgent instead of Simple. also, i
used the POST method instead of the GET method (which ups recommended).
the socket script they provided simply does not work. thanks for the
advice on the LWP module.
if anyone is interested in the script that works, email me directly to
request it.
--
The views expressed above are not necessarily shared by anyone else on
the planet.
Email address spam protected, remove underwear to reply.
------------------------------
Date: Mon, 21 Jun 1999 17:18:40 GMT
From: portboy@home.com (Mitch)
Subject: Question about TTY's...
Message-Id: <376df490.224971261@24.0.3.71>
So, if I'm spewing information from my script out say TTY01, how can I
tell if a user has shorted TX/RX? So, in theory, iIf someone were
to short RX and TX on the TTY (either directly, by connecting pins 2+3
or by connecting a modem with echo turned on, I don't want the script
to run away sending a 'syntax error' and then reading that as input
and issueing another 'syntax error' (and so on...). A long wire with
no termination can do this sometimes too.
So, I understand the crux of the problem (the easy part), now I have
no clue of figuring out how to do this in perl. Currently, I'm
opening the tty when the program starts like this:
$in = shift;
if ($in =~ "local") {
$tty = "/dev/tty";
} elsif ($in =~ /tty01/i) {
$tty = "/dev/$in";
} else {
$tty = "/dev/tty00";
}
open(STDOUT,">$tty");
open(STDERR,">/dev/null");
open(STDIN,"<$tty");
So, when you startup the script you'd do something like:
perl command.pl tty00
Does anyone have some suggestions about figuring out whether or
nothing the tty?? was shorted out?
Thanks again, Mitch.
------------------------------
Date: Mon, 21 Jun 1999 10:32:38 -0700
From: Andrew J Perrin <aperrin@mcmahon.qal.berkeley.edu>
Subject: Re: Question about TTY's...
Message-Id: <376E7736.AF6D0924@mcmahon.qal.berkeley.edu>
Well, if I understand you right you're worried about a sort of loop where
you'll be simply receiving echoes of your own transmits. How about
checking this periodically (or perhaps just once at the beginning),
something like:
print "$$.testpacket.$$\n";
and see if you get it back Including the $$ (the script's pid) will give
you a pretty good chance that your remote machine doesn't happen to be
sending that string by chance; if you're worried you could make it more
unique, say by squaring, cubing, etc., the pid.
Andy Perrin
Mitch wrote:
> So, in theory, iIf someone were
> to short RX and TX on the TTY (either directly, by connecting pins 2+3
> or by connecting a modem with echo turned on, I don't want the script
> to run away sending a 'syntax error' and then reading that as input
> and issueing another 'syntax error' (and so on...).
-------------------------------------------------------------
Andrew J. Perrin - NT/Unix/Access Consulting - (650)938-4740
aperrin@mcmahon.qal.berkeley.edu (Remove the Junk Mail King)
http://www.geocities.com/SiliconValley/Grid/7544/
-------------------------------------------------------------
------------------------------
Date: Mon, 21 Jun 1999 17:03:07 GMT
From: snowhare@long-lake.nihongo.org (Benjamin Franz)
Subject: Re: Search script performance
Message-Id: <ffub3.27$Rj1.14252@typhoon-sf.snfc21.pbi.net>
In article <377536d1.174057@news.skynet.be>,
Bart Lateur <bart.lateur@skynet.be> wrote:
>[cc'ed]
>rumple1000@my-deja.com wrote:
>
>>I have a Perl search script which takes a long time to find keywords in
>>a bunch of files.
>>
>>The html files are about 3000 (about 2-3k each) and are stored a very
>>complicated and deep structure of nested subdirectories.
>>
>>Would this structure of subdirectories affect the performance of the
>>script which uses find.pl inside it to recurse all the subdirectories?
>>
>>Would this search be faster if all the files were stored in one
>>directory?
>
>No, I wouldn't think so. I think it's the opening, reading and parsing
>of the files themselves, that takes a lot of time.
>
>I think you'd better use an index mechanism, and sort that. Try to find
>a copy of Doctor Dobbs Journal, january 1999, which contains the articla
>"full-text searching in Perl" by Tim Kientzle. If you can't find it, or
>you're a cheapo ;-), at least download the code from the article from
>DDJ's website (www.ddj.com). The concept is simple: [A] you number the
>files; [B] you create a (disk-stored) hash of ALL keywords found in any
>file, plus as values a list of all files in which it was found. That's
>it. When you need all files that contain two keywords, look up the
>intersection of the two lists, and convert those file numbers back to
>files/URL's.
However, you could be lazy and use the newly released and really neat
Search::InvertedIndex module from CPAN to do the actual grunt work.
ObDisc: I wrote the module so I could be biased as to its neatness. :)
--
Benjamin Franz
------------------------------
Date: Mon, 21 Jun 1999 12:17:34 -0500
From: rlb@intrinsix.ca (Lee)
Subject: Re: Statistics for comp.lang.perl.misc
Message-Id: <B393DDDE9668DA7A8E@204.112.166.88>
In article <m1yahdtu8e.fsf@halfdome.holdit.com>,
merlyn@stonehenge.com (Randal L. Schwartz) wrote:
>You are really gonna have to add some AI to recognize Abigail's
>peculiar quoting style. Either that, or a cancelbot to kill Abi's
>postings because they don't fit Usenet tradition. :)
I was under the impression that anarchy was one of the oldest and finest of
Usenet traditions.
Lee
------------------------------
Date: 21 Jun 1999 10:30:48 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Statistics for comp.lang.perl.misc
Message-Id: <m1lnddtq9j.fsf@halfdome.holdit.com>
>>>>> "Lee" == Lee <rlb@intrinsix.ca> writes:
Lee> I was under the impression that anarchy was one of the oldest and finest of
Lee> Usenet traditions.
Usenet is a cooperative anarchy. I don't understand Abi's motivations
for being uncooperative, but it means tools like Greg's have to catch
up. :)
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Mon, 21 Jun 1999 14:14:24 -0400
From: JDDemme <jddemme@technologist.com>
Subject: Re: Total Newbie Question
Message-Id: <376E8100.4F8B4EF6@technologist.com>
Here's the deal:
you asked where the cgi-bin is, but they gave you the location of perl!
the cgi-bin is a directory where you usually place your cgis, so if it's
not in your directory, and you don't have access to it, this could mean
two things.
first: you're not allowed to use cgi's
second: you can run you cgi's anywhere as long as the permissions are
set correctly.
contact you webmaster to find out more
If the second is true, I'd suggest you create a cgi-bin directory
anyway.
JDDemme
jddemme@technologist.com
webb meister wrote:
>
> Where should the cgi bin reside on my hosts server. Should it be in my
> directory. They say it is in "c:\usr\bin\perl" which is not in my
> directory and I cannot access. I know this is a dumb question but I
> have to start somewhere.
>
> Thanks
> mike@riofrio.com
------------------------------
Date: Mon, 21 Jun 1999 18:59:30 GMT
From: portboy@home.com (Mitch)
Subject: Trying again...
Message-Id: <376e120b.232518403@24.0.3.71>
Hello again,
I have a couple questions regarding reading in of a configuration
file... Here is a brief snapshot of what the configuration file might
look like:
coke enable
pepsi disable
mountdew is okay
coke sucks forever
password foobar
Here is some code that I'm using to read in the configuration file:
sub read_config
{
my $cfg = shift;
open(CFG, $cfg) or die "damn't $!";
while(<CFG>) {
chomp;
s/#.*//;
s/^\s+//;
s/\s+$//;
next unless length;
my ($var, $value) = split ' ', $_, 2;
#$config{$var} = $value;
++$config{$var};
close(CFG);
return;
}
So, when I attempt to write out what the variables with something like
this:
while (($var, $value) = each(%config)) {
print "$var : \n";
while (($key2,$value2) = each (%{$config}))
{
print "\tthe var is $key2 and value is
$value2\n";
}
}
I get:
coke :
pepsi :
pass :
All of these are simply the variable names...So, being that I am kind
of braindead and learn better from looking at examples (of stuff that
will work for me), how can I print out what the settings for coke,
pepsi, and pass are. Also, how can I add another coke variable like:
coke bites
At the same time, how can I check to see if coke bites already exists?
Thanks again,
mitch
------------------------------
Date: 21 Jun 1999 18:05:59 GMT
From: saic@shirdi.corp.sun.com (Sai Chimakurty)
Subject: What is First line in Perl5 in Sun Micro...
Message-Id: <7kluu7$n6m$1@corpnews1.Corp.Sun.COM>
Hi,
I have a Perl5 script. I have in the first line
#!/usr/dist/exe/perl5 -w. But it doesn't seem to work. Can any
one help me in telling me the right path of putting in the
first line for perl5 program.
Thank you in advance.
Thanks & Regards,
Sai Chimakurty Email:Sai.Chimakurty@Sun.com
*****************************************
Loss of Sincerity is loss of vital power.
*****************************************
------------------------------
Date: Mon, 21 Jun 1999 18:49:49 GMT
From: dave@dave.org.uk (Dave Cross)
Subject: Re: What is First line in Perl5 in Sun Micro...
Message-Id: <376f88a6.3825330@news.demon.co.uk>
On 21 Jun 1999 18:05:59 GMT, saic@shirdi.corp.sun.com (Sai Chimakurty)
wrote:
> I have a Perl5 script. I have in the first line
> #!/usr/dist/exe/perl5 -w. But it doesn't seem to work. Can any
> one help me in telling me the right path of putting in the
> first line for perl5 program.
It really depends where Perl has been installed on your system. It's
impossible for anyone here to know. Best you ask your system
administrator.
Good luck,
Dave...
--
Dave Cross <dave@dave.org.uk>
<http://www.dave.org.uk>
------------------------------
Date: 21 Jun 1999 09:34:58 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: When is Sybperl a good choice
Message-Id: <slrn7msjcc.k1b.abigail@alexandra.delanet.com>
Nostradamus (mboertien@my-deja.com) wrote on MMCXX September MCMXCIII in
<URL:news:7klb1n$8sc$1@nnrp1.deja.com>:
~~ At the moment i am investigating whether or not it is usefull to start
~~ using perl and sybperl to write some scripts with. Before i programmed
~~ things in shell scripts which just called isql. Problem with this was
~~ that it was quite difficult to get multiple values back.....so now i am
~~ looking into perl together with sybperl.....could anyone give me some
~~ advice on this?
Sybperl comes with pretty good documentation. It also contains a link
the Michael Peppers (I think I spelled this wrong) homepage, which has
lots of additional information.
Sybperl is very easy and convenient to use; I use it daily.
Abigail
--
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
print } sub __PACKAGE__ { &
print ( __PACKAGE__)} &
__PACKAGE__
( )
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 21 Jun 1999 17:03:46 GMT
From: mstevens@wildcat.imaginet.co.uk (Michael Stevens)
Subject: Re: why wont this work?
Message-Id: <slrn7mssau.nu.mstevens@wildcat.imaginet.co.uk>
On 20 Jun 1999 23:13:34 -0500, Abigail <abigail@delanet.com> wrote:
>ted fiedler (tfiedler@ptd.net) wrote on MMCXIX September MCMXCIII in
><URL:news:4wdb3.2647$I72.345843@nnrp1.ptd.net>:
>`` why isnt this working the file is in the same dir as the program...?
>`` #!/usr/bin/perl -w
>`` use strict;
>`` open(TESTFILE, "> test3_med.dat") || die"Cannot open test3_med.dat: $!\n";
>`` while(<TESTFILE>) {
>`` print"File opened successfully"; }
>`` close(TESTFILE);
>Why are you trying to read from a file that you have opened for reading?
Seems like a sensible enough move to me. Now, trying to read from a file
opened for writing is an entirely different thing...
(wow! I got to correct abigail, even if it was on something trivial..)
------------------------------
Date: Mon, 21 Jun 1999 11:08:39 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: why wont this work?
Message-Id: <x3yzp1td214.fsf@tigre.matrox.com>
"ted fiedler" <tfiedler@ptd.net> writes:
> open(TESTFILE, "> test3_med.dat") || die"Cannot open test3_med.dat: $!\n";
> while(<TESTFILE>) {
> print"File opened successfully"; }
> close(TESTFILE);
Check out the docs for open(). You are opening the file in write-only
mode, and then you're trying to read from it.
------------------------------
Date: 12 Dec 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 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 6079
**************************************