[8993] in Perl-Users-Digest
Perl-Users Digest, Issue: 2611 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 15 16:11:10 1998
Date: Fri, 15 May 98 13:01:01 -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 Fri, 15 May 1998 Volume: 8 Number: 2611
Today's topics:
can't find uninitialized value after while block, causi <suthsc@ncs.com>
Compile errors on 5.004 drohde@kcmo.org
Re: Compiling Perl <tchrist@mox.perl.com>
Re: Compiling Perl (Stuart McDow)
Re: Does Perl have a IDE?I don't like command line. (Leslie Mikesell)
Re: Does Perl have a IDE?I don't like command line. fsg@ultranet.com
Re: Does Perl have a IDE?I don't like command line. scott@softbase.com
Re: Does Perl have a IDE?I don't like command line. (Leslie Mikesell)
Re: Does Perl have a IDE?I don't like command line. <tchrist@mox.perl.com>
Re: Does Perl have a IDE?I don't like command line. (Greg Bacon)
Embedding C into Perl for Win32 ??? (P. Hortal)
Re: file size with perl and win NT <aqumsieh@matrox.com>
FileHandle: is it hurting me? <mgregory@asc.sps.mot.com>
Re: How to generate random passwords? <webmaster@fccjmail.fccj.org>
Re: How to generate random passwords? (Allan M. Due)
Re: IPC with not nice programs (solution) (Gary Trachier)
localtime function and Y2K compliance <jamon@moen.com>
Re: Memory problem. Cont'd <e78199@ceng.metu.edu.tr>
Objects <shane@techplus.com>
Re: Objects <tchrist@mox.perl.com>
Re: ODBC.pm: Is there a size limit to SQL statements? <zenin@bawdycaste.org>
perl install debate . . . <wes@mail.umb.com>
Re: Perl on NT -- need some assistance <Jan@McCann.cz>
Re: Perl/Wall lingo question <aqumsieh@matrox.com>
Re: Perl/Wall lingo question <tchrist@mox.perl.com>
Problem with spaces in directory path names in Perl on tipirneni@yahoo.com
Re: Problem with spaces in directory path names in Perl <Jan@McCann.cz>
Re: reading file into an array of hash (Kevin Reid)
Re: removing last line from file (Charles DeRykus)
Re: Substitution Problems :( <aqumsieh@matrox.com>
Re: system vs exec vs piped open... <aqumsieh@matrox.com>
Re: TIMTOWTDI - regex vs. if (function) <mgregory@asc.sps.mot.com>
Re: Tip: Filehandles <mgregory@asc.sps.mot.com>
Re: Tip: Filehandles <mgregory@asc.sps.mot.com>
Tip: Sets <gnat@frii.com>
Re: while, each & assoc array <lyonsd@atl.hp.com>
Re: why does "my($MyTime) = localtime;" act differently (Mike Stok)
yet another test (Christian Matthias Zmasek)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 15 May 1998 13:49:32 -0500
From: Scott Sutherland <suthsc@ncs.com>
Subject: can't find uninitialized value after while block, causing warning
Message-Id: <ud8dfv077.fsf@ncs.com>
I have the following code segment which is causing an uninitialized
value warning: (I use strict in the module)
sub exec_procedure {
my $self = shift;
my $procName = shift;
my @params = @_;
my $rc = undef;
my $restype = undef;
my $dbh = undef;
my $param = undef;
my $result = [];
... ### some things here...
### Now process the results...
while ($dbh->ct_results($restype) == CS_SUCCEED) {
if ($self->{'_debug'}) {
$self->reportResultType($restype);
}
next if (
$restype != CS_ROW_RESULT &&
$restype != CS_PARAM_RESULT &&
$restype != CS_STATUS_RESULT
);
my $row = undef;
while ($row = $dbh->ct_fetch(1,1)) {
if ($restype == CS_ROW_RESULT) {
push(@$result, {%$row});
}
if ($self->{'_debug'} & 16) {
main::message('Database', "\$row = $row");
}
if ($self->{'_debug'} & 8) {
main::dumpValue( $row );
}
}
}
if ($self->{'_debug'} & 8) { ### <<<--- causes uninitialized
### warning...
main::dumpValue($result);
}
return $result;
}
The warning happens BEFORE the first iteration of the loop, and the
program runs successfully to completion. I know that
$self->{'_debug'} has a valid value. It is set durring object
creation with the following code:
$self->{'_debug'} = $parms{'debug'} || 0;
Any information about why this is happening, and how to fix it would
be much appriciated.
Scott
--
Scott Sutherland National Computer Systems
(319) 354-9200 Measurement Services Division
<mailto:sut92199@ncs.com> Iowa City, Ia
#include "standard-disclaimer.h"
------------------------------
Date: Fri, 15 May 1998 18:01:57 GMT
From: drohde@kcmo.org
Subject: Compile errors on 5.004
Message-Id: <6jhvuk$m8g$1@nnrp1.dejanews.com>
This is my first post, so I hope it is appropriate for the group.
While compiling the perl source (5.004.4) on AIX 4.2.1, I get the following
errors, whether I accept the defaults in the "sh Configure" or I make changes.
I have to believe that there is something simple I am missing (it usually is)
as I am not very knowledgeable on C. (using IBM C compiler)
Thank you.
Drew
`sh cflags libperl.a globals.o` globals.c
CCCMD = cc -DPERL_CORE -c -qmaxmem=8192 -D_ALL_SOURCE
-D_ANSI_C_SOURCE -D_POSIX_SOURCE -O
`sh cflags libperl.a perlio.o` perlio.c
CCCMD = cc -DPERL_CORE -c -qmaxmem=8192 -D_ALL_SOURCE
-D_ANSI_C_SOURCE -D_POSIX_SOURCE -O
rm -f libperl.a
ar rcu libperl.a perl.o gv.o toke.o perly.o op.o regcomp.o dump.o
util.o mg.o hv.o av.o run.o pp_hot.o sv.o pp.o scope.o pp_ctl.o pp_sys.o
doop.o doio.o regexec.o taint.o deb.o universal.o globals.o perlio.o
cc -o miniperl miniperlmain.o libperl.a -lnsl -ldbm -ldl -lld -lm
-lc -lbsd -lPW
ld: 0711-317 ERROR: Undefined symbol: .safefree
ld: 0711-317 ERROR: Undefined symbol: .safemalloc
ld: 0711-317 ERROR: Undefined symbol: .saferealloc
ld: 0711-317 ERROR: Undefined symbol: .Perl_same_dirent
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
make: 1254-004 The error code from the last command is 8.
Stop
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 15 May 1998 17:48:11 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Compiling Perl
Message-Id: <6jhv4r$qls$6@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Andrew Boothman <andrew@boothman.easynet.co.uk> writes:
:Apart from the rather sexy perl2exe (for Win32) available
:on http://www.demobuilder.com
If that's a compiler, I'm your mother. It's a lie.
--tom
--
#else /* !STDSTDIO */ /* The big, slow, and stupid way */
--Larry Wall in str.c from the 4.0 perl source code
------------------------------
Date: 15 May 1998 18:11:55 GMT
From: smcdow@arlut.utexas.edu (Stuart McDow)
Subject: Re: Compiling Perl
Message-Id: <6ji0hb$9n7$1@ns1.arlut.utexas.edu>
Andrew Boothman <andrew@boothman.easynet.co.uk> writes:
>
> Apart from the rather sexy perl2exe (for Win32) available on
> http://www.demobuilder.com
But didn't he want a compiler? perl2exe is a bundler, not a compiler.
--
Stuart McDow Applied Research Laboratories
smcdow@arlut.utexas.edu The University of Texas at Austin
"Look for beauty in roughness, unpolishedness"
------------------------------
Date: 15 May 1998 12:55:32 -0500
From: les@MCS.COM (Leslie Mikesell)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6jhvik$e74$1@Mars.mcs.net>
In article <6jhqdm$mg6@hplntx.hpl.hp.com>, Larry Rosler <lr@hpl.hp.com> wrote:
>>
>>While you're naming points of pain,
>>consider how to telnet into your machine to do the same work
>>remotely as you had sitting at the console (ie. telnet style)
>>Or how to do remote GUIs (ie. export DISPLAY=foo.bar.com:0 style).
>
>I use two commercial products (Carbon Copy and pcAnywhere) which support
>remote GUI access, exactly as if one were sitting at the console. But
>they are not true multiple terminals -- they share the same display,
>mouse and keyboard drivers. So anyone actually sitting at the console
>sees the same display as you and can also control the mouse and
>keyboard. It's a weird experience, but it works (even over ordinary
>modems) and can be configured for appropriate security.
Not that any of this has anything to do with perl, but if you want
a nifty-neato free tool to give remote access either direction between
X and Win32, look at http://www.orl.co.uk/vnc/. There is even a
java applet that gives you remote screen access with nothing but
a java-enabled browser on the client side (and you probably thought
perl could do everything better than java...).
Les Mikesell
les@mcs.com
------------------------------
Date: 15 May 1998 14:03:35 -0400
From: fsg@ultranet.com
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6ji01n$s9$1@ultranet.com>
smcdow@arlut.utexas.edu (Stuart McDow) writes:
>Tom Christiansen <tchrist@mox.perl.com> writes:
>>
>> consider how to telnet into your machine to do the same work
>> remotely as you had sitting at the console (ie. telnet style) Or how
>> to do remote GUIs (ie. export DISPLAY=foo.bar.com:0 style).
>IMO, this has *got* to be one of the biggest drawbacks to The Virus
>From Redmond. But I suspect it wasn't by accident. Not being able to
>do remote displays means that one has to buy one computer and one NT
>license for every seat.
>Imagine if MS introduced (simultaneous) multi-user capability *and*
>the ability to do remote display. I know what I'd do. I'd buy one or
>two powerful server machines and a whole bunch of cheapo display
>terminals for users. And, of course, there's no money in that, is
>there?
(WARNING: COULD BE CONSTRUED AS AN ADVERTISEMENT)
Actually, if you want to do that, please call me at (508) 898 6490.
Data General makes a product called 'TermServer in a Box', which is
a rack mounted NT machine that does multi-user display, has clustered
reliability, and includes a really sweet RAID array. It supplies
multi-user capability to Windows Terminals (and some X terminals),
many of them, pretty much seamlessly. It's a really _great_ product.
> Why, PC makers all over the world would have a fit if such
>capacity were introduced for Wintel platforms. That's why we'll never
>see it.
Available today. I can sell UT a few if you like (or at least make sure
you get called on by a sales contact). DG even comes by and installs
it for you, including the complete networking end of it, if you like.
I'm not defending win32 (or even seriously trying to sell you a TSIAB,
even though as I said, unreservedly, though I hate win32, TSIAB is a
world class solution), but it's important to note that solutions exist.
Felix
------------------------------
Date: 15 May 1998 16:48:01 GMT
From: scott@softbase.com
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6jhrk1$lv5$3@mainsrv.main.nc.us>
I have to disagree:
Eric Bohlman wrote:
> One could argue that IDEs were created to fulfill a need that no longer
> exists.
But to no good end!
> They originated as DOS applications, where they served an
> important function, namely getting around some of the limitations imposed
> by having a single-task OS. ...
I disagree with this. The IDE is not something limited to DOS. IDEs
have existed in many other platforms. UNIX versions have IDEs (I saw
one once. It was pretty pathetic.), and even Emacs is an IDE. The IDE
as we know it today (Developer Studio is a good example) did not even
come into its own until the graphical user interface was the most
common thing people had to program. Without the GUI, the IDE is limited
and not much better of an option than the command line. When you add
GUI design tools to the IDE, then you're onto something.
> But now, even Win95 lets you have multiple console windows open at the
> same time.
I don't think people *want* this, as sales of IDEs seem to indicate.
Let's face it, anyone could do this with the JDK, but the various
IDEs are flying off the shelves. HTML development systems are
extremely popular despite the fact you can write HTML in an editor.
I believe people want it all in one place. They don't want half a
bazillion windows open running different tools. They want a simple,
powerful, integrated package. Most IDEs offer tremendous benefits over
plain text editors such as: help with boring, routine tasks; online
documentation that you can access without leaving the IDE; automatic
file and project management; and more. The text editors which can
compete with these features usually are ones that have grown into
mini-IDEs. (That is, IDEs without the actual compilers.)
> From this point of view, people look for IDEs not because IDEs are
> particularly useful, but because IDEs are what they're used to.
Yeah, and people want to live in the past with command line tools
because that's what they're used to while they scoff at IDEs. :)
And in a few years, the same will be true of IDE users who won't
switch to the new telepathic code generators, etc.
Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more.
------------------------------
Date: 15 May 1998 13:10:40 -0500
From: les@MCS.COM (Leslie Mikesell)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6ji0f0$edo$1@Mars.mcs.net>
In article <6jgduh$okj$1@csnews.cs.colorado.edu>,
Tom Christiansen <tchrist@mox.perl.com> wrote:
>It is ultimately depressing to receive daily reminders of how useless
>and ignored my work and that of others at documenting Perl, in manpages,
>FAQS, webpages, and even books. It is a rude slap in our faces, and
>I don't understand why we're supposed to make kissy face when it
>happens again and again on the very same day. I don't know how
>any man can. You don't see Larry here. You don't see Dennis in the
>C groups. And you don't wonder why, now do you?
Maybe my memory is just getting fuzzy but I seem to recall a time
when Larry did answer questions on the net and I don't remember
him ever complaining about the questions being dumb. And since
there were no other perl experts at the time, the questions were
mostly pretty dumb. Also, I don't ever remember him insulting
people who asked questions that really were operating system or
environment issues. After all, if a perl program ran without using
OS functions, how would anybody know if it worked or not?
Am I just being nostalgic here or are there some news archives that
go back that far?
Les Mikesell
les@mcs.com
------------------------------
Date: 15 May 1998 18:15:06 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6ji0na$249$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
fsg@ultranet.com writes:
:I'm not defending win32 (or even seriously trying to sell you a TSIAB,
:even though as I said, unreservedly, though I hate win32, TSIAB is a
:world class solution), but it's important to note that solutions exist.
But fleeceware only, if that, just like everything else in that world.
--tom
--
"It is easier to port UNIX to a new machine, than an application to a new
operating system." -- Dennis Ritchie
------------------------------
Date: 15 May 1998 19:56:46 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6ji6lu$kru$2@info.uah.edu>
In article <6jhk40$e1t$2@csnews.cs.colorado.edu>,
Tom Christiansen <tchrist@mox.perl.com> writes:
: And shoot the pig?
All this hatred toward pigs is really starting to make me nervous. :-)
Bacon
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: 15 May 1998 18:57:08 GMT
From: mcai3ph2@ist4.co.umist.ac.uk (P. Hortal)
Subject: Embedding C into Perl for Win32 ???
Message-Id: <6ji364$h7u$2@yama.mcc.ac.uk>
Hi,
Does anybody know how to embed C into Perl for Win32?
Thanks,
P. Hortal
------------------------------
Date: Fri, 15 May 1998 14:03:49 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: file size with perl and win NT
Message-Id: <355C8385.FBF29C4E@matrox.com>
piet wrote:
> hello.
>
> i am trying to get the size of several files in perl under windows NT.
> i tried
> $size = -s $filename;
> and
> @info = stat ($filename);
> $size = $info[7];
>
> my problem is, that both ways seem to work for some files but not for
> others...
> can anybody help me?
Hmmmm... before we could help you we need more information. Which files
did it work for? and which did it fail for? Are there any symbolic links?
> thanks in advance,
> Gerhard Weber
>
> p.s. another problem is that for one file the size differs from the
> actual size.
That's strange ... show us what you got so that we can try to figure out
what the problem is.
--
Ala Qumsieh | No .. not just another
ASIC Design Engineer | Perl Hacker!!!!!
Matrox Graphics Inc. |
Montreal, Quebec | (Not yet!)
------------------------------
Date: 15 May 1998 17:21:04 +0930
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: FileHandle: is it hurting me?
Message-Id: <r83eeckm53.fsf@asc.sps.mot.com>
In a recent thread, there was some discussion about the relative
merits of FileHandle (and IO::File) vs typeglobs or other means of
specifying file handles.
During that discussion, some claims and implications were made about
the speed of operations using FileHandle methods: that they are slow.
Can someone clarify these claims: I need to know if using certain
parts, or all of, FileHandle is hurting me (speedwise). I'd really
like to understand why this is true, too!
IE
Is
print $FileHandle "stuff\n"; # which I do
slower than
print FH "stuff\n"; # which I don't do much of
or faster than
$FileHandle->print("stuff\n"); # which I don't do either.
etc
I know that for any given method/comparison I could just profile it,
but I am looking for some more general guidance - I want to understand
what usages will do for/to me, so that I can avoid having to profile
every slow program that I write only to find some new FileHandle issue!
Any help appreciated. Email copies of help especially so.
Martin.
------------------------------
Date: Fri, 15 May 1998 18:48:47 GMT
From: Bill 'Sneex' Jones <webmaster@fccjmail.fccj.org>
Subject: Re: How to generate random passwords?
Message-Id: <355C8C3B.DA1D0A23@fccjmail.fccj.org>
Jennifer Telisky wrote:
>
> I have this script that will create user accounts, however I need to
> assign a password at the same time. Any help on generating a random
> password and updating the passwd file will be appreciated.
>
Brian's and Allan's solutions notwithstanding, where are you recording
these 'random' passwords? Or are the intended users supposed to
use 'crack' to get in?
2 Cents, :-)
-Sneex-
____________________________________________________________________________
Bill Jones | FCCJ Webmaster | Voice 1-904-632-3089 | Fax 1-904-632-3007
Florida Community College at Jacksonville | 501 W. State St. | Jax, FL 32202
mailto:webmaster@fccjmail.fccj.org | http://webmaster.fccj.org/Webmaster
------------------------------
Date: 15 May 1998 19:03:15 GMT
From: due@murray.fordham.edu (Allan M. Due)
Subject: Re: How to generate random passwords?
Message-Id: <6ji3hj$98n$0@206.165.146.155>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
In article <comdog-ya02408000R1505981344240001@news.panix.com>, brian d
foy (comdog@computerdog.com) posted...
[snip, although I hate to]
That is just so much nicer than my way. The while here seems much
more esthetically pleasing than the for. One of the things I love about
Perl is that code can be written in a utilitarian way but also in an
elegant way. Perl just seems to lend itself to elegant expression. One
of the things I enjoy about this newsgroup is reading the elegant code and
hopefully learning to speak in a more refined manner. Thanks for the
examples folks! Keep them coming.
AmD
--
Allan M. Due
Due@Murray.Fordham.edu
The beginning of wisdom is the definitions of terms.
- Socrates
------------------------------
Date: Fri, 15 May 1998 15:37:15 -0400
From: trachier@crrel.usace.army.mil (Gary Trachier)
Subject: Re: IPC with not nice programs (solution)
Message-Id: <trachier-1505981537150001@trachier.crrel.usace.army.mil>
Gordon,
Thanks for doing the work. I have not tried your code yet, but it looks
useful. I have been trying to work out serial port communication and at
one point tried open3() to talk to Kermit. Commands were getting to the
modem, but I could read nothing back. BTW I was able (with the help of
someone else on comp.unix.questions) able to write some low-level
functions for serial port I/O.
If others agree that you've solved the problem, then I hope that someone
will add a writeup and sample code to the CPAN FAQ for IPC::Open3()
Cheers.
-Gary
/---------------------------------------------------------------------------\
| Gary Trachier / U. S. Army Cold Regions Research & Engineering Laboratory |
| Internet: trachier@crrel.usace.army.mil |
| CorpsMail: Gary.M.Trachier@mail.usace.army.mil |
| Telephone: voice (603) 646-4303 fax (603) 646-4720 |
| USnail: (.^.) USA CRREL / 72 Lyme Road / Hanover, NH USA / 03755-1290 |
\--------A--U--A------------------------------------------------------------/
------------------------------
Date: Fri, 15 May 1998 15:42:42 -0400
From: Jennifer Amon <jamon@moen.com>
Subject: localtime function and Y2K compliance
Message-Id: <355C9AB2.183A869@moen.com>
My trusty Camel book (2nd Edition) says, and I quote:
localtime
localtime EXPR
This function converts the value returned by time to a
nine-element list with the time corrected for the local
time zone. It's typically used as follows:
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime(time);
All list elements are numeric, and come straight out of
a struct tm. (That's a bit of C programming lingo - don't
worry about it.) In particular this means that $mon has
the range 0..11, $wday has the range 0..6, and the year
has had 1,900 subtracted from it.
If that is the case, then 2000 would come back as 100, and
2001 would come back as 101, etc.
Is this really the case, and is there any plan for that
to change?
Thanks,
Jennifer Amon
--
_______________________________________________________________________
Jennifer R. Amon Phone: 440-962-2471
Sr. Programmer/Analyst FAX: 440-962-2739
Moen Incorporated Personal: jamon@apk.net
25300 Al Moen Drive Business: jamon@moen.com
North Olmsted, OH 44070 Web: http://junior.apk.net/~jamon/
_______________________________________________________________________
------------------------------
Date: Fri, 15 May 1998 22:35:39 +0300
From: Walid ALSAQAF <e78199@ceng.metu.edu.tr>
Subject: Re: Memory problem. Cont'd
Message-Id: <355C990B.86C0531@ceng.metu.edu.tr>
I forgot to mention the version of perl I am using. It is rather old
5.001, it is interesting to note that the version 4.036 consumed about
10% of the memory consumed by perl5.001 when running the same script!!!
> --
> /*********************************************/
> Walid ALSAQAF
>
> METU
> Computer Engineering Department
> mailto:e78199@ceng.metu.edu.tr
> http://www.ceng.metu.edu.tr/~e78199/Walid
> ICQ # : (9762042)
> /*********************************************/
------------------------------
Date: Fri, 15 May 1998 14:12:46 -0500
From: "Shane" <shane@techplus.com>
Subject: Objects
Message-Id: <6ji3vd$c5m$1@news13.ispnews.com>
Is there a way to make an array of pointers in perl which all point to
another array of data. If so how? I can do this in java but not perl.
Thanks
Shane
shane@techplus.com
------------------------------
Date: 15 May 1998 19:34:04 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Objects
Message-Id: <6ji5bc$79r$2@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
"Shane" <shane@techplus.com> writes:
:Is there a way to make an array of pointers in perl which all point to
:another array of data. If so how? I can do this in java but not perl.
What part of the standard perlref, perllol, and perldsc manpages
included with every Perl distribution were unclear on this matter?
Please tell me so that I can fix them.
--tom
--
Imagination is more important than knowledge
-- Albert Einstein
------------------------------
Date: 15 May 1998 19:22:00 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: ODBC.pm: Is there a size limit to SQL statements?
Message-Id: <895260584.634351@thrush.omix.com>
Andy Lester <petdance@maxx.mc.net> wrote:
: I'm saving arbitrarily large web pages.
There is no bind() method/function in ODBC? 60k really should
be done with a place holder and a bind.
--
-Zenin
zenin@archive.rhps.org
------------------------------
Date: Fri, 15 May 1998 19:24:12 +0000
From: wes hedrick <wes@mail.umb.com>
Subject: perl install debate . . .
Message-Id: <355C965C.8BD118C6@mail.umb.com>
My sysadmin guy is convinced that our complete and utter failure to install mod_perl correctly has
nothing to do with the perl install being in the form of a solaris package. If configured properly
is he right? Notwithstanding a seemingly flawless install(first try) after compiling perl from
source, on the same box.
just wondering.
--
wes hedrick
UMB bank - internet services
wes@mail.umb.com
------------------------------
Date: Fri, 15 May 1998 20:13:08 -0700
From: Jan Krynicky <Jan@McCann.cz>
To: marcs@vbe.com
Subject: Re: Perl on NT -- need some assistance
Message-Id: <355D0444.11AC@McCann.cz>
Marc A. Sonnenberg wrote:
>
> I'm running Perl 3.16 on NT 4.0. It worked fine until I upgraded to
> IIS 4.0 and now the scripts come back with the following message:
>
> CGI Error
>
> The specified CGI application misbehaved by not returning a complete
> set of HTTP headers. The headers it did return are:
>
> Can't open perl script
> "???????????????????ll?????????f????????????????????1????????????????????????a???????????":
> Invalid argument
>
> What's with all the question marks? I can't tell if it's not finding
> the script, find the script and not running properly, or not starting
> perl.
>
> Any help would be appreciated.
This is a well know bug of M$'s instalation script.
When converting the script map settings from IIS3.0,
the instalation changes %s to %S and makes
the mapping invalid.
Open the Internet Service Manager (MMC), rightclick the Default Web
Site,
select Properties, Home Directory tab, Configuration
and review the mapping for perl.
It should be either (assuming perl in c:\perl)
c:\perl\bin\PerlIS.dll
or
c:\perl\bin\perl.exe "%s" "%s"
Notice the case of %s !!!
Also make sure you have only one entry for each extension there.
HTH, Jenda
------------------------------
Date: Fri, 15 May 1998 13:15:47 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Perl/Wall lingo question
Message-Id: <355C7843.4796587E@matrox.com>
> Greg Bacon (gbacon@cs.uah.edu) wrote:
> : Ugh. CS is as much of an art as it is a science. I don't think you'll
> : find many engineers who'd admit that art is part of what they do.
WHAT???As an engineer, I am offended by this statement. Do you know anything
about VLSI, for example (since that happens to be my field) ? Laying out a
chip is more of an art than anything else. It's just like painting a circuit
on silicon (as opposed to painting a picture on canvas)! If it doesn't "feel"
right, then most probably it won't function correctly.
That's just one example. Other examples include aerodynamic design of
automobiles and planes .. etc.
> : Engineers make poor computer science teachers (at least in my
> : experience).
Hmmmmm... I also disagree! Your experience might be that engineers are worse
in teaching than CStists .. but you can't generalize. There are good
EE teachers and bad ones as well as good CS teachers and bad ones (this time,
it's my experience that's talking ;-)
> :
> : Greg
Cheers
--
Ala Qumsieh | No .. not just another
ASIC Design Engineer | Perl Hacker!!!!!
Matrox Graphics Inc. |
Montreal, Quebec | (Not yet!)
------------------------------
Date: 15 May 1998 19:19:35 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl/Wall lingo question
Message-Id: <6ji4g7$79r$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Ala Qumsieh <aqumsieh@matrox.com> writes:
:WHAT???As an engineer, I am offended by this statement.
See _The Art of Mathematics_, by Jerry King. It's a very
small, very interesting paperback. Apply s/math/CS/g to the
book.
--tom
--
MSDOS was created to keep idiots away from Unix
------------------------------
Date: Fri, 15 May 1998 18:22:48 GMT
From: tipirneni@yahoo.com
Subject: Problem with spaces in directory path names in Perl on WIN32
Message-Id: <6ji15m$obb$1@nnrp1.dejanews.com>
Folks,
Whenever I try to execute a script from the perl that has sapce in its
path, it is failing. Like the following script,
`C:\Program files\DevStudio\programs\preprocess\release\preprocess.exe
data.txt`;
gives "The system cannot find the path specified." message and exits.
is there are a way to solve this problem.
tipirneni
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Fri, 15 May 1998 20:45:56 -0700
From: Jan Krynicky <Jan@McCann.cz>
To: tipirneni@yahoo.com
Subject: Re: Problem with spaces in directory path names in Perl on WIN32
Message-Id: <355D0BF4.2595@McCann.cz>
tipirneni@yahoo.com wrote:
>
> Folks,
>
> Whenever I try to execute a script from the perl that has sapce in its
> path, it is failing. Like the following script,
>
> `C:\Program files\DevStudio\programs\preprocess\release\preprocess.exe
> data.txt`;
>
> gives "The system cannot find the path specified." message and exits.
> is there are a way to solve this problem.
>
> tipirneni
If you'd try that from the command line you'd found out it doesn't work
even from there.
c:\> C:\Program
files\DevStudio\programs\preprocess\release\preprocess.exe data.txt
You HAVE to enclose the whole .exe name into doublequotes:
c:\> "C:\Program
files\DevStudio\programs\preprocess\release\preprocess.exe" data.txt
or
`"C:\Program files\DevStudio\programs\preprocess\release\preprocess.exe"
data.txt`
HTH, Jenda
BTW, unless strictly necessary never install anything into a directory
with
a space in it's name. It's pretty annoying to have to enclose everything
into quotes.
------------------------------
Date: Fri, 15 May 1998 14:05:28 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: reading file into an array of hash
Message-Id: <1d92p4a.1kp9dg4kpzdksN@slip166-72-108-62.ny.us.ibm.net>
brian d foy <comdog@computerdog.com> wrote:
> In article <355C550A.22C7BA47@matrox.com>, Ala Qumsieh
> <aqumsieh@matrox.com> posted:
>
> >> while (<FILE) {
> >
> >Ooops .. that should've been:
> >
> >while (<FILE>) { # of course you knew that! ;-)
>
> well, it gets worse. did you try that with warnings on a current
> perl? the stuff you read from FILE might spuriously end the while
> loop if it evaluates to false.
>
> while( defined( $_ = <FILE> ) ) { ... }
Nope.
while (<FILE>) {
is equivalent to
while (defined($_ = <FILE>)) {
.
It's
while ($var = <FILE>) {
that's the problem.
--
Kevin Reid. | Macintosh.
"I'm me." | Think different.
------------------------------
Date: Fri, 15 May 1998 19:28:11 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: removing last line from file
Message-Id: <Et0JEz.775@news.boeing.com>
In article <Pine.SOL.3.96.980512110115.26128B-100000@corona.pmel.noaa.gov>,
Nathan Franzen <franzen@pmel.noaa.gov> wrote:
>
>On Tue, 12 May 1998, Tom Phoenix wrote:
>> On 12 May 1998, Baton wrote:
>> > how would i go about removing the last line of a text file?
>>
>> You may be able to do this with truncate, possibly in conjunction with
>> tell.
>
>I first thought of something along the lines of:
>
>perl -nibak -e 'unless(eof){print} else{undef $^I;print "last: $_"}' fname
>
>However, the "undef $^I" didn't do what I expected, and I had to resort to
>
>perl -nibak -e 'unless(eof){print} else{undef $^I;print STDOUT "last: $_"}'
>
>to get what I wanted. The mysteries of $^I are still shrouded to me.
>So I wonder: once I have invoked $^I, how do I get rid of it?
>
>Now, my one-line response to baton's question probably isn't what is
>desired, since baton probably wants to have user input as to whether the
>last line should be deleted or not. I think more that one line will be
>required.
$^I will remain in place until ARGVOUT is closed.
So you could do something like this:
perl -nibak -e 'if (!eof()) {print} else {close ARGVOUT;print}' file
Thus, you were very close :)
or, perhaps more simply:
perl -nibak -e 'if (eof()) {print STDERR $_} else {print}' file
HTH,
--
Charles DeRykus
------------------------------
Date: Fri, 15 May 1998 13:49:07 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Substitution Problems :(
Message-Id: <355C8013.D0FE5B2C@matrox.com>
Aidan Rogers wrote:
> I'm having a slight problem with a substitution. Basically, I am writing a little
> subroutine that will put a backslash before any special characters in a variable.
> However, when I came to do the substitution for the ' character, it wouldn't work.
>
> here is the syntax of the command I was using...
>
> s/\'/\\\'/g;
>
> all this seems to do is put 2 backslashes in front of the '. Does anyone know a
> way to substitute in just _one_ backslash?
>
> Thanks in advance,
>
> Aidan
> (slowly learning quickly :)
This is working fine for me! What version of Perl are you using?
--
Ala Qumsieh | No .. not just another
ASIC Design Engineer | Perl Hacker!!!!!
Matrox Graphics Inc. |
Montreal, Quebec | (Not yet!)
------------------------------
Date: Fri, 15 May 1998 14:00:52 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: system vs exec vs piped open...
Message-Id: <355C82D4.1B4B1740@matrox.com>
Matteo Boschini wrote:<snip>
> Without running teh C code, I get the output html page in xx secs.
> If I run the C program, I get the output html file in xxxxxxxx sec,
> exactly when C programs is done executing.
>
> I did this by means of a system("./myproc &");
>
> Shouldn't this return to my perl as soon as the myprog & command is
> done, that is, immediately ?
>From perlfunc:
system LIST
Does exactly the same thing as "exec LIST" except
that a fork is done first, and the parent process
waits for the child process to complete. Note that
argument processing varies depending on the number
of arguments. The return value is the exit status
of the program as returned by the wait() call.
> I also tried an exec, with the same result.
I hope you forked before you exec()ed .. unless you exec at the very end
of you script!
>
>
> But when I tried an
>
> open(FH,"myprog &|");
> close(FH);
>
> I get the retun page in xx secs and the c programs gets nevertheless
> executed
That's because your script didn't wait for myprog to finish.
> So, why didn't system("./myproc &"); return immediately to my perl ?
> Why does the piped open do ?
>
> Thanx in advance,
>
> Matteo Boschini
> (boschini@cilea.it)
Try to look harder in the FAQs.
--
Ala Qumsieh | No .. not just another
ASIC Design Engineer | Perl Hacker!!!!!
Matrox Graphics Inc. |
Montreal, Quebec | (Not yet!)
------------------------------
Date: 15 May 1998 17:26:18 +0930
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: Re: TIMTOWTDI - regex vs. if (function)
Message-Id: <r81ztwklwd.fsf@asc.sps.mot.com>
Ward Kaatz <ward.kaatz@pss.boeing.com> writes:
> Larry Rosler wrote:
>
> I considered but avoided use of (s)printf based on the camel book
> observation (pg 200, 2nd ed.).
That note is not (I believe) intended to be anywhere near this strong!
All it is saying is don't do
printf ("%s", $String);
when you can do
print $String;
and other variants of the same silliness. If you need to format a
string, by all means use printf, as far as I can see?
Martin.
------------------------------
Date: 15 May 1998 15:51:18 +0930
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: Re: Tip: Filehandles
Message-Id: <r87m3okqap.fsf@asc.sps.mot.com>
Jamie Hoglund <jhoglund@mirage.skypoint.net> writes:
> Tom Christiansen <tchrist@mox.perl.com> wrote:
>
> : and then go and suck in a megamodule just because you're afraid of a star.
>
> Wow, I think those are the stronges words I've ever heard from you. :-)
>
> Seriously, what is wrong with using globs? I've been told not to use them,
> but personally, I find them more intuitive than the $Variable->{name}
> stuff, purely a personal preference as far as I'm concerned, but is there
> a real performance oriented reason for avoiding globs?
>
> To me, doing something like *subname = \&module::subname; makes a lot
> more sense, but I almost never see people do that, I know there is
> probably a good reason for this, but are there consequences? (other than I
> can't use $subname as a scalar w/out messing things up, I wouldn't want
> to anyway.) Or is it just "perlitically incorrect"? :-)
It's not politically incorrect. Its incredibly poorly documented
(sorry, documenters, most of your stuff is good).
For me, $Variable->{name} has semantics that are well documented, and
understandable in terms that a large number of programmers can be
expected to be familiar with.
The glob documentation leaps in at the deep end, assuming that you
know what a symbol table is and all that it implies, and makes many
other assumptions that might be true of language creators but not of
lots of programmers. It makes me feel like I'm about to start mucking
with the internals of the language I'm about to use. I don't want
that feeling unless I'm sure I know what I'm doing.
Further more, it displays that some of the things that happen when you
use typeglobs are "tricky, eh" and "sneaky". Indeed they are: highly
non-intuitive.
The result is that most people (myself included) have no idea what it
means and don't want to touch it with a bargepole.
Martin.
------------------------------
Date: 15 May 1998 15:54:28 +0930
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: Re: Tip: Filehandles
Message-Id: <r867j8kq5f.fsf@asc.sps.mot.com>
Nathan Torkington <gnat@frii.com> writes:
> Mea culpa. The drawback is that because filehandles aren't a basic
> data type, you have to futz with typeglobs to store or pass them.
> If you use FileHandle or IO::File from the very start, you have
> filehandles from the start and don't have to use a different syntax
> for passing filehandles than you do for passing any other type.
> IO::* and FileHandle remove the need for thought, but do so at a
> cost of load time.
>
> I put typeglob filehandles into a tip because I used to fear the
> different. The fact that Perl lets you specify filehandles in so
> many different ways (strings, typeglobs, refs to typeglobs) only
> served to cloud my mind. When I found a way that always works
> and isn't complex, I figured I'd share it.
Ditto. This is why I use them (FileHandle). What's more, I was not
even aware that there were the severe performance implications that
I now see implied. I guess it'd be kinda nice if this were pointed
out somewhere!! Maybe then some of us would get off our butts, clear
our minds, and try to grasp all the gruesome quick ways of doing file
handles...
Martin.
------------------------------
Date: 15 May 1998 12:23:32 -0600
From: Nathan Torkington <gnat@frii.com>
Subject: Tip: Sets
Message-Id: <5qwwbnbdgb.fsf_-_@prometheus.frii.com>
I have to confess that despite having a Bachelor's degree in Computer
Science, I never really understood WHY we should give two hoots about
sets, bags, collections and all those other weird buzzwords that
arouse algorithms and data structures people so much. Then I was
asked to tech-read an upcoming book on working with CS-style
algorithms and data structures in Perl, and I had an epiphany.
I had been a victim of the Sapir-Whorf hypothesis--the idea that
language shapes and limits our thought. I'd been successfully writing
programs in Perl for many years, and had grown accustomed to thinking
in terms of arrays and hashes. When you think like this, some
problems ("how do I find the unique elements in an array?") have
solutions that are inelegant mixes of arrays and hashes.
The reason for this became clear to me in my epiphany: when we talk
about "unique" or "things in one group but not in another" we're
talking about sets. Sets have different properties from arrays and
hashes, so you necessarily end up with inelegant solutions when you
solve set problems with arrays and hashes. That's the nature of
the beast. It's like an analogy, or translating an idiom from one
language to another. It works, it gets the point across, but it's
not perfect as the original was.
Consider the problem of finding unique elements. Talking about
"unique" is a give-away that we are talking about sets. A property of
sets is that there are no duplicate elements. A thing is either in or
out of the set, and can't be in or out twice (or both at once). End
of story. So when we have read a list of 157,000 logins for the month
of April and want to find out how many unique users there are, we're
asking to find the "set of users who logged in".
Perl doesn't have sets built-in, so you have to use the property that
hash keys must be unique:
while (<>) {
/^(\w+)/; # extract the username
$seen{$1} = 1; # mark as seen;
}
@unique = keys %seen;
Similarly, when you talk about finding elements "in common" or "in one
array but not in another", you're talking about set operations like
intersection and complement. Finding common elements in two arrays
has a hash solution in Perl:
# @array1 and @array2 have some elements in common. What are they?
# (assume no duplicates within @array1 or within @array2)
@seen{@array1} = (); # mark all in @array1
@common = grep { exists $seen{$_} } @array2;
As you've seen, hashes are often used to solve set problems in Perl.
But they're not the only way. The basic property of sets, "an element
is either in or out" is binary and this means you can represent sets
with bit vectors. You have to assign a bit to each potential member
of the set, and then your operations turn into binary logic: AND, OR
and NOT combine to tell you which elements sets have in common,
different, and so on. The Bit::Vector module from CPAN lets you do
this conveniently and efficiently for large bit vectors.
The key is to be able to conveniently assign bits to potential members
of the set. Sometimes that's easy (when, for instance, the potential
members of the set are already mall integers) but sometimes it's
harder (when they're arbitrary strings). If you're going to be doing
a lot of set operations on the data, you may benefit by building a
hash mapping string to bit number and an array mapping bit number back
to string, and then using Bit::Vector. It's probably not worth it for
only one or two set operations, though.
The moral of the story is that you should think in terms of the real
data structure you're working with ("set") before you start to write
code. The underlying conceptual data structure will give you guidance
on what modules or approaches to take when you come to implement it
in the data structures your language provides (hashes, arrays, bit
vectors).
Nat
------------------------------
Date: Fri, 15 May 1998 15:31:41 -0400
From: "David A. Lyons" <lyonsd@atl.hp.com>
Subject: Re: while, each & assoc array
Message-Id: <355C981D.80927A72@atl.hp.com>
Tom Christiansen wrote:
>
> [courtesy cc of this posting sent to cited author via email]
>
> In comp.lang.perl.misc, lyonsd@atl.hp.com writes:
> :I'm stumped.
>
> That's because you didn't use -w, and have really lame indentation.
Why's that?
*This* is sloppy and difficult to read:
function {
block of code;
}
This is neat and easy to read and keep track of braces:
function
{
block of code;
}
It makes a big difference when you start getting into a lot of nested
blocks.
Dave
------------------------------
Date: 15 May 1998 18:17:40 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: why does "my($MyTime) = localtime;" act differently that "my $MyTime = localtime;" ?
Message-Id: <6ji0s4$mmu@news-central.tiac.net>
In article <6jht4j$ud0$1@nntpd.lkg.dec.com>,
Jack Alexander <alexander@zko.dec.com> wrote:
>Why do these two routines produce different results? Why does my() change
>the behavior of the variable $MyTime?
>
>sub T1()
>{
> my($MyTime) = localtime;
> print "T1 says MyTime is $MyTime\n";
>}
>
>T1 says MyTime is 54
>
>sub T2()
>{
> my $MyTime = localtime;
> print "T2 says MyTime is $MyTime\n";
>}
>
>T2 says MyTime is Fri May 15 12:33:28 1998
The () around the my variable change the context seen by the right hand
side of the assignment. localtime returns different things depending on
the context it's called in - in scalar context it returns a ctime-like
string and in array context it returns a 9 element list.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: 15 May 1998 19:53:12 GMT
From: cmzmasek@artsci.wustl.edu (Christian Matthias Zmasek)
Subject: yet another test
Message-Id: <6ji6f8$p45$4@newsreader.wustl.edu>
test
test
------------------------------
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 2611
**************************************