[8786] in Perl-Users-Digest
Perl-Users Digest, Issue: 2403 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 23 15:17:15 1998
Date: Thu, 23 Apr 98 12:00:27 -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 Thu, 23 Apr 1998 Volume: 8 Number: 2403
Today's topics:
AIX, sfio and mod_perl (again) (Jeffrey R. Drumm)
Re: Array / List question <barnett@houston.Geco-Prakla.slb.com>
RE: Calling in Config files skruzich@stc.net
Re: Defending Perl <tchrist@mox.perl.com>
Re: Defending Perl <jdporter@min.net>
Re: Defending Perl (Ilya Zakharevich)
Re: Eat my dust - Perl running on Windows 95 <mindmore@mindless.com>
Re: fixed width text files (Jeff)
help (again sorry) (Aaron Drake)
How do you read e-mail with Perl/MailTools? (C. Watson)
Re: How to get times in different timezones? <jamesr@aethos.co.uk.nospam>
Re: Idea-- Command promt through www page? <jhoglund@mirage.skypoint.net>
Re: if ($string eg "y") or if ($string == "y") (gaj)
Re: looking for a good win32 perl editor. (User)
Re: Memory Leak? Embedding into C (Ken Fox)
PC-based editors for Perl? (Lee Roth)
Re: problem: num/str related <ljz@asfast.com>
Re: problem: num/str related <tchrist@mox.perl.com>
Re: problem: num/str related <lr@hpl.hp.com>
Re: Problems with 'wait' under perl5.004 (Jason Gloudon)
Re: Short circuit predicates based on existence or defi <jdporter@min.net>
Re: Short circuit predicates based on existence or defi (Jason Gloudon)
Re: Short circuit predicates based on existence or defi (Kevin Reid)
Re: spoiled noobie (Kevin Reid)
Re: Symbolic ref and angle opeator (Mark-Jason Dominus)
Re: There *IS* a visual IDE for Perl! <qdtcall@esb.ericsson.se>
tie - ing to NDBM only writes values assigned after the ssharma@clearnet.com
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 23 Apr 1998 17:56:06 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: AIX, sfio and mod_perl (again)
Message-Id: <353f7696.188046696@news.mmc.org>
I downloaded, compiled and installed mod_perl 1.11 without incident yesterday,
and things seemed to work mostly OK. However, some of my scripts exhibited
problems that were purportedly fixable by the recompilation of Perl/mod_perl
with sfio.
After much farting around, I was finally able to get Perl 5.004_04 to compile
with sfio on AIX 3.2.5 (IBM's C compiler, not gcc . . . for those of you who've
fought this particular battle and lost). All tests completed successfully, and
Perl seems happy enough. However, I can't get mod_perl to recompile!
make gets to compiling perlio.c, and things go straight to hell . . . cc starts
spewing syntax, undeclared variable, and other errors. I'm sure there's a
pointer to a header file or library missing somewhere, but I can't figure it
out (I'm pretty raw when it comes to C and all its lovely friends). I've gone
through DejaNews, the mod_perl mail archives, and all the pods that come with
mod_perl and can't find an answer.
Any pointers? What can I show you that might give you some clues?
Output from perl -V:
Summary of my perl5 (5.0 patchlevel 4 subversion 4) configuration:
Platform:
osname=aix, osvers=3.2.5, archname=aix
uname='aix ohboy 2 3 000147084800 '
hint=previous, useposix=true, d_sigaction=define
bincompat3=y useperlio=undef d_sfio=define
Compiler:
cc='cc', optimize='-O', gccversion=
cppflags='-D_ALL_SOURCE'
ccflags ='-D_ALL_SOURCE'
stdchar='unsigned char', d_stdstdio=define, usevfork=false
voidflags=15, castflags=1, d_casti32=define, d_castneg=undef
intsize=4, alignbytes=8, usemymalloc=n, prototype=define
Linker and Libraries:
ld='ld', ldflags =''
libpth=/lib /usr/lib /usr/ccs/lib /opt/lib
libs=-lsfio -ldbm -lld -lm -lc -lbsd -lPW
libc=/lib/libc.a, so=a
useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_aix.xs, dlext=so, d_dlsymun=undef, ccdlflags='-bE:perl.exp'
cccdlflags=' ', lddlflags='-H512 -T512 -bhalt:4 -bM:SRE
-bI:$(PERL_INC)/perl.exp -bE:$(BASEEXT).exp -e _nostart -lc'
Characteristics of this binary (from libperl):
Built under aix
Compiled at Apr 23 1998 09:08:46
@INC:
/opt/lib/perl5/aix/5.00404
/opt/lib/perl5
/opt/lib/perl5/site_perl/aix
/opt/lib/perl5/site_perl
.
Thanks . . .
--
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center - Medical Information Systems Group
drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me
------------------------------
Date: Thu, 23 Apr 1998 11:52:23 -0500
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: Array / List question
Message-Id: <353F71C7.B178CD47@houston.Geco-Prakla.slb.com>
Randal Schwartz wrote:
>
<snip>
> I feel like I'm being stalked. :-)
>
> (Yeah, yeah, Dejanews... I know.)
>
Just because there's dejanews, what makes you think you aren't being
stalked? After all, being paranoid doesn't necessarily mean everyone
isn't out to get you. :-)
Just a thought.
> print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
> ## legal fund: $20,990.69 collected, $186,159.85 spent; just 131 more days
> ## before I go to *prison* for 90 days; email fund@stonehenge.com for details
>
> --
> 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
Dave
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
----------------------------------------------------------------------
Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com
DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com
----------------------------------------------------------------------
------------------------------
Date: Thu, 23 Apr 1998 10:16:40 -0600
From: skruzich@stc.net
Subject: RE: Calling in Config files
Message-Id: <6hnm0n$81m$1@nnrp1.dejanews.com>
I am writing a script to automate a backup program, and I was wanting to know
if there was a easy way to put stuff into a config file, for easy updates, to
call into the perl script. For example, the volumenames of tapes could be
placed into the configfile and called in. What I am running into is problems
with how to do it. I know that in C, you can #inherit, or a include
statement. I am getting a bit confused on what i can and can't do.
This is what i want to do.
I want to bring in a config file with certain information defined.
for example.
cfgfile
______________
TAPEVOLS
000001
000002
000003
000004
000005
000006
000007
END_TAPEVOLS
NEXTDATA
blah blah blah
blah blah blah
END_NEXTDATA
_______________________
perlscript
_________________
#!/opt/perl5/bin/perl
#include cfgfile;
Thanks
Steve Kruzich
skruzich@stc.net
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 23 Apr 1998 15:34:53 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Defending Perl
Message-Id: <6hnn2t$iqe$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
wayne@Glue.umd.edu (Wayne C. McCullough) writes:
:I forget where, but somewhere in the man pages they make the claim that
:Perl will run as fast as C for most things.
For most problems in its domain, Perl will run only about e times slower
than C, occasionally slower, and sometimes even faster. I've taken that
bet -- and won -- on many occasions. I have ever lost, but then, I know
not to take numeric challenges if I can't use the PDL extension. :-)
Another metric is this: give a C programmer and a Perl programmer the same
task, and just five minutes to write it in (ten if they're apprentices).
See who gets how much done. Of assign five programs and one hour, and check
the same thing.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
You have to admit that it's difficult to misplace the Perl sources. :-)
--Larry Wall in <1992Aug26.184221.29627@netlabs.com>
------------------------------
Date: Thu, 23 Apr 1998 14:31:14 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Defending Perl
Message-Id: <353F5237.5CFB@min.net>
Marjorie Roswell wrote:
>
> Does anyone else see a need for a "debunking Perl myths" FAQ?
It would be a nice addition to the collection of advocacy-
related documents, but I wonder how effective it could be,
even in theory.
The kinds of myths you're talking about -- not widely use,
slow, difficult to install, difficult to use -- are largely
qualitative. We could put the bald facts in the "Perl Myths
FAQ", and it wouldn't convince anyone.
Myth: Very few people use Perl.
Fact: Very many people use Perl.
Myth: Perl has some performance problems, due to its
interpreted nature.
Fact: Perl is snappy, due in part to its interpreted
nature, although not as fast a C and other
assembly-like languages.
Myth: Perl has some installation problems.
Fact: Perl is easy to install, especially if installing
a precompiled binary.
Myth: Perl is, or can be, harder to work in than C or C++.
Fact: Perl is very easy to write, and code reuse is
facilitated by a much better module & package scheme
than C or C++ (or Java).
Convincing?
John Porter
------------------------------
Date: 23 Apr 1998 18:15:11 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Defending Perl
Message-Id: <6ho0ff$qsf$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Wayne C. McCullough
<wayne@Glue.umd.edu>],
who wrote in article <6hni88$7tb$1@hecate.umd.edu>:
> Well, first of all, Perl isn't really interpreted. It is compiled at
> run time. Compare a Perl and a shell script that do similar things.
Perl is not compiled (even if you use perl2c translator). Perl is
interpreted. Though what the interpreter works on is not the original
script, but a semi-digested "compile tree".
> I forget where, but somewhere in the man pages they make the claim that
> Perl will run as fast as C for most things. Yes, you have the compile
> time on top to deal with, but in general it is fast.
Perl will run 200 times as slow as C for "most" things. This is
confirmed by many independent benchmarks of different things.
Why we still use Perl? Since we do not do "most" things most the time
;-). Those few things that Perl does better than C may be combined to
cover "most of the practical tasks".
And when we hit those things which cannot be made quickly in Perl, one
can always say "At least the development time was better", grinding
our teeth. :-(
> I have had the most problems performance wise with Perl using up too
> much memory than anything else. Now, mind you, this is with big (say
> 100,000+) arrays. I think Perl isn't very good at keeping data
> structures as tight as they could be.
*This* is a misunderstanding. If you want C array, nothing will do it
as good as C. If you want an array which as useful as Perl one, you
will be hit by a similar overhead.
> And Perl is easier to code. I can't put it into a more scientific
> arguement, I just find Perl to be easier in many things.
If you are *pretty experienced* in C, Perl is not *orders of
magnitude* better. But it is infinitely more fun. People often
underestimate importance of fun-vs-grind-your-teeth ratio for coding.
Ilya
------------------------------
Date: Thu, 23 Apr 1998 16:06:57 +0300
From: Fain <mindmore@mindless.com>
Subject: Re: Eat my dust - Perl running on Windows 95
Message-Id: <353F3CF1.7077923E@mindless.com>
Bart Lateur wrote:
> Fain wrote:
>
> > Wow! you guys really know how to get off subject!
>
> What subject?
>
> Bart.
The original subject was on how a guy got perl working on his 486. Now
they are talking about porn. Change your USENET view to sort the
messages by subject and read them all for this subject, you'll see.
- Nathan
mindmore@mindless.com
------------------------------
Date: Thu, 23 Apr 1998 12:14:48 GMT
From: jeffmcc@mindspring.com (Jeff)
Subject: Re: fixed width text files
Message-Id: <353f2e71.2131374@news>
Thanks, I've provided some more info below. The reply just below
your's has the following suggestion.
open(F, $filename) || die "Can't open $filename";
while $line (<F>) {
@data = $line =~ /(.{5})(.{6}) ... /;
}
I haven't tried it yet but it's heading the right direction.
On Wed, 22 Apr 1998 13:11:29 -0500, Dave Barnett
<barnett@houston.Geco-Prakla.slb.com> wrote:
>Jeff wrote:
>>
>> I have a text file with approximately 400 rows. Each row has 31
>> columns, and each column has a different width.
>Ok.
>
>> I'm a newbie so if
>> this elementary question frustrates anyone I apologize.
>No particularly.
>
>> But, how can
>> I read from this file and set the width for each individual column so
>> I can reference them?
>>
>I'm not exactly sure what you mean by getting the width, but
>length($yourVariable);
By width I mean length, field(0) has a length of 24, field(1) has a
length of 8, field(10) has a length of 2
>
>Will tell you how many characters are in $yourVariable.
>
>> TIA,
>> Jeff
>How are the fields divided? Comma-delimited? Double colon (::)?
>Space? Tab?
The fields are not delimited. This file is coming from an outside
source. It looks to me that they are feeding the data from a table
straight into a fixed width text file.
>
>All very relevant information.
>
>Maybe a few sample lines of the input file, and what you've tried (aka a
>code snippet) would be appropriate?
OK
01155800281 1998022319980309199801221998021802700000748KWH
00000083211998030501ELECTRIC DUKEP28272B DUKEP0002DUKE POWER
P O BOX 70516 CHARLOTTE NC28272
19980310637245CAR-64102-5136-074-003CAR641025136074003600 N. SUMMIT
AVE CHARLOTTE NC0000000000617244
This is one line of input data. This is deceiving. The spaces do not
represent a delimiter but unfilled spaces for that particular field.
I have a data file layout that describes the field type, start/stop
for the field, length of field.
>
>For help without providing the above, please post to
>comp.lang.perl.psychic
>
>No one here (at least not me) is psychic. We're willing to help those
>who (at least attempt to) help themselves.
>
>HTH.
>
>Dave
>
>--
>"Security through obscurity is no security at all."
> -comp.lang.perl.misc newsgroup posting
>
>----------------------------------------------------------------------
>Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com
>DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com
>----------------------------------------------------------------------
------------------------------
Date: Thu, 23 Apr 1998 09:36:28 -0400
From: aarond@cutco.com (Aaron Drake)
Subject: help (again sorry)
Message-Id: <aarond-2304980936280001@aaron.cutco.com>
The earlier help was appreciated but I couldn't get it to work. Probably
some fault of my own I'm sure.
I'll give a little more detail here and see if that fares any better.
The project is this, We have a web site that is only for certain people in
our company. They want to have people go to a web page and enter a
password and their name and be redirected to a site modified for that
zone.
Their are 7 zones, 1,2,3,5,6,8,C. The name would have to only be written
to a file, then the password which would be 10 characters would also have
to be written to the same file. The password is 6 characters of useless
information to make people feel like they get their own password and 4
characters of their office #, the office number begins with the zone
number,letter.
So I have to let someone go to the page, enter their password and be
redirected by the seventh character in the password.
I was using BNBform (ftp://bignosebird.com/bnbform.zip) to handle the
forms, and tring to add new functions to that to handle the redirection.
It sounds simple and it probably is but I just cant figure it out (well
not and make it work anyway :).
Thanks in advance,
Aaron Drake
------------------------------
Date: Thu, 23 Apr 1998 17:16:33 GMT
From: cwatson@nuevo.com (C. Watson)
Subject: How do you read e-mail with Perl/MailTools?
Message-Id: <6hnssp$2bm$1@clarknet.clark.net>
The FAQ suggests using Internet.pm from the MailTools package to read e-mail,
which I have installed. I am not (as yet) a perl wizard, and find that the
documentation and examples for this package don't give me enough information
on using it to read e-mail. I've searched DejaNews and this newsgroup for
information on reading e-mail, and have found nothing.
I am sure I could use sockets to open a connection to a pop server, but I am
looking for an easier, softer way.
TIA for any suggestions/pointers/examples
Charlie Watson
------------------------------
Date: 23 Apr 98 15:05:26 GMT
From: "James Richardson" <jamesr@aethos.co.uk.nospam>
Subject: Re: How to get times in different timezones?
Message-Id: <01bd6ec9$6fb72f80$26c0a4c1@kitkat.aethos.co.uk>
Peter Eddy <petere@atg.com> wrote in article <353E1B1B.A9AA7337@atg.com>...
> Hi, I'm a Perl newbie trying to figure out how to calculate time of day
> in various time zones taking into account daylight savings time. For
> example, getting GMT was easy, but how do I then figure out the correct
> time in Hong Kong if my machine's not in Hong Kong?
>
> Thanks,
> Peter
You dont have to do any working out at all... Thats what localtime() is for.
Localtime (at least on my UNIX system) looks at the TZ (TimeZone) environment variable
to calculate the localtime from UTC.
You can try setting your TZ to something like NZST-12NZDT (New Zealand) and check that it works.
James
PS: Did you check dejanews first... cos the answer is there too.....(08/04/98)
------------------------------
Date: 23 Apr 1998 12:40:24 GMT
From: Jamie Hoglund <jhoglund@mirage.skypoint.net>
Subject: Re: Idea-- Command promt through www page?
Message-Id: <6hncro$632$1@shadow.skypoint.net>
Fain <mindmore@mindless.com> wrote:
: This idea has lot's of secirity problems, I know this already. However,
: it would be cool to try out. Question: Do you think it is possable...
: would it just be a matter of having the perl sript run the commands?
: - Nathan Fain
: mindmore@mindless.com
I've done it, so it's possible.
As you noted, there are many security problems.
The way I implemented it was a "sequence number" as well as a password
requirement. Each time the script was run, it would increment a sequence
number and feed it back. If the sequence numbers didn't line up, it locked
you (and presumably them) out.
It turned out to be more a pain than it was worth, (it was for ISP's that
allow cgi but not telnet) One of the requirements was that it not require
much setup. (the password was crypt()'d and hard coded into itself the
first time you ran it, it re-created itself with a password)
You'll need to preserve your cwd & environment between each call. (and
don't leave it laying around anywhere!)
Also, don't use cookies or the GET method, since that makes passwords
visable.
Jamie
--
-------------------------------------------------------------------------
jamie@lecart.com * Geek in training wheels * (shopping cart)
http://www.lecart.com - Web based online order system. (with templates)
------------------------------
Date: Thu, 23 Apr 1998 14:08:42 GMT
From: gjandl@rf.mnschoolbiz.com (gaj)
Subject: Re: if ($string eg "y") or if ($string == "y")
Message-Id: <353f47d9.161070652@news.spacestar.net>
On Wed, 22 Apr 1998 16:48:29 -0700, Yeu-Perng Nieh <ynieh@fhcrc.org>
wrote:
>Dear all,
>
> Does anyone know the difference b/w
>
>if ($string eg "y") and if ($string == "y")?
:s/eg/eq/ I assume
>It seems to me that the latter does not work for string matching.
>Even $string is something totally different from "y",
>the if statement is always true. Any comments?
Yes. (All together now...) RTFM.
Seriously, this is stated clearly in perlop, in the Camel book, in the
Llama book and in the Geko book. I would suggest starting with either
the Llama book (if you are using a Unixy OS) or the Geko book (if you
are using Win32), as these are tutorial introductions. At some point
in your Perl adventures you will likely want to grab a copy of the
legendary Camel book as well. All of these books and more are
available from most book stores, including Amazon if you prefer to buy
online. O'Reilly publishes them - www.oreilly.com for more info.
Regardless, type 'perldoc perlop' or 'man perldoc' on your system and
you should get the info you need for this question. Please also see
the other fine (and free) documentation that comes with the standard
Perl distribution. 'man perl' or 'perldoc perl' should show you what
you've got. Finally, please seek out and read the FAQ! You can find
it, and much other fine information, at 'www.perl.com'.
------------------------------
Date: Thu, 23 Apr 1998 14:25:12 GMT
From: you@somehost.somedomain (User)
Subject: Re: looking for a good win32 perl editor.
Message-Id: <353f4f17.1210384000@news.btinternet.com>
On Wed, 15 Apr 1998 22:56:46 +0100, "Tony Kenny" <tony@cyberscape.net>
wrote:
>Charles Engelke wrote in message <35326F3C.4C5@ibm.net>...
>>James wrote:
>>>
>>> Hello all,
>>>
snip
>>> jamesht@idt.net
>>
>
snip
>
>Anyone know of a Perl editor that i can say 'I want a program to do....' and
>it will do it all for me? Now that will be good! :))
>
>~Tony--
>
I have one, and I'll hire him out to you for going rates :->
------------------------------
Date: 23 Apr 1998 16:52:32 GMT
From: kfox@pt0204.pto.ford.com (Ken Fox)
Subject: Re: Memory Leak? Embedding into C
Message-Id: <6hnrkg$nqd5@eccws1.dearborn.ford.com>
Michael Nguyen <ez062634@mailbox.ucdavis.edu> writes:
> On Thu, 16 Apr 1998, Ken Fox wrote:
> > All I suggested is that instead of starting multiple interpreters
> > in a process, just start one and reuse it. You're not threading
> > are you? That will cause all sorts of trouble in 5.004. I'd
> > start one perl interpreter in a single thread and then mutex lock
> > access to it. Kind of heavy handed, but at least it's safe...
>
> how does one go about sharing one process in win95? I run a server
> that runs several scripts and it seems like every time i run the script
> a new interpreter is loaded into memory.
I never said "share a process." I said "share an interpreter." That
means in *every* process you need a perl interpreter, start *exactly* one.
When you "run a script," use an eval or do statement executed in an
existing interpreter instead of starting another interpreter and passing
the file name as an argument to perl_parse(). The easiest way to do
this is to define a "helper" perl sub in the argument to perl_parse() and
then call that sub from a C function whenever you need to run a script.
A very simple-minded implementation would be like:
PerlInterpreter *perl = 0;
SV *t_run = 0;
void startup()
{
static char *argv[] = { "embedded_perl", "-e", 0, 0 };
if ((perl = perl_alloc()) != 0)
{
static char STARTUP_BOILER_PLATE[] =
"sub t_run {"
"do $_[0];"
"}\n";
argv[2] = STARTUP_BOILER_PLATE;
perl_construct(perl);
perl_parse(perl, xs_init, 3, argv, 0);
perl_run(perl);
t_run = (SV *)perl_get_cv("t_run", FALSE);
}
}
int run_script(char *filename)
{
int status = FALSE;
if (perl != 0)
{
SV *result = 0;
int count;
dSP;
ENTER;
SAVETMPS;
PUSHMARK(sp);
XPUSHs(sv_2mortal(newSVpv(filename, strlen(filename))));
PUTBACK;
count = perl_call_sv(t_run, G_SCALAR);
SPAGAIN;
if (count == 1)
{
result = POPs;
status = SvTRUE(result);
}
PUTBACK;
FREETMPS;
LEAVE;
}
return status;
}
Call startup() exactly once in each process. Call run(filename)
whenever you want to run a script. This will share the same
interpreter between all of your scripts. The t_run perl sub is
quite naive -- you might want to give scripts their own module
space or avoid recompilation for the same script or other things
to make it faster and/or safer.
The code above is uncompiled and untested, but you should get the
idea. This stuff was taken from my perl-c++ wrapper library that
you can find in CPAN under authors/id/KENFOX.
- Ken
P.S. I appologize for the
> > Everything has design limitations. ;) You might want to consider that
> > creating
> > a new interpreter is quite expensive. If you've already done it once in
> > your
> > process, why do it again? Take a look at mod_perl for an excellent
> > example of
formatting crap. Anybody know why Netscape seems to ignore my *explicit*
carriage returns and insert its own? Trying to use these tools gives me
new sympathy for people who only have a PC...
- Ken
--
Ken Fox (kfox@ford.com) | My opinions or statements do
| not represent those of, nor are
Ford Motor Company, Powertrain | endorsed by, Ford Motor Company.
Analytical Powertrain Methods Department |
Software Development Section | "Is this some sort of trick
| question or what?" -- Calvin
------------------------------
Date: Thu, 23 Apr 1998 14:33:43 GMT
From: leeroth-nospamo@worldnet.att.net (Lee Roth)
Subject: PC-based editors for Perl?
Message-Id: <6hnjmg$svs@news1.ee.net>
Any suggestions for an editor on a PC that would be 'better suited' to
writing Perl code than native editors such as Notepad, Wordpad or
(uck) a word processing package ?
My personal editor is SEDT, available as freeware at
http://www.ultranet.com/~anker/sedt/sedt.htm - works on a number of
platforms (VMS,DOS/Windows,Unix) and offers many nice features among
which I find valuable for Perl programming:
1) 'Find the matching curly brace' functionality
2) Auto-indent of left margin (indents same as previous line)
3) Ability to record keystroke macros and program keys on the fly
Now SEDT is not for everyone (and I think the Windows version lacks a
bit), so here is my question: What editor on a PC supports features
1,2, or 3 that I have listed above?
I'd like to be able to suggest an editor to some people doing Perl
development on a PC.
Thanks-
Lee Roth
(doctor email address by removing 'nospamo' if you want to email me)
------------------------------
Date: 23 Apr 1998 08:34:48 -0400
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: problem: num/str related
Message-Id: <ltson4pvh3.fsf@asfast.com>
"Xah" <xah@love.com> writes:
> I've been debugging a script for 3 hours, and am in severe pain now. I've
> narrowed the script to the following. The problem lies in the two _elsif_
> lines. I assume the problem is related to conversion between numbers and
> strings. If anyone can help out, greatly appreciated.
>
> [ ... ]
>
> sub verifyArgument {
> my($d1,$d2)= @_;
>
> print "$d1, $d2, \n";
>
> if (undef($d1) or undef($d2)) {return "start date or end date are not
^^^^^^^^^^ ^^^^^^^^^^
`undef' is a built-in function which undefines its arguments. In other
words, once `undef($d1)' is invoked, `$d1' loses its value and becomes
undefined. I think that if you use `!defined($d1)' and `!defined($d2)'
in the above line instead of `undef', your problem will be solved.
Good luck!
> [ ... ]
--
Lloyd Zusman ljz@asfast.com
perl -e '$n=170;for($d=2;($d*$d)<=$n;$d+=(1+($d%2))){for($t=0;($n%$d)==0;
$t++){$n=int($n/$d);}while($t-->0){push(@r,$d);}}if($n>1){push(@r,$n);}
$x=0;map{$x+=(($_>0)?(1<<log($_-0.5)/log(2.0)+1):1)}@r;print"$x\n"'
------------------------------
Date: 23 Apr 1998 12:34:30 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: problem: num/str related
Message-Id: <6hncgm$7ua$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
"Xah" <xah@love.com> writes:
:I've been debugging a script for 3 hours, and am in severe pain now.
: if (undef($d1) or undef($d2)) {return "start date or end date are not
What do you think undef does? You're using it as though it were
a synonym for !defined. It's not. It *MAKES ITS ARG UNDEF*.
unless (defined($d1) && defined($d2)) { ... }
Is what you want.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
I might be able to shoehorn a reference count in on top of the numeric
value by disallowing multiple references on scalars with a numeric value,
but it wouldn't be as clean. I do occasionally worry about that. --lwall
------------------------------
Date: Thu, 23 Apr 1998 07:35:05 -0700
From: "Larry Rosler" <lr@hpl.hp.com>
Subject: Re: problem: num/str related
Message-Id: <6hnjki$ot9@hplntx.hpl.hp.com>
Xah wrote in message <6hnb84$cj8$1@nntp2.ba.best.com>...
...
>";} elsif ($d2 < $d1) {
>return "end date must be later than start date.";}
> elsif (("$d1" !~ m@^\d{6}$@) or ("$d2" !~ m@^\d{6}$@)) {return
"date
>must be\
> of the form yyyymm. e.g. 199803 for 1998 March.";}
># elsif (($d1 < 199701) or ($d2 < 199701)) {return "date must not be
>earlier \
>than 199701";}
Just one more observation, in addition to the others: The test
comparing the two dates should come last, not first -- *after* the tests
that verify that each date is well formed and in range.
--
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com
------------------------------
Date: Thu, 23 Apr 1998 16:24:45 GMT
From: jgloudon@hyssop.bbn.com.bbn.com (Jason Gloudon)
Subject: Re: Problems with 'wait' under perl5.004
Message-Id: <slrn6juqq0.ail.jgloudon@hyssop.bbn.com>
Richard West <rgw@star.le.ac.uk> wrote:
>Michael Francis FIR LDN wrote:
>>
>
>> The module worked correctly under perl5.001, we have now upgraded to
>> version 5.004. The symptom is that wait always returns -1 even though
>> the process has spawned a number of child processes. This only occurs
>> following a sigalarm . Does anybody know why this is the case? and if
>> there is any way around this?
Wait is supposed to return if a signal (like alarm is received while waiting),
try testing the errno value in $!.
--
Jason Gloudon
------------------------------
Date: Thu, 23 Apr 1998 14:53:28 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Short circuit predicates based on existence or definedness, not truth
Message-Id: <353F576D.6801@min.net>
Kevin Reid wrote:
>
> sub vexists ($$;$) {
> my ($var, $type, $pkg) = @_;
> $pkg ||= (caller)[0];
> return (*{"${pkg}::$var"}{$type});
> }
Thanks, Kevin, for that great sub!
(See, I knew it was easy. ;-)
John Porter
------------------------------
Date: Thu, 23 Apr 1998 14:29:13 GMT
From: jgloudon@hyssop.bbn.com.bbn.com (Jason Gloudon)
Subject: Re: Short circuit predicates based on existence or definedness, not truth
Message-Id: <slrn6juk1d.a1r.jgloudon@hyssop.bbn.com>
John Porter <jdporter@min.net> wrote:
>But on a related note: why doesn't perl allow one to test
>the existence of variables? At least package variables;
>since symbol tables are just like hashes, it would be
>easy enough to check for an entry in the symbol table.
>Well, I guess that's just it: it IS easy. No special
>primitive required. But, OTOH, when one has summoned
>@main::foo into existence, it suddenly appears that
>$main::foo exists as well... Maybe it's not so easy.
That isn't true:
#!/usr/local/bin/perl -w
$foo='some value';
$theglob=*foo;
print "\@foo defined" if defined @{$theglob};
print "\$foo defined as ${$theglob}\n" if defined ${$theglob};
--
Jason Gloudon
------------------------------
Date: Thu, 23 Apr 1998 10:32:54 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: Short circuit predicates based on existence or definedness, not truth
Message-Id: <1d7xnpo.h6z5di10zb8y0N@slip166-72-108-132.ny.us.ibm.net>
John Porter <jdporter@min.net> wrote:
> Andy Glew wrote:
> >
> >...
> > Please email responses; I don't read these newsgroups.
>
> Heh. Loser.
>
> But on a related note: why doesn't perl allow one to test
> the existence of variables? At least package variables;
> since symbol tables are just like hashes, it would be
> easy enough to check for an entry in the symbol table.
> Well, I guess that's just it: it IS easy. No special
> primitive required. But, OTOH, when one has summoned
> @main::foo into existence, it suddenly appears that
> $main::foo exists as well... Maybe it's not so easy.
>
> John Porter
Try this code:
#!perl -w
sub vexists ($$;$) {
my ($var, $type, $pkg) = @_;
$pkg ||= (caller)[0];
return (*{"${pkg}::$var"}{$type});
}
$i = 1;
$i++;
@i = (1, 2);
$y::z = 5;
$y::z++;
print vexists("i", "SCALAR") ?"yes":"no","\n";
print vexists("i", "ARRAY") ?"yes":"no","\n";
print vexists("i", "HASH") ?"yes":"no","\n";
print vexists("z", "SCALAR", "y") ?"yes":"no","\n";
__END__
This outputs:
yes
yes
no
yes
--
Kevin Reid. | Macintosh.
"I'm me." | Think different.
------------------------------
Date: Thu, 23 Apr 1998 10:32:45 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: spoiled noobie
Message-Id: <1d7wt2h.11e1szv7kiilwN@slip166-72-108-132.ny.us.ibm.net>
Fain <mindmore@mindless.com> wrote:
> Kevin Reid wrote:
>
> > exclaim($ARGH);
> >
> > $me{intelligence} = 0;
> >
> > $mistakes++;
> >
> > --
> > Kevin Reid. | Macintosh.
> > "I'm me." | Think different.
>
> exclaim($ARGH);
>
> $me{intelligence} = Macintosh;
> $me{intelligence} = 0; # this line is not necessary because
> # they are one in the same
> $mistakes++;
>
> --
> Nathan Fain | Macintosh.
> Kevin is 'me'. | Don't Think.
>
> Kevin... sorry... I'm just picking on you (I don't normally do this).
$you{intelligence} += 65535 if $^O eq "MacOS"; # :-)
--
Kevin Reid. | Macintosh.
"I'm me." | Think different.
------------------------------
Date: 23 Apr 1998 10:47:54 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Symbolic ref and angle opeator
Message-Id: <6hnkaq$gvm$1@monet.op.net>
Keywords: aristocrat deprivation devolve virtuosi
In article <6hm61b$9j6$2@client2.news.psi.net>,
Abigail <abigail@fnx.com> wrote:
>That makes me wonder what kind of comments APL has. If /* ... */
>counts as a "circumfix" programming construct, then # ...\n
>is one as well.
That's stretching it a little.
Even if you disagree, on the APL systems I have programmed, files have
record structure, so comments were *not* terminated with \n, or with
anything else. There was no `END-COMMENT-TOKEN'.
------------------------------
Date: 23 Apr 1998 16:48:37 +0200
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: There *IS* a visual IDE for Perl!
Message-Id: <is7m4gy4oq.fsf@godzilla.kiere.ericsson.se>
John Porter <jdporter@min.net> writes:
> Which is exactly why it ought to be extended to optionally output
> parse trees and/or other post-parse info.
You mean like "perl -Dx" does, or something else?
--
Calle Dybedahl, UNIX Sysadmin
qdtcall@esavionics.se http://www.lysator.liu.se/~calle/
------------------------------
Date: Thu, 23 Apr 1998 10:15:59 -0600
From: ssharma@clearnet.com
Subject: tie - ing to NDBM only writes values assigned after the tie?
Message-Id: <6hnlvf$81i$1@nnrp1.dejanews.com>
Hello,
I am working with some code that does this:
open file
while (<file>) {
$docall{$substr_from_file}++;
}
...
...
processing, keeping hash in memory for speed
...
...
tie(%docall, 'NDBM_File', 'docall', O_RDWR|O_CREAT, 0640);
untie(%docall);
My thinking is that i keep the hash in memory for speed, then save it
at the end for later use. I definitely don't want to tie() before doing
the heavy processing (~50 thousand key lookups now, several hundred thousand
within a few months, each time the program runs.)
But (tie ing) and (un tie ing ) in the way shown is not writing the hash
to the NDBM. do I need to explicitly re - write the hash into another,
tie()'d hash?
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
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 2403
**************************************