[7568] in Perl-Users-Digest
Perl-Users Digest, Issue: 1194 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 18 19:07:17 1997
Date: Sat, 18 Oct 97 16:00:23 -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 Sat, 18 Oct 1997 Volume: 8 Number: 1194
Today's topics:
Re: 2000 time problem <flavell@mail.cern.ch>
CGI.pm problem on NT 4.0 <montelen@ix.netcom.com>
Deleting entries out of DBM files using Perl <vinbetro@vantek.net>
Re: exp1 ? exp2 : exp 3 -- whats wrong? <rick.delaney@shaw.wave.ca>
Re: Getting PERL for NT and installing it. (Greg Zevin)
Help me, please! <nprokofiev@wperiod.ru>
how would you write a cgi or perl that would do this.. <paradigm@interlog.com>
Re: how would you write a cgi or perl that would do thi <friedman@uci.edu>
ITS AWESOME (W. K. Stone)
Re: Lookbehind <ajohnson@gpu.srv.ualberta.ca>
more map/grep/for benchmarks <friedman@uci.edu>
Re: PERL : diff utility for NT <rothd@roth.netX>
Re: perl on NT4 and ... (Danny Aldham)
serial IO weirdness (Chris Ochs)
Re: serial IO weirdness (David Efflandt)
Re: Server Error (David Efflandt)
setuid doesn't change UID's? <ingo@blank.pages.de>
Re: sorting a hash (Dave Schenet)
Using undefined match results? (Michael Schuerig)
Using/learning Perl for dos/WFW and NT 3.51 mlinvle@inlink.com
Re: WinNT and Perl question (Gurusamy Sarathy)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 18 Oct 1997 17:11:16 GMT
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: 2000 time problem
Message-Id: <Pine.A41.3.95a.971018185859.79510G-100000@sp049>
On Fri, 17 Oct 1997, Doug Seay wrote:
> Perhaps, but the fundamental problem is when 2 digit years were spec'd
> that way. That is a language constraint.
Several times in my life I've had my electricity or gas meter
reach 99999 and move on to 00000; never once has the utility company
had a problem with billing me correctly for it. What's the problem?
As far as recording historical dates, we already _have_ the problem.
I can well believe the news story about the school inspector visiting
a 105-year old great-grandmother to find why she hadn't registered to
start school, but that has nothing to do with computers as such.
------------------------------
Date: Sat, 18 Oct 1997 14:20:22 -0700
From: "Monte L. Leng" <montelen@ix.netcom.com>
Subject: CGI.pm problem on NT 4.0
Message-Id: <34492816.1FC58501@ix.netcom.com>
I am tasked with porting from UNIX to NT4.0. I have installed Win32
Perl from ActiveWare, and am running O'Rielly WebSite Pro 2.0 for the
server on NT. I have followed all FAQ's and instructions that I can
find. Most of my scripts run fine, but when I attempt to use the CGI.pm
module, I continually get:
"500 Server Error
The server encountered an error and was unable to complete your request.
Message: CGI output from C:/WebSite/cgi-shl/jobadmin/jobadmin.pl
contained no blank line separating
header and data (most likely a broken CGI program)"
Even the most simple program that uses CGI.pm won't work. I have made
the file associations for ".pl", and placed the ".pl" files in cgi-shl
(cgi-bin). I have made sure the $OS variable is set in CGI.pm. If I
don't use CGI.pm, and use cgi-lib.pl, this error does not occur. Any
suggestions?
------------------------------
Date: Sat, 18 Oct 1997 17:13:41 -0500
From: "Vince Betro" <vinbetro@vantek.net>
Subject: Deleting entries out of DBM files using Perl
Message-Id: <62bcdq$op8$1@news.socomm.net>
I am trying to delete an entry out of a DB file created by a Perl script.
The entries are ordered by username. I've tried the code below to do it,
but it won't work. How am I supposed to do it?
#!/usr/bin/perl
require ("process_cgi.pl");
&parse_input(*fields);
dbmopen(%users,"users",0666);
delete $users{$fields{'deluser'}};
&print_header;
print<<End_of_Delete_User;
<HTML>
<HEAD><TITLE>$fields{'deluser'} deleted.</TITLE></HEAD>
<BODY
BACKGROUND="http://www.vantek.net/pages/gbostian/c-tek/icons/Background.gif"
>
<CENTER><H1>$fields{'deluser'} has been deleted successfully.</H1>
<a href="http://www.vantek.net/pages/vinbetro/c-tek/admin/">Click here to
return to administration page.</a></CENTER><p>
$users{$fields{'deluser'}}
</BODY>
</HTML>
End_of_Delete_User
exit;
Thanks.
Jeff Betro
----------------------------------------------------
C-Tek Partner in Ownership
Head of Technical, Billing, and Startup Departments
----------------------------------------------------
Personal Addresses
vinbetro@vantek.net
jvbetro@rocketmail.com
----------------------------------------------------
Business Address
ctek@rocketmail.com
----------------------------------------------------
** C-Tek Web Design Services
<http://www.vantek.net/pages/vinbetro/c-tek/>
** Postcard Central
<http://www.vantek.net/pages/gbostian/postcard.htm>
** The Cleveland Indians Page
<http://www.vantek.net/pages/vinbetro/index.html>
** Jeff's Sound Collection
<http://www.vantek.net/pages/vinbetro/cool.htm>
** The Betro's Italian Page
<http://www.vantek.net/pages/vinbetro/italian.htm>
** Come and sign our guestbook
<http://www.vantek.net/pages/vinbetro/guest.htm>
** AOL Instant Messenger Screen Name : jvbetro
----------------------------------------------------
------------------------------
Date: Sat, 18 Oct 1997 13:50:07 -0400
From: Rick Delaney <rick.delaney@shaw.wave.ca>
To: Janning Vygen <Janning.Vygen@bonn.netsurf.de>
Subject: Re: exp1 ? exp2 : exp 3 -- whats wrong?
Message-Id: <3448F6CF.47AFFB8E@shaw.wave.ca>
Janning Vygen wrote:
>
> following perlscript doesnt work correctly to me:
> -------------------------------
> #!usr/bin/perl
> print "content-type: text/plain\n\n";
> $flag=1;
>
> # first condition
> if ($flag==1) {$color="blue";} else
> {$color="red";} # output should be "1: blue"
> print "1: $color \n";
>
> # second condition
> $flag==1 ? $color="blue" : $color="red";
> # output should be "2:blue" but it is "2: red" !!!!!!!
> print "2: $color \n";
>
The assignments are done before the conditional ?: (see the perlop man
pages for order of ops). So $color eq "red".
> # third condition
> $flag==1 ? print "3: blue \n" : print "3: red
> \n"; # output should be "3: blue"
> -----------------------------------------------------
>
> the second condition is true, but the output is
> "2: red".
> Did I forget any brackets??
Yes. Try:
$flag==1 ? ($color="blue") : ($color="red");
Rick
------------------------------
Date: 15 Oct 1997 09:59:00 +1000
From: greg@turing.une.edu.au (Greg Zevin)
Subject: Re: Getting PERL for NT and installing it.
Message-Id: <621104$8mb@turing.une.edu.au>
Julio Rafael Escobar <escobar@oxy.edu> writes:
:Hi everyone,
:I am very interested in learning PERL. I have written some batch files,
:but I find that they are limited in power. Can someone tell me how I
:can get PERL for NT 4.0 and install it. I may have it in the NT
:Resource Kit already, but I don't know how to get it started: This
:means installing it and getting into a code window where I can start
:writing code.
:Also, are there any good how-to books out there that you can recommend?
:I would like to start with the ABC's of PERL. Please let me know by
:replying to the address below. I would really appreciate your help.
Well, maybe you would just bother to do a VERY simple Internet search before
writing such a long message?
Try http://mox.perl.com/index.html or www.perl.com.
Greg
:--
:Best regards,
>Julio R. Escobar
:email: mailto:escobar@oxy.edu
------------------------------
Date: Sat, 18 Oct 1997 23:55:17 +0300
From: "Nikolai A. Prokofiev" <nprokofiev@wperiod.ru>
Subject: Help me, please!
Message-Id: <34492235.3977BDE3@wperiod.ru>
Hello and great PRIVET from Russia!
I have a troubles leaning PERL... The trouble is: I have NO
literature on PERL, except man-files from www.perl.org and
www.cit-forum.ru. Please, sent me URL's to examples of live PERL-scripts
because of it can help me to learn it...
Sincerely,
Nikolai A Prokofiev
admin@sols359.phys.msu.su
------------------------------
Date: Sat, 18 Oct 1997 13:56:59 -0700
From: Phil <paradigm@interlog.com>
Subject: how would you write a cgi or perl that would do this..
Message-Id: <3449229B.20D1@interlog.com>
Hi,
What I would like to do is the following...
When a specific icon (or hot link) is clicked on a page a counterfile
gets incremented in a spcific directory (lets say clicklogs).
Once this is done the program goes into the clicklogs directory and
finds out which log files has the most hits.(according to the
incremental counterfile)
Then once it finds which has the most hits it organizes them from
greatest to least and builds a web page with the appropriate icon and
description that goes with the associated log file with the most hits.
Is there anything built that will do this already available on the
internet?
How hard is this to do?
Whats the best way to go about doing this???
Please E-mail me with your responses.
Thanks for your help
Phil =)
------------------------------
Date: 18 Oct 1997 21:42:35 GMT
From: "Eric D. Friedman" <friedman@uci.edu>
Subject: Re: how would you write a cgi or perl that would do this..
Message-Id: <62bagb$jt6@news.service.uci.edu>
[courtesy cc: sent to author]
In article <3449229B.20D1@interlog.com>, Phil <paradigm@interlog.com> wrote:
[outline snipped]
<How hard is this to do?
Not very, but that depends on your skill set.
<Whats the best way to go about doing this???
^^^^
For starters, I'd use a real subject line.
Next, I'd take the outline you've written and write up a requirements spec
describing exactly how the program should behave;
With that in hand, I'd spend some time searching the net for existing
software that met the requirements of my spec. Failing that, I'd code
the program;
My next step would be to install the program and test it thoroughly;
If I got stumped and couldn't find help in the copious Perl
documentation or in the many FAQs on CGI scripting in general, I'd
consider whether my question was a) about a Perl language issue; or b)
about WWW client-server interaction. The answer to that question would
determine which newsgroup I would approach with my specific question.
In posing my question, I would use a subject line that actually described
the problem I was having. The body of my message would briefly describe
the problem, reference sources I'd checked, and include the section of
code that was not working as intended.
<Please E-mail me with your responses.
Under no circumstances would I post to a newsgroup asking for help without
being prepared to check back there for a response. After all, I'd be
asking for free assistance from busy people, and I'd want them to know that I
cared enough about what they had to say to actually read it.
But that's me. :-)
--
Eric D. Friedman
friedman@uci.edu
------------------------------
Date: Sat, 18 Oct 1997 21:54:00 GMT
From: wkstone@world.com (W. K. Stone)
Subject: ITS AWESOME
Message-Id: <34492fe8.2937828@clin1.campuslink.com>
Do you have any idea what 42,000 one-dollar bills looks like piled
up on the kitchen table? ... IT'S AWESOME !!!
First of all, IT'S PERFECTLY LEGAL! (Call 1-800-725-2161) if you
have any questions about the following opportunity to make
$50,000.00 and that's WITHIN TWO MONTHS!
Here's my story:
A little while back, I was browsing these newsgroups, just like you
are now, and came across an article similar to this, that said you
could make thousands of dollars within weeks, with only an initial
investment of $5.00! So I thought, "Yeah, right, this must be a joke,"
but like most of us I was curious, so I kept reading. Anyway, it said
that you send $1.00 to each of the 5 names and address stated in the
article. You then place your own name and address in the bottom of the
list at #5, and post the article in at least 200 newsgroups. (There
are thousands) No catch, that was it.
I knew that this was the opportunity I had waited for.
I thought it was about time that the money of the world gets into the
right hands! OURS, right? I never had a doubt that this thing would
actually work and even if it didn't, what were 5 stamps and $5.00 for
a try?
As I mentioned before, like most of us, I was a little skeptical and
a little worried about the legal aspects of it all. So I checked it
out with the U.S. Post Office (1-800-725-2161) and they confirmed
that it is indeed legal!
Well GUESS WHAT!!... within 7 days, I started getting money in the
mail! I was shocked! I still figured it would end soon, and didn't
give it another thought. But the money just kept coming in. In my
first week, I made about $20.00 to $30.00 dollars. By the end of the
second week I had made a total of over $1,000.00!!!!!! In the third
week I had over $10,000.00 and it's still growing. This is now my
fourth week and I have made a total of just over $42,000.00 and it's
still coming in .......
Let me tell you how this works and most importantly, WHY
it works....also, make sure you print a copy of this article NOW, so
you can get the information off of it as you need it. The process is
very simple and consists of 3 easy steps:
STEP 1: Get 5 separate pieces of paper and write the following on each
piece of paper "PLEASE PUT ME ON YOUR MAILING LIST." Now get 5 $1.00
bills and place ONE inside EACH of the 5 pieces of paper so the bill
will NOT be seen through the envelope "to prevent thievery". Next,
place
one paper in each of the 5 envelopes and seal them. You should now
have 5 sealed envelopes, each with a piece of paper stating the above
phrase and a $1.00 bill. What you are doing is creating a service by
this. THIS IS PERFECTLY LEGAL!
Mail the 5 envelopes to the following addresses:
**IMPORTANT** Conceal the cash within the envelope!!!
#1
C. E. Burkman
170 University Ave. W
Suite 12-129
Waterloo, Ontario
N2L 3E9
#2
A. Bailey
1207 Reeves Road
Plainfield, IN 46168
#3
Anthony Lacks
644 Riverside Drive Apt.7B
New York,N.Y. 10031
#4
James F. MacLean
Apartment # 7
277 Highland Ave.
Somerville, MA 02143
USA
#5
W. K. Stone
7422 Rosemont
Dallas, TX
75217
STEP 2: Now take the #1 name off the list that you see above, move the
other names up (2 becomes 1, 3 becomes 2, etc...) and add YOUR Name as
number 5 on the list.
STEP 3: Change anything you need to, but try to keep this article as
close to original as possible. Now, post your amended article to at
least 200 newsgroups. (I think there is close to 43,000 groups) All
you need is 200, but remember, the more you post, the MORE money you
make!
For a "complete" Newsgroup listing: www.internet-now.com
*** BOTS ***
Bots are small computer programs on a usenet server.
1) Bots look for certain characters in the "Subject:" field of your
newsgroup posting.
2) Bots also look for "multiple postings".
3) If a Bot discovers any of the above, it will delete your posting.
4) Then send you a nasty email.
***OUTSMART THE BOTS***
1) You will make a lot MORE money if you outsmart the Bots.
2) Post your message only ONCE.
3) Do NOT use characters such as (! $ % + # & * @ ?) in the "Subject"
field.
4) This is what I use ---> Subject: ITS AWESOME
Don't know HOW to post in the newsgroups? Well do exactly the
following:
FOR AOL:
To post to a newsgroup from AOL is totally brainless.
Need I say more?
FOR INTERNET EXPLORER:
It's real easy, holding down the left mouse button, highlight this
entire article, then press the 'CTRL' key and 'C' key at the same time
to copy this article. Then print the article for your records to have
the names of those you will be sending $1.00 to.
Go to the newsgroups and press 'POST AN ARTICLE' then type in your
subject and click the large window below. Press 'CTRL' and 'V' and the
article will appear in the message window. **BE SURE TO MAKE YOUR
ADDRESS CHANGES TO THE 5 NAMES.** Now re-highlight the article and
re-copy it so you have the changes.... then all you have to do for
each newsgroup is 'CTRL' and 'V' and press 'POST'. It's that easy!!
THAT'S IT! All you have to do is jump to different newsgroups and post
away, after you get the hang of it, it will take about 30 seconds for
each newsgroup!
FOR FREE AGENT:
If these instructions are too complex to follow, try Forte's "Free
Agent."
This is a great program for posting to newsgroups.
It is a freeware program. To download it ---> www.forteinc.com
"Free Agent" is a VERY easy program to learn.
Public News Servers: Just do a "Search" and you will find hundreds
of these servers on the net.
**REMEMBER, THE MORE NEWSGROUPS YOU POST IN, THE MORE MONEY YOU WILL
MAKE!! BUT YOU HAVE TO POST A MINIMUM OF 200**
That's it! You will begin receiving money from around the world within
days! You may eventually want to rent a P.O. Box due to the large
amount of mail you receive. If you wish to stay anonymous, you can
invent a name to use, as long as the postman will deliver it. **JUST
MAKE SURE ALL THE ADDRESSES ARE CORRECT.**
Now the WHY part:
This entire principle works because it is in a format of an upside
down tree with thousands of branches. Everyone below you will see to
it that the tree continues because they want to get money. Those
below THEM will continue because THEY want to get the cash etc.
Out of 200 postings, say I receive only 5 replies (a very low
example). So then I made $5.00 with my name at #5 on the letter. Now,
each of the 5 persons who just sent me $1.00 make the MINIMUM 200
postings, each with my name at #4 and only 5 persons respond to each
of the original 5, that is another $25.00 for me, now those 25 each
make 200 MINIMUM posts with my name at #3 and only 5 replies each, I
will bring in an additional $125.00! Now, those 125 persons turn
around and post the MINIMUM 200 with my name at #2 and only receive 5
replies each, I will make an additional $626.00! OK, now here is the
fun part, each of those 625 persons post a MINIMUM of 200 letters
with my name at #1 and they each only receive 5 replies, that just
made me $3,125.00!!! With a original investment of only $5.00!
AMAZING! And as I said 5 responses is actually VERY LOW! Average is
probably 20 to 30! So lets put those figures at just 15 responses
per person. Here is what you will make:
at #5 $15.00
at #4 $225.00
at #3 $3,375.00
at #2 $50,625.00
at #1 $759,375.00
When your name is no longer on the list, you just take the latest
posting in the newsgroups, and send out another $5.00 to names on the
list, putting your name at number 5 and start posting again.
The thing to remember is that thousands of people all over the world
are joining the Internet and reading these articles everyday, JUST
LIKE YOU are now!! And this will go on and on and on and on.... get
the picture? Well, there's 5,000,000,000 people on the world and
most of them will eventually end up being hooked into the internet.
So there are virtually unlimited resources. Of course this will work
the best at the very beginning so the faster you post, the better for
YOU!
So can you afford $5.00 and see if it really works?? I think so!
People have said, "What if the plan is played out and no one
sends you the money?" So what! What are the chances of that happening
when there are tons of "new honest" users who are
joining the Internet and newsgroups everyday and are willing to
give it a try? Estimates are at 20,000 to 50,000 new users,
every day, with thousands of those joining the actual Internet.
Remember, play FAIRLY and HONESTLY and this will work. You just have
to be honest. Make sure you print this article out RIGHT NOW, also.
Try to keep a list of everyone that sends you money and always keep an
eye on the newsgroups to make sure everyone is playing fairly.
Remember, HONESTY IS THE BEST POLICY. You don't need to cheat the
basic idea to make the money!!
GOOD LUCK to all and please play fairly and reap the huge rewards from
this, which is tons of extra CASH. This is the fairest and most honest
way
I have ever seen to share the wealth of the world without costing
anything but our time!!!
Please remember to declare your extra income. Thanks once again...
------------------------------
Date: Sat, 18 Oct 1997 12:41:46 -0600
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Lookbehind
Message-Id: <344902EA.4F4C9E2D@gpu.srv.ualberta.ca>
Tad McClellan wrote:
>
> John Moreno (phenix@interpath.com) wrote:
> : I was reading the perl regular expression manual and it looks to me like
> : perl doesn't have a look behind extension is this true?
> ^^^^^^^^^^^
>
> grep lookbehind *.pod
>
[snip]
> ------------------------------------
>
> So I am guessing that it is true ;-)
>
Ilya's jumbo-re patch gives fixed string look-behind using
(?<!regexp) and (?<=regexp) for negative and positive lookbehinds
respectively...
so, for example, to split on comma's but not escaped comma's
one could do:
$_='blah,blah,foo\,bar,blah';
@array=split /(?<!\\),/;
print join("\n",@array);
which yields:
blah
blah
foo\,bar
blah
It's not part of the standard Perl (yet), and some parts are still
experimental I think...but the lookbehind works as advertised in the
present incarnation of the patch, and I haven't noticed anything else
being broken as a result of applying it (I had it applied in 5.00401 and
currently in 5.00403).
regards
andrew
------------------------------
Date: 18 Oct 1997 21:26:25 GMT
From: "Eric D. Friedman" <friedman@uci.edu>
Subject: more map/grep/for benchmarks
Message-Id: <62b9i1$jdv@news.service.uci.edu>
I recently posted some benchmarks on map/grep/for/foreach performance
in the thread on using map in a void context. As predicted, for (@list)
and foreach my $i (@list) were clear winners over map/grep:
Benchmark: timing 1000 iterations of for (@list), foreach $i (@list), foreach my $i (@list), grep, map...
for (@list): 434 secs (432.56 usr 0.03 sys = 432.59 cpu)
foreach $i (@list): 468 secs (459.17 usr 0.02 sys = 459.19 cpu)
foreach my $i (@list): 436 secs (433.35 usr 0.01 sys = 433.36 cpu)
grep: 463 secs (460.89 usr 0.00 sys = 460.89 cpu)
map: 510 secs (508.91 usr 0.00 sys = 508.91 cpu)
A friend suggested that it would be interesting to know how these
functions perform where a returned list >is< wanted, so I modifed the
tests as show below. Grep was the winner by a slight margin, but I was
surprised to see how much worse map did compared to for/foreach. After
all, map's raison d'etre is this very thing, and it proved to be a
real dog:
why?
Benchmark: timing 1000 iterations of for (@list), foreach $i (@list), foreach my $i (@list), grep, map...
for (@list): 413 secs (411.43 usr 0.06 sys = 411.49 cpu)
foreach $i (@list): 416 secs (412.27 usr 0.01 sys = 412.28 cpu)
foreach my $i (@list): 415 secs (414.43 usr 0.00 sys = 414.43 cpu)
grep: 410 secs (409.49 usr 0.00 sys = 409.49 cpu)
map: 501 secs (500.30 usr 0.03 sys = 500.33 cpu)
#!/dcs/bin/perl5 -w
$|++;
use Benchmark;
use constant LIST => (0 .. 10000);
timethese(1000, {
'for (@list)' => \&f,
'grep' => \&g,
'foreach $i (@list)' => \&fe,
'foreach my $i (@list)' => \&fem,
'map' => \&m,
}
);
sub g
{
my %val = ();
my @ret = grep { $_ if $val{$_}++ } LIST;
@ret;
}
sub f
{
my %val = ();
my @ret = ();
for (LIST)
{
push @ret, $_ if $val{$_}++;
}
@ret;
}
sub m
{
my %val = ();
my @ret = map {$_ if $val{$_}++} LIST;
@ret;
}
sub fem
{
my %val =();
my @ret =();
foreach my $i (LIST)
{
push @ret, $i if $val{$i}++;
}
@ret;
}
sub fe
{
my %val =();
my @ret =();
foreach $i (LIST)
{
push @ret, $i if $val{$i}++;
}
@ret;
}
--
Eric D. Friedman
friedman@uci.edu
------------------------------
Date: 18 Oct 1997 18:13:56 GMT
From: "Dave Roth" <rothd@roth.netX>
Subject: Re: PERL : diff utility for NT
Message-Id: <01bcdbf1$b1b80640$2d906ec6@main2>
Scott McMahan <scott@lighthouse.softbase.com> wrote in article
<625n22$ovk$1@mainsrv.main.nc.us>...
> Bryan OConnell (bryan_oconnell@ins.com) wrote:
> : I need a good UNIX-like diff utility for completing "diff -c" (unix
> : equiv) on text files from within a PERL script on a Windows NT 4.0 box.
>
> : Any suggestions?
>
> The Cygnus GNU utilities port to Win32 is your best bet. Various
> other diff clones exist (including some graphical ones), but
> their compatibility with the UNIX version would be suspect.
The Cygnus diff works but I have had problems using it with Cygnus's
patch.exe.
If anyone can give me a hint I would appreciate it.
dave
--
================================================================
Dave Roth ...glittering prizes and
Roth Consulting endless compromises, shatter
rothd@roth.net the illusion of integrity
My email address is disguised to fool automailers. Remove the
trailing 'X' to send me email.
****************************************************************
Use of this message or email address for commercial purposes
(including "junk" mailings) is strictly prohibited and protected
under current international copyright laws and United States
Code, Title 47, Chapter 5, Subchapter II.
------------------------------
Date: 18 Oct 1997 10:43:19 -0700
From: danny@lennon.postino.com (Danny Aldham)
Subject: Re: perl on NT4 and ...
Message-Id: <62asfn$17q$1@lennon.postino.com>
Eric Mosley (ericm@iol.ie) wrote:
: I can't get anything to work on NT4. Not even the install.bat.
: The reason everything fails is because it wont do external commands
: like...
: $tmp = `cd`;
: That just doesn't work!
: Get errors like
: /c: /c: file not found
: Whatever that means.
This message is telling you that perl is far too complicated
for you. Go back to Visual whatever.
--
Danny Aldham SCO Ace , MCSE , JAPH , DAD
I wak'd, she fled, and day brought back my night. jm
------------------------------
Date: 18 Oct 1997 18:26:44 GMT
From: root@web1.valley-internet.com (Chris Ochs)
Subject: serial IO weirdness
Message-Id: <62av14$m48$1@aurora.ns.net>
I have a program that processes credit cards via a third party processor. I
have run into a wierd situation and need a little more help on exactly how
perl's file IO works to solve the problem.
Basically, I open the tty as IN, dup OUT to IN, and proceed with the processing
like so:
send msg
wait for answer
send another msg
wait for answer
etc..
output is unbuffered via $|=1;
On a send, I simply print the msg to OUT.
On the receive, I use the expect sub in comm.pm.
The problem I am seeing is that on occasion I get garbage back from the processor. Now this isn't so weird in itself as it could be the phone lines, etc.., but
sometimes it goes like this:
send the first msg, wait for answer.
send the second message, wait for answer.
On the second received message the answer is the same answer from the first
message only that I only get half of it, and the rest is garbage.
What I am trying to find out is if there is some way that I could send data out
a tty, get an answer, send another message, and somehow still be reading the
answer from the first message. I didn't think this was possible. Am I
completely missing something on the way IO works on a serial device?
Sorry if this is rather vague. I would post the code but I am under a confidentiality agreement not to disclose the source code.
Chris
------------------------------
Date: Sat, 18 Oct 1997 20:59:47 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: serial IO weirdness
Message-Id: <344c21a0.22448467@flood.xnet.com>
root@web1.valley-internet.com (Chris Ochs) wrote:
>
>I have a program that processes credit cards via a third party processor. I
>have run into a wierd situation and need a little more help on exactly how
>perl's file IO works to solve the problem.
>
>Basically, I open the tty as IN, dup OUT to IN, and proceed with the processing
>like so:
>
>send msg
>wait for answer
>send another msg
>wait for answer
>etc..
>
>output is unbuffered via $|=1;
>On a send, I simply print the msg to OUT.
>On the receive, I use the expect sub in comm.pm.
>
>
>The problem I am seeing is that on occasion I get garbage back from the processor. Now this isn't so weird in itself as it could be the phone lines, etc.., but
>sometimes it goes like this:
>
>send the first msg, wait for answer.
>send the second message, wait for answer.
>
>On the second received message the answer is the same answer from the first
>message only that I only get half of it, and the rest is garbage.
>
>
>What I am trying to find out is if there is some way that I could send data out
>a tty, get an answer, send another message, and somehow still be reading the
>answer from the first message. I didn't think this was possible. Am I
>completely missing something on the way IO works on a serial device?
It could be that you are not cleaning up after yourself and reusing
old data from variables that are too widely scoped. This can throw
off your parsing. I just ran across that in a module I wrote.
Look into 'local' and 'my' variable declarations.
>Sorry if this is rather vague. I would post the code but I am under a confidentiality agreement not to disclose the source code.
>
>Chris
>
>
>
>
>
David Efflandt/Elgin, IL USA
efflandt@xnet.com http://www.xnet.com/~efflandt/
------------------------------
Date: Sat, 18 Oct 1997 20:50:48 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Server Error
Message-Id: <344b1ec8.21720110@flood.xnet.com>
Janovjak <janovjak@ican.net> wrote:
>Hello,
>
>Please pardon the simple question (newbie posting)...
>
>I have a perl script which generates a html file, and returns the output
>to stdout (that is, it displays the results on screen, in html format).
>The script executes fine. When I view the output html file in the
>browser by typing it's address, it also appears fine. However, when I
>attempt, from the form html page to call this perl script, I get a
>message something like:
> Server Error likely due to a system configuration problem. Have your
>sys admin check the logs.
>
>Would you please tell me what are things I need to verify...
(snip)
This is not really in the proper news group, since it is not perl
specific. But the first thing you need to print in any CGI script is
a header for the filetype you are returning:
print "Content-type: text/html\n\n"; # note double \n
If you had access to the server log you would see something like
"Invalid or missing headers".
David Efflandt/Elgin, IL USA
efflandt@xnet.com http://www.xnet.com/~efflandt/
------------------------------
Date: Sat, 18 Oct 1997 22:56:25 +0200
From: "Ingo L|tkebohle" <ingo@blank.pages.de>
Subject: setuid doesn't change UID's?
Message-Id: <34492279.601450C6@blank.pages.de>
I'm using the POSIX module setuid and setgid calls to change to the UID
and GID of a setuid-root script to those of a user. When I look at $UID
and $GID (with use English), the correct values appear. But when I try
to open a file which I shouldn't be able to open, it still works! When I
manually change to the user with "su -l <user>", I (correctly) get
"permission denied" on trying to open the file.
--
Ingo Luetkebohle, CTO
dev/consulting Gesellschaft fuer Netzwerkentwicklung und -beratung mbH
url: http://www.devconsult.de/ - fon: 0521-1365800 - fax: 0521-1365803
------------------------------
Date: 18 Oct 1997 22:08:25 GMT
From: shodan@shodan.erols.com (Dave Schenet)
Subject: Re: sorting a hash
Message-Id: <62bc0p$c29@winter.news.erols.com>
Bob Fawcett (bfawcett@myriad.com) wrote:
: David Siebert wrote:
: > I am trying to sort an array of keys to out put to a file.
: > this does not work. What will?
: > foreach $key sort((keys %myerror)) {print FILE "$key\t$value"}
Missing semicolon after print statement.
$value will not be the value of the hash.. You could try:
foreach $key (sort(keys (%myerror))) {
print FILE "$key\t$myerror{$key}";
}
: There is probably a better way to do it (more efficient), but I always
: just push each key of the hash onto an array then do my foreach on the
: the array.
: Bob Fawcett
I prefer:
while (($key, $value) = each (%myerror)) {print (FILE "$key\t$value");}
--Dave
--
+----------------------------------+-----------------------------------+
|Dave Schenet <shodan at erols com>| Erols Internet Services, INC. |
|Junior UNIX Developer | Springfield, VA. |
+----------------------------------+-----------------------------------+
| Can't reply by mail? I'm blocking 67 netblocks from sending me mail. |
| I have zero-tolerance for SPAM. One strike and I stop listening. . . |
+----------------------------------------------------------------------+
------------------------------
Date: Sat, 18 Oct 1997 23:54:24 +0200
From: uzs90z@ibm.rhrz.uni-bonn.de (Michael Schuerig)
Subject: Using undefined match results?
Message-Id: <199710181944308040830N@rhrz-isdn3-p16.rhrz.uni-bonn.de>
I recently switched from 5.002 to 5.004 and have to cope with some
problems.
I have a piece of code like this:
$path =~ m,^(.*/)(.+?)(#.*)?$,;
$path = $1 . substr($2, 0, $max_base_len) . $3;
Now, when one of the brackets matches nothing Perl complains in the next
line about use of an uninitialized variable. Does this mean I have to
guard each and every use of $1 et al. with an if?
Michael
--
Michael Schuerig Consistency is the last refuge
mailto:uzs90z@uni-bonn.de of the unimaginative.
http://www.uni-bonn.de/~uzs90z/ -Oscar Wilde
------------------------------
Date: Sat, 18 Oct 1997 16:25:34 GMT
From: mlinvle@inlink.com
Subject: Using/learning Perl for dos/WFW and NT 3.51
Message-Id: <3448e17c.15042529@news.inlink.com>
I've gotten both versions of perl from Activeware (that I put on an NT
machine running 3.51) and djgpp's recent version (which I'll use at
home).
The question(s) I have are can I use the perl book for Win32 in both
places, and can scripts I write work in both places. The types of
scripts I'd be writing are, of course, smallish ones to see just what
I could do with perl, and maybe some administration things (again this
is a learning process.)
Any advice would be very helpful as I'm finally in a position where I
can finally learn/use perl.
Thanks!
------------------------------
Date: 18 Oct 1997 16:35:53 GMT
From: gsar@engin.umich.edu (Gurusamy Sarathy)
Subject: Re: WinNT and Perl question
Message-Id: <62aoh9$htb@srvr1.engin.umich.edu>
[ mailed and posted ]
In article <344652FA.6AE7@qualcomm.com>,
Jim Spink <jspink@qualcomm.com> wrote:
>I'm a newbie to Perl and this newsgroup, so if my question is
>inappropriate or belongs elsewhere please let me know. Its a long note.
It's probably more appropriate to send it to perlbug@perl.com.
>The program I'm working with interacts with Perl by spawning a separate
>process. To get output from the child Perl process the parent redirects
>the child's stdin, stdout, and stderr by creating anonymous pipes, using
>those to replace stdin, stdout, stderr, spawning perl (which inherits
>them), then resetting them back. Pretty standard way to get output from
>a console-mode program in Windows. The parent program waits on those
>pipes for output from the child process (Perl), and everything is
>hunky-dory except for one obscure bug.
>
>Seems that, if the child process calls Win32 Sleep() or any functions
>that wait on stdin, i.e. getc(), then any output to stdout (i.e. via
>printf) never makes it thru the pipe in the parent process. For
>example, the Perl script might call sleep(1), then call print "hello
>world\n". You'll never see the hello world or anything else for an
>indeterminate (perhaps indefinite) time period. From what I can tell,
>the output simply buffers up in stdout or stderr and is never flushed.
Hmm, I cannot reproduce the problem (the standard port, 5.004_02, built
with Borland C++):
[h:\perl5.00402-bindist04-bc\perl\bin]perl -w
print `perl -e "sleep(1);print qq[hello world\\n]"`;
__END__
hello world
[h:\perl5.00402-bindist04-bc\perl\bin]perl -w
open (P, 'perl -e "sleep(1);print qq[hello world\n]" |') or die $!;
print <P>;
__END__
hello world
>This doesn't appear to be Perl's fault - rather, it seems to be a bug in
>Windows NT itself. I've been able to recreate it with generic programs.
I suggest you send this evidence along.
>So, I have two possible solutions to propose to the Perl source owners,
>specific to Win32. One of them is to, in \win32\perlmain.c, perform the
>following calls:
> setvbuf( stdout, NULL, _IONBF, 0 );
> setvbuf( stderr, NULL, _IONBF, 0 );
>
>These unbuffer the streams and 'cure' the problem. However, I
>understand they may have performance implications and are probably not
>the best work around. The other option is to go into \win32\win32.c and
>place the following inside each offending function call (i.e. sleep())
>
>fflush(stdout);
>fflush(stderr);
>
>This probably works better, but is a bigger hit and is unlikely to close
>all possible routes to cause this problem.
While I'm not convinced that there is a problem yet, these seem to
be drastic solutions to me. Why can't you set $| inside the perl
script? If you don't have control over your perl scripts, you can
always arrange to set $| on STDOUT and STDERR in, say, ine.pm and
set PERL5OPT to -Mine in your environment.
- Sarathy.
gsar@umich.edu
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
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 1194
**************************************