[8343] in Perl-Users-Digest
Perl-Users Digest, Issue: 1959 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Feb 23 17:13:49 1998
Date: Mon, 23 Feb 98 14:00:32 -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 Mon, 23 Feb 1998 Volume: 8 Number: 1959
Today's topics:
a match problem (bis) <wangli@nortel.ca>
Re: a match problem <pernst@aixterm5.urz.uni-heidelberg.de>
C++ parody <tchrist@mox.perl.com>
Re: Cacheing and Back Button question. (susan cassidy)
DBM Databases - Help Please! (Burt Lewis)
Does CreateProcessWithNewConsole really works ? <hungm@hotmail.com>
errors compiling sybperl 2.07 <pperroud@interlog.com>
Re: finding the second instance of a pattern match on a (Thijs Kinkhorst)
Re: Glad I bought Effective Perl Programming <joseph@5sigma.com>
Re: Help please: Conversion problems from numeric to as (William R. Ward)
Re: IP-Address in Perlscripts (Martin Vorlaender)
Java's hidden flaw <bvitro@cisco.com>
kill() on NT? <kehoe@fc.hp.com>
Re: Law-enforcement apps ? <joseph@5sigma.com>
OLE Automation with Win32 Perl and Word? <Phil.Kime@ed.ac.uk>
Re: Perl 4/5 <joseph@5sigma.com>
returning immediately from system call? (Erik Johnson)
Re: returning immediately from system call? <tchrist@mox.perl.com>
Re: Runtime building of search expression <joseph@5sigma.com>
Re: Send email from Perl on NT platform (Andy Lester)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 23 Feb 1998 12:10:52 -0500
From: "Liming Wang" <wangli@nortel.ca>
Subject: a match problem (bis)
Message-Id: <6csaot$gqf@nbdchc4.bnr.ca>
Hello,
sorry for last messsage, should be this one,
#!/usr/bin/perl -w
use strict;
$pat = '/Foo$(xyz)';
$str = '/A /B /Foo$(xyz) /c';
print "ok\n" if $str =~ /$pat/;
please point out why the match does not work. TIA
background: perl 5.004_02 on NT
------------------------------
Date: 23 Feb 1998 18:02:52 GMT
From: Peter Ernst <pernst@aixterm5.urz.uni-heidelberg.de>
Subject: Re: a match problem
Message-Id: <6csdkc$2bd@sun0.urz.uni-heidelberg.de>
Liming Wang <wangli@nortel.ca> wrote:
: Hello,
: #!/usr/bin/perl
: $a = '/Foo$(xyz)';
: $b = '/A /B /Foo$(xyz) /c';
: print "ok\n" if $a =~ $b;
Try this:
# quote meta-chars in $a (that's the job of \Q)
# and look (search with /../) if they are somewhere in $b
print "ok\n" if $b =~ /\Q$a/;
Regards,
Peter
------------------------------
Date: 23 Feb 1998 19:48:40 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: C++ parody
Message-Id: <6csjqo$uk$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, bvitro@cisco.com writes:
:http://www.edtn.com/scribe/notw/980220.htm#software
:Java's creator says the software was never intended to be a commercial
:product.
If you think that's good, try the following C++ spoof. I didn't
write it, and I don't know who did.
--tom
On the 1st of January, 1998, Bjarne Stroustrup gave an interview to
the IEEE's 'Computer' magazine. Naturally, the editors thought he
would be giving a retrospective view of seven years of object-oriented
design, using the language he created.
By the end of the interview, the interviewer got more than he had
bargained for and, subsequently, the editor decided to suppress its
contents, 'for the good of the industry' but, as with many of these
things, there was a leak.
Here is a complete transcript of what was was said, unedited, and
unrehearsed, so it isn't as neat as planned interviews. You will
find it interesting...
Interviewer: Well, it's been a few years since you changed the
world of software design, how does it feel, looking back?
Stroustrup: Actually, I was thinking about those days, just before
you arrived. Do you remember? Everyone was writing 'C' and, the
trouble was, they were pretty damn good at it. Universities got
pretty good at teaching it, too. They were turning out competent -
I stress the word 'competent' - graduates at a phenomenal rate. That's
what caused the problem.
Interviewer: Problem?
Stroustrup: Yes, problem. Remember when everyone wrote Cobol?
Interviewer: Of course, I did too
Stroustrup: Well, in the beginning, these guys were like demi-gods.
Their salaries were high, and they were treated like royalty.
Interviewer: Those were the days, eh?
Stroustrup: Right. So what happened? IBM got sick of it, and
invested millions in training programmers, till they were a dime
a dozen.
Interviewer: That's why I got out. Salaries dropped within a year,
to the point where being a journalist actually paid better.
Stroustrup: Exactly. Well, the same happened with 'C' programmers.
Interviewer: I see, but what's the point?
Stroustrup: Well, one day, when I was sitting in my office,
I thought of this little scheme, which would redress the balance
a little. I thought 'I wonder what would happen, if there were a
language so complicated, so difficult to learn, that nobody would
ever be able to swamp the market with programmers? Actually,
I got some of the ideas from X10, you know, X windows. That was
such a bitch of a graphics system, that it only just ran on those
Sun 3/60 things. They had all the ingredients for what I wanted. A
really ridiculously complex syntax, obscure functions, and pseudo-OO
structure. Even now, nobody writes raw X-windows code. Motif is the
only way to go if you want to retain your sanity.
Interviewer: You're kidding...?
Stroustrup: Not a bit of it. In fact, there was another problem. Unix
was written in 'C', which meant that any 'C' programmer could very
easily become a systems programmer. Remember what a mainframe
systems programmer used to earn?
Interviewer: You bet I do, that's what I used to do.
Stroustrup: OK, so this new language had to divorce itself from
Unix, by hiding all the system calls that bound the two together
so nicely. This would enable guys who only knew about DOS to earn
a decent living too.
Interviewer: I don't believe you said that...
Stroustrup: Well, it's been long enough, now, and I believe most
people have figured out for themselves that C++ is a waste of time
but, I must say, it's taken them a lot longer than I thought it would.
Interviewer: So how exactly did you do it?
Stroustrup: It was only supposed to be a joke, I never thought
people would take the book seriously. Anyone with half a brain can
see that object-oriented programming is counter-intuitive, illogical
and inefficient.
Interviewer: What?
Stroustrup: And as for 're-useable code' - when did you ever hear
of a company re-using its code?
Interviewer: Well, never, actually, but...
Stroustrup: There you are then. Mind you, a few tried, in the
early days. There was this Oregon company - Mentor Graphics,
I think they were called - really caught a cold trying to rewrite
everything in C++ in about '90 or '91. I felt sorry for them really,
but I thought people would learn from their mistakes.
Interviewer: Obviously, they didn't?
Stroustrup: Not in the slightest. Trouble is, most companies hush-up
all their major blunders, and explaining a $30 million loss to the
shareholders would have been difficult. Give them their due, though,
they made it work in the end.
Interviewer: They did? Well, there you are then, it proves O-O
works.
Stroustrup: Well, almost. The executable was so huge, it took five
minutes to load, on an HP workstation, with 128MB of RAM. Then
it ran like treacle. Actually, I thought this would be a major
stumbling-block, and I'd get found out within a week, but nobody
cared. Sun and HP were only too glad to sell enormously powerful
boxes, with huge resources just to run trivial programs. You know,
when we had our first C++ compiler, at AT&T, I compiled 'Hello World',
and couldn't believe the size of the executable. 2.1MB
Interviewer: What? Well, compilers have come a long way, since then.
Stroustrup: They have? Try it on the latest version of g++ - you
won't get much change out of half a megabyte. Also, there are several
quite recent examples for you, from all over the world. British
Telecom had a major disaster on their hands but, luckily, managed
to scrap the whole thing and start again. They were luckier than
Australian Telecom. Now I hear that Siemens is building a dinosaur,
and getting more and more worried as the size of the hardware gets
bigger, to accommodate the executables. Isn't multiple inheritance
a joy?
Interviewer: Yes, but C++ is basically a sound language.
Stroustrup: You really believe that, don't you? Have you ever
sat down and worked on a C++ project? Here's what happens: First,
I've put in enough pitfalls to make sure that only the most trivial
projects will work first time. Take operator overloading. At the end
of the project, almost every module has it, usually, because guys
feel they really should do it, as it was in their training course.
The same operator then means something totally different in every
module. Try pulling that lot together, when you have a hundred or so
modules. And as for data hiding. God, I sometimes can't help laughing
when I hear about the problems companies have making their modules
talk to each other. I think the word 'synergistic' was specially
invented to twist the knife in a project manager's ribs.
Interviewer: I have to say, I'm beginning to be quite appalled
at all this. You say you did it to raise programmers' salaries?
That's obscene.
Stroustrup: Not really. Everyone has a choice. I didn't expect the
thing to get so much out of hand. Anyway, I basically succeeded. C++
is dying off now, but programmers still get high salaries - especially
those poor devils who have to maintain all this crap. You do realise,
it's impossible to maintain a large C++ software module if you didn't
actually write it?
Interviewer: How come?
Stroustrup: You are out of touch, aren't you? Remember the typedef?
Interviewer: Yes, of course.
Stroustrup: Remember how long it took to grope through the header
files only to find that 'RoofRaised' was a double precision number?
Well, imagine how long it takes to find all the implicit typedefs
in all the Classes in a major project.
Interviewer: So how do you reckon you've succeeded?
Stroustrup: Remember the length of the average-sized 'C'
project? About 6 months. Not nearly long enough for a guy with a wife
and kids to earn enough to have a decent standard of living. Take
the same project, design it in C++ and what do you get? I'll tell
you. One to two years. Isn't that great? All that job security,
just through one mistake of judgement. And another thing. The
universities haven't been teaching 'C' for such a long time, there's
now a shortage of decent 'C' programmers. Especially those who know
anything about Unix systems programming. How many guys would know
what to do with 'malloc', when they've used 'new' all these years
- and never bothered to check the return code. In fact, most C++
programmers throw away their return codes. Whatever happened to good
ol' '-1'? At least you knew you had an error, without bogging the
thing down in all that 'throw' 'catch' 'try' stuff.
Interviewer: But, surely, inheritance does save a lot of time?
Stroustrup: Does it? Have you ever noticed the difference between
a 'C' project plan, and a C++ project plan? The planning stage for
a C++ project is three times as long. Precisely to make sure that
everything which should be inherited is, and what shouldn't isn't.
Then, they still get it wrong. Whoever heard of memory leaks in a
'C' program? Now finding them is a major industry. Most companies
give up, and send the product out, knowing it leaks like a sieve,
simply to avoid the expense of tracking them all down.
Interviewer: There are tools...
Stroustrup: Most of which were written in C++.
Interviewer: If we publish this, you'll probably get lynched,
you do realise that?
Stroustrup: I doubt it. As I said, C++ is way past its peak now,
and no company in its right mind would start a C++ project without
a pilot trial. That should convince them that it's the road to
disaster. If not, they deserve all they get. You know, I tried to
convince Dennis Ritchie to rewrite Unix in C++.
Interviewer: Oh my God. What did he say?
Stroustrup: Well, luckily, he has a good sense of humor. I think
both he and Brian figured out what I was doing, in the early days,
but never let on. He said he'd help me write a C++ version of DOS,
if I was interested.
Interviewer: Were you?
Stroustrup: Actually, I did write DOS in C++, I'll give you a
demo when we're through. I have it running on a Sparc 20 in the
computer room. Goes like a rocket on 4 CPU's, and only takes up 70
megs of disk.
Interviewer: What's it like on a PC?
Stroustrup: Now you're kidding. Haven't you ever seen Windows '95?
I think of that as my biggest success. Nearly blew the game before
I was ready, though.
Interviewer: You know, that idea of a Unix++ has really got me
thinking. Somewhere out there, there's a guy going to try it.
Stroustrup: Not after they read this interview.
Interviewer: I'm sorry, but I don't see us being able to publish
any of this.
Stroustrup: But it's the story of the century. I only want to be
remembered by my fellow programmers, for what I've done for them.
You know how much a C++ guy can get these days?
Interviewer: Last I heard, a really top guy is worth $70 - $80
an hour.
Stroustrup: See? And I bet he earns it. Keeping track of all the
gotchas I put into C++ is no easy job. And, as I said before, every
C++ programmer feels bound by some mystic promise to use every damn
element of the language on every project. Actually, that really
annoys me sometimes, even though it serves my original purpose. I
almost like the language after all this time.
Interviewer: You mean you didn't before?
Stroustrup: Hated it. It even looks clumsy, don't you agree?
But when the book royalties started to come in... well, you get
the picture.
Interviewer: Just a minute. What about references? You must admit,
you improved on 'C' pointers.
Stroustrup: Hmm. I've always wondered about that. Originally, I
thought I had. Then, one day I was discussing this with a guy who'd
written C++ from the beginning. He said he could never remember
whether his variables were referenced or dereferenced, so he always
used pointers. He said the little asterisk always reminded him.
Interviewer: Well, at this point, I usually say 'thank you very much'
but it hardly seems adequate.
Stroustrup: Promise me you'll publish this. My conscience is getting
the better of me these days.
Interviewer: I'll let you know, but I think I know what my editor
will say.
Stroustrup: Who'd believe it anyway? Although, can you send me a
copy of that tape?
Interviewer: I can do that.
--
Tom Christiansen tchrist@jhereg.perl.com
If I don't document something, it's usually either for a good reason,
or a bad reason. In this case it's a good reason. :-)
--Larry Wall in <1992Jan17.005405.16806@netlabs.com>
------------------------------
Date: 23 Feb 1998 10:35:37 -0800
From: susanc@news.SanDiegoCA.ncr.COM (susan cassidy)
Subject: Re: Cacheing and Back Button question.
Message-Id: <6csfhp$f0o@ssd3450.SanDiegoCA.NCR.COM>
In article <34EF9EA3.6569CFD9@fccj.cc.fl.us>,
Bill Jones <bill@astro.fccj.cc.fl.us> wrote:
>[courtesy cc of this posting WAS NOT sent to cited author via email]
>
>You're basically stuck. I do not know of a way to accomplish what
>you are trying to do...
>
>I would suggest you keep track of it internally to the Perl code itself
>and
>stay away from cookies; or research the CGI.pm module closely.
>It will give you hints on how to approximate what you want...
>
>HTH,
>Bill
>
>
>Remove NOSPAM to reply wrote:
>
>> Hello. I've been trying without luck to figure out how to prevent the
>> user from using the back button from a certain page.
>>
>> My problem is that I have form that is used for editing the
>> state of something. A perl script handles the POST method
>> and generates a new version of the form with each interaction.
>> If I allow the user to use the back button, then they will be
>> able to step back to a previous version of the form, which
>> will contain out of date state information.
>>
>> I have tried using Pragma: no-cache, and also using the
>> Expired header with both "0" and an old date as
>> Content. They only work intermittently in Netscape 4.04.
>>
>> I would like to write a Java applet to handle this
>> situation, but unfortunately the client doesn't like
>> Java. Any suggestions would be appreciated.
>>
>> Thank you,
>> Lee Nelson
>
>
>
Maybe you could use the JavaScript (not Java) Location.replace() method
in the updated page to cause the URL in the history to be replaced with
a new one.
This means that if they hit the Back button, it goes to the page
before the last page accessed.
--
Susan Cassidy
Remove xxx in replyto address when replying.
------------------------------
Date: 23 Feb 1998 19:39:05 GMT
From: burt@ici.net (Burt Lewis)
Subject: DBM Databases - Help Please!
Message-Id: <6csj8p$bpf$1@bashir.ici.net>
Hi,
Once again I hit a brick wall even with 5 Perl Books.
I have a text file that is thousands of lines long and a sample would
look like this:
M"123456"12 Apple St"Boston
M"98765"89 King Rd."Portland
Because of the size of my database (25,000 + records) I'm told I should be
using DBM. Problem is I can't get it to work. My first task is just to find
specific records.
This is what I have so far:
#!/usr/local/bin/perl
print "Content-type: text/html\n\n";
dbmopen(%corpdata, "/files/WWW/vhtdocs/eastonmass/corp/test1.txt", 0600);
$therec = $corpdata{$reqkey};
($mfg, $name, $city) = split (/"/, $therec);
if ($therec eq "BOSTON")
{
print "Content-type: text/html\n\n";
print "<html><head><title>dbtest</title></head><body>";
print "Answeris: $therec";
}
dbmclose(%corpdata);
Appreciate any help with this.
Burt Lewis
------------------------------
Date: Mon, 23 Feb 1998 14:20:15 -0500
From: Michael Hung <hungm@hotmail.com>
Subject: Does CreateProcessWithNewConsole really works ?
Message-Id: <34F1CBEF.1FFF33E4@hotmail.com>
Hi, I have a perl script running as a cgi program under IIS 4.0 and perl
5.003_07 build 315, NTW 4.0.
I am trying to execute a program and get its output using
@output = `foo.exe`;
I have verified the program has actually run but the output is missing
... in the mean time, I am redirecting the output to a temporary file
and the read in the file.
I already have the 'CreateProcessWithNewConsole' registry key and value.
Help !!!
Thanks
Michael
------------------------------
Date: 23 Feb 1998 21:04:32 GMT
From: "Patrick Perroud" <pperroud@interlog.com>
Subject: errors compiling sybperl 2.07
Message-Id: <01bd40a0$86b07c20$6b01a8c0@pperroud.interlog.com>
I've compiled and installed perl5.004_04-trial on a sun sparc running sunos
4.1.2.
All works fine.
I wanted to install sybperl 2.07 to acces my Sybase server running 4.0
DBlib.
During compile of the DBlib package I get errors indicating a type
DBDATEREC is undefined. I can't seem to locate this defn. anywhere and was
wondering if someone might indicate where I'm going wrong. Do I need to
add this typedef to sybfront.h.
The following is the errors encountered.
Is it perhaps that I am running perl5.004 instead of Perl5.002 as the docs
indicate is the minimum requirements for compiling sybperl.
# vi CONFIG
# perl Makefile.PL
Checking if your kit is complete...
Looks good
Checking if your kit is complete...
Looks good
Writing Makefile for Sybase::BCP
Writing Makefile for Sybase::DBlib
Writing Makefile for Sybase::Sybperl
Writing Makefile for Sybase
# make
mkdir ./blib
mkdir ./blib/lib
mkdir ./blib/arch
mkdir ./blib/arch/auto
mkdir ./blib/arch/auto/Sybase
mkdir ./blib/lib/auto
mkdir ./blib/lib/auto/Sybase
cp lib/sql.pl ./blib/lib/./sql.pl
cp lib/sybperl.pl ./blib/lib/./sybperl.pl
cp lib/sybutil.pl ./blib/lib/./sybutil.pl
cp lib/ctutil.pl ./blib/lib/./ctutil.pl
mkdir .././blib/lib/Sybase
mkdir .././blib/arch/auto/Sybase/BCP
mkdir .././blib/lib/auto/Sybase/BCP
cp BCP.pm .././blib/lib/Sybase/BCP.pm
Manifying ..//Sybase::BCP.0
mkdir .././blib/arch/auto/Sybase/DBlib
mkdir .././blib/lib/auto/Sybase/DBlib
cp DBlib.pm .././blib/lib/Sybase/DBlib.pm
AutoSplitting Sybase::DBlib (.././blib/lib/auto/Sybase/DBlib)
/bin/perl -I/usr/local/lib/perl5/sun4-sunos/5.00404 -I/usr/local/lib/perl5
/usr/local/lib/perl5/ExtUtils/xsubpp -prototypes -typemap
/usr/local/lib/perl5/ExtUtils/typemap DBlib.xs >DBlib.tc && mv DBlib.tc
DBlib.c
cc -c -I/home/sybase/include -I/usr/local/include -O -DVERSION=\"2.07\"
-DXS_VERSION=\"2.07\" -I/usr/local/lib/perl5/sun4-sunos/5.00404/CORE
-DDBLIBVS=400 -DSYBPLVER='"2.07"' -DDO_TIE DBlib.c
/home/sybase/include/sybfront.h: 41: FALSE redefined
/home/sybase/include/sybfront.h: 42: TRUE redefined
DBlib.xs: 4164: DBSETLPACKET: argument mismatch
"DBlib.c", line 4579: warning: illegal combination of pointer and integer,
op =
"DBlib.xs", line 5408: DBDATEREC undefined
"DBlib.xs", line 5408: syntax error at or near variable name "rec"
"DBlib.xs", line 5412: ptr undefined
"DBlib.xs", line 5413: rec undefined
"DBlib.xs", line 5416: ptr undefined
"DBlib.xs", line 5416: rec undefined
"DBlib.xs", line 5418: dateyear undefined
"DBlib.xs", line 5419: datemonth undefined
"DBlib.xs", line 5420: datedmonth undefined
"DBlib.xs", line 5421: datedyear undefined
"DBlib.xs", line 5422: datedweek undefined
"DBlib.xs", line 5423: datehour undefined
"DBlib.xs", line 5424: dateminute undefined
"DBlib.xs", line 5425: datesecond undefined
"DBlib.xs", line 5426: datemsecond undefined
"DBlib.xs", line 5427: datetzone undefined
*** Error code 1
make: Fatal error: Command failed for target `DBlib.o'
Current working directory /files1/perl/sybperl-2.07/DBlib
*** Error code 1
make: Fatal error: Command failed for target `subdirs'
--
Patrick Perroud
pperroud@interlog.com
------------------------------
Date: Mon, 23 Feb 1998 21:49:06 GMT
From: thijs@kink.xs4all.nl (Thijs Kinkhorst)
Subject: Re: finding the second instance of a pattern match on a line
Message-Id: <6csqsj$nfi$1@news2.xs4all.nl>
In article <6crngt$27l@web3.tcd.ie>, "Mark Fynes" <Mark.Fynes@cs.tcd.ie>
writes:
>if I'm searching for a pattern which may occur more than once in a line
>say 4 x's, arbitrary text and 4 x's again,
>
>/xxxx(.*?)xxxx/ and then $1 is what I'm looking for.
>
>What if there were a few of these on the one line?
If you want the second instance, try:
/xxxx.*?xxxx.*?xxxx(.*?)xxxx/
'-----+-----' '------+------'
| |
*--------------[----- first instance
|
*----------- second instance
--
Thijs Kinkhorst * Jaze Web Design * ICQ 432406
thijs@kinkhorst.com * http://www.jaze.net * KeyID 0x371EFCB1
------------------------------
Date: Mon, 23 Feb 1998 14:02:29 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Glad I bought Effective Perl Programming
Message-Id: <34F1E3CA.C58948CB@5sigma.com>
V. Chandrasekhar wrote:
>
> 1. I have been using Effective Perl Programming for a couple of
> hours now. I just bought this book. I am glad I did. [...]
I'm glad you're glad! :-)
-joseph
--
Joseph N. Hall, prop., 5 Sigma Productions mailto:joseph@5sigma.com
Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
Perl Training . . . . . . . . . . . . . . . http://www.perltraining.com
------------------------------
Date: 22 Feb 1998 12:40:39 -0800
From: hermit@cats.ucsc.edu (William R. Ward)
Subject: Re: Help please: Conversion problems from numeric to ascii
Message-Id: <waa1zwvs794.fsf@ese.UCSC.EDU>
First of all, comp.lang.perl hasn't existed for years. If your news
server stil lists it, ask your news administrator to remove it. Also,
since you aren't asking about a Perl module, it isn't appropriate to
crosspost to comp.lang.perl.modules. I'm setting followups for this
message to comp.lang.perl.misc.
Brent <brent@sympatico.ca> writes:
> I'm trying to convert a number to a letter based upon the ascii
> table (e.g. 65=A, 97=a) The reason for this is that I'm randomly
> generating user id's for account creation. I'm currently using a Novell
> Web Server and their Perl server however after coding I must port it
> over to a UNIX server. Does anyone know the syntax I can use to perform
> these two tasks?
>
> I have tried using the $userid[$i]=chr($randomnum) within a loop
> however from extensive testing, the chr() function doesn't seem to be
> returning anything. I tested this by performing a dump of the variable
> contents prior and after conversion attempt.
It looks to me like you are confusing Perl arrays with the way C
handles strings. The value of the variable $userid has *no*
relationship whatsoever with the values in the array @userid; setting
the first element of @userid does *not* set the first character of
$userid. If you want to do that, use substr(). For example:
substr($userid, $i, 1) = chr($randomnum);
Alternatively, you can combine the elements of the array into a string
afterwards:
$userid = join('', @userid);
I trust that you are taking care for $randomnum to be within the range
of valid printable ASCII characters, of course (i.e. 33 - 126)?
--Bill.
[posted and mailed]
--
William R Ward Bay View Consulting http://www.bayview.com/~hermit/
hermit@bayview.com 1803 Mission St. #339 voicemail +1 408/479-4072
hermit@cats.ucsc.edu Santa Cruz CA 95060 USA pager +1 408/458-8862
PGP Key 0x2BD331E5; Public key at http://www.bayview.com/~hermit/pubkey.txt
------------------------------
Date: Mon, 23 Feb 1998 21:23:03 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: IP-Address in Perlscripts
Message-Id: <34f1daa7.524144494f47414741@radiogaga.harz.de>
100.191995@germanynet.de wrote:
: If a Perlscript is called on a WWW-Server, is there any way to get the
: IP-Address of the caller?
For all you can get, have a look at the environment variables in the CGI
specification at http://hoohoo.ncsa.uiuc.edu/cgi/env.html, and take
furter questions regarding CGI to comp.infosystems.www.authoring.cgi .
In general, with all the proxy servers out there, you'll hardly get
the caller's IP.
: If there are any ideas please send me an eMail to: 100.191995@germanynet.de.
Ask here, read the answer here.
cu,
Martin
--
| Martin Vorlaender | VMS & WNT programmer
Ceterum censeo | work: mv@pdv-systeme.de
Redmondem delendam esse. | http://www.pdv-systeme.de/users/martinv/
| home: martin@radiogaga.harz.de
------------------------------
Date: Mon, 23 Feb 1998 11:22:44 -0800
From: Billy Vitro <bvitro@cisco.com>
Subject: Java's hidden flaw
Message-Id: <34F1CC84.6678@cisco.com>
>From EDTN's News of the Week:
Software:
http://www.edtn.com/scribe/notw/980220.htm#software
Java's creator says the software was never intended to be a commercial
product.
Just thought you'd like to know...
Billy.
------------------------------
Date: Mon, 23 Feb 1998 13:34:04 -0700
From: "Jeffrey W. Kehoe" <kehoe@fc.hp.com>
Subject: kill() on NT?
Message-Id: <34F1DD3C.9DFDAFB8@fc.hp.com>
I'm porting some perl code from Unix to NT. The code spawns off some
other
processes, storing the PIDs in a file, then exits. Another perl script
comes along
later, reads the PIDs, then kills the processes with kill().
All of the documentation I've found says that this shouldn't work on
NT. But
I found that if I change the signal from SIGKILL to SIGTERM, it does
indeed
kill the processes. The call to kill() doesn't return the number of
processes
killed as it is supposed to, but it seems to work otherwise.
Can anyone explain why this works? Is it safe to use, or should I write
my
own tool that uses OpenProcess & TerminateProcess?
------------------------------
Date: Mon, 23 Feb 1998 14:21:50 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Law-enforcement apps ?
Message-Id: <34F1E852.20DEAA0D@5sigma.com>
However, some of us don't particularly mind poor line wrapping.
Mostly when I avoid posts it's because they're just not
very interesting. I found John Austin's post moderately interesting,
and I would like to see a contentful follow-up from someone.
-joseph
Jonathan Feinberg wrote:
>
> [courtesy cc of this posting sent to cited author via email]
>
> jwaustin@sympatico.ca said...
> : I am currently wrapping-up a project in law-enforcement and am filling
> : in a missing link
>
> I should warn you that until you configure Netscape to line-wrap correctly,
> many people will skip your article out of principle. I couldn't think of a
> funny enough way to pun on "wrapping-up"; be glad.
--
Joseph N. Hall, prop., 5 Sigma Productions mailto:joseph@5sigma.com
Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
Perl Training . . . . . . . . . . . . . . . http://www.perltraining.com
------------------------------
Date: Mon, 23 Feb 1998 20:59:30 GMT
From: Phil Kime <Phil.Kime@ed.ac.uk>
Subject: OLE Automation with Win32 Perl and Word?
Message-Id: <exgd8geqbpp.fsf@ed.ac.uk>
I'm having trouble using the ActiveState OLE:: module when trying to
control Word by OLE. I know that WOrd doesn't really support OLE as
such but it does make the Basic object available and you can then send
it WordBasic commands via OLE. This doesn't seem to to work properly
using the Perl interface though:
use OLE;
$word = CreateObject OLE 'Word.basic';
$word->Bold;
This calls the Bold *function* and not the Bold statement of Word
Basic. So, it just returns the current bold status, not sets it. I
can't see a way to get access to the sattement rather then the
function.
$word->FileOpen('C:\autoexec.bat');
No problem. This works.
$word->FileOpen('C:\autoexec.bat','',1);
This fails to do anything. Any call to a WB function that has optional
named parameters (that, as in VB, I am faking using positional
paramers as per the VB guidelines) fails. These two problems make
World OLE automation pretty useless. I hope I am missing seeing some
cunning way to do this ... any ideas?
p
--
= Phil Kime (Phil.Kime@ed.ac.uk) =
= Dept of Philosophy/Centre for Cognitive Science =
= University of Edinburgh =
------------------------------
Date: Mon, 23 Feb 1998 14:26:05 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Perl 4/5
Message-Id: <34F1E951.A155398C@5sigma.com>
There are plenty of Perl 4 books about CGI programming.
(sarcasm intended)
-joseph
Geert Roovers wrote:
>
> Hi All!
>
> I'm making my first steps on the Perl path, and sofar, I have one major
> problem. I can only find books teaching me Perl 5 [...]
--
Joseph N. Hall, prop., 5 Sigma Productions mailto:joseph@5sigma.com
Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
Perl Training . . . . . . . . . . . . . . . http://www.perltraining.com
------------------------------
Date: Mon, 23 Feb 1998 17:45:07 GMT
From: erik@phidias.colorado.edu (Erik Johnson)
Subject: returning immediately from system call?
Message-Id: <34f1b44e.46922300@news.colorado.edu>
I've looked into the FAQ but come up empty handed (perhaps I don't
know the right question to 'ask'?).
Is there a way to have perl continue running after making a system
call to launch another program, without waiting for the other program
to complete?
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
Erik Johnson erik@ phidias.colorado.edu
http://phidias.colorado.edu/ejvgallery
http://phidias.colorado.edu/phidias
------------------------------
Date: 23 Feb 1998 18:07:58 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: returning immediately from system call?
Message-Id: <6csdtu$n1e$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, erik@phidias.colorado.edu (Erik Johnson) writes:
:I've looked into the FAQ but come up empty handed (perhaps I don't
:know the right question to 'ask'?).
:
:Is there a way to have perl continue running after making a system
:call to launch another program, without waiting for the other program
:to complete?
I think when you say "system call" that you don't mean system call.
A system call is a trap into kernel space.
You're thinking of system("shell cmd"). Well, how do you
put something in the background in the shell?
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
X-Windows: Some voids are better left unfilled.
--Jamie Zawinski
------------------------------
Date: Mon, 23 Feb 1998 14:18:51 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Runtime building of search expression
Message-Id: <34F1E7A0.38533424@5sigma.com>
Hmm, if you could convert 1:9, 3:4 etc. to Julian dates, the
problem becomes much, much easier. However, you have to know
whether the year you're searching is a leap year. Assuming
that's the case:
First, substitute 9 for 1:9, 63 for 3:4, etc.:
$str =~ s/(\d+):(\d+)/my_julian_date($1, $2)/eg; # or whatever
Then you have something looking like 9-63,127. That happens to be
a range format like the one in news history files, and there's a
module that can already parse and manipulate it: Set::IntSpan.
Wish I could tell you offhand which one of the Time modules will
compute Julian dates, but that shouldn't be too hard to figure
out anyway.
-joseph
Timothy Loy wrote:
>
> I am trying to write a perl thingie to search for things within
> a range with 2 parameters.
>
> File structure looks like:
> Month,Day,Entry
>
> Want to accept input like:
> 1:9-3:4,5:7
> which means get any entry from 9th of Jan to 4th of Mar and
> the entry on 7th of May
>
> what is the best way to parse and search for this?
--
Joseph N. Hall, prop., 5 Sigma Productions mailto:joseph@5sigma.com
Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
Perl Training . . . . . . . . . . . . . . . http://www.perltraining.com
------------------------------
Date: 23 Feb 1998 21:36:37 GMT
From: petdance@maxx.mc.net (Andy Lester)
Subject: Re: Send email from Perl on NT platform
Message-Id: <6csq55$7rf$1@usenet88.supernews.com>
: Is there a was to send email from a Perl script on the NT platform? If so,
: any code examples of how to use it would be appreciated.
Visit perl.com, find the Win32 section, find the Win32 FAQ, and have a
read.
xoxo,
Andy
--
--
Andy Lester: <andy@petdance.com> http://tezcat.com/~andy/
Chicago Shows List: <shows@ChicagoMusic.com> http://ChicagoMusic.com/
------------------------------
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 1959
**************************************