[7963] in Perl-Users-Digest
Perl-Users Digest, Issue: 1588 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 6 12:08:10 1998
Date: Tue, 6 Jan 98 09:00:27 -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 Tue, 6 Jan 1998 Volume: 8 Number: 1588
Today's topics:
Re: "shift @array" question (Gabor)
Re: Advanced Perl Programming book <twolf@sampo.creighton.edu>
Can I create a Linked List in Perl draggs@hawkeye.idx.com
Re: Can I create a Linked List in Perl (Eric Harley)
Re: Can I create a Linked List in Perl (Mike Stok)
Re: Can I create a Linked List in Perl <tchrist@mox.perl.com>
Re: Getting values from ResultSet is slow (vs. Perl/DBI <Jacqui.Caren@ig.co.uk>
Re: Interprocess Communication <twolf@sampo.creighton.edu>
Re: Interprocess Communication <domi@marlis.grenoble.hp.com>
Re: Lexical scope and embedded subroutines. <tchrist@mox.perl.com>
Re: Looping through hashes <ckc@dmi.dk>
Re: Looping through hashes (Jim Allenspach)
Re: Looping through hashes (I R A Aggie)
Re: Looping through hashes (Gabor)
Re: MIME Decoder (Jeremy D. Zawodny)
newbie question <gand@vtsoft.hu>
Re: newbie question: install perl on solaris 2.5.1 <selz@wise.wiwi.tu-dresden.de>
Re: ORAPerl <Jacqui.Caren@ig.co.uk>
Pattern match causing runtime exception <jacklam@math.uio.no>
Perl pgm to provide web page date? <svetter@ameritech.net>
Re: Perl pgm to provide web page date? (Jeremy D. Zawodny)
Re: Perl sort( ) Argument Passing Problem (Chris Nandor)
Re: problem parsing conditional operator. <jack_h_ostroff@groton.pfizer.com>
Re: problem parsing conditional operator. <merlyn@stonehenge.com>
Re: readdir() and file named '0' (Clay Irving)
Re: Review of CGI/Perl book (Mike Stok)
This may sound like a stupid question <myleslawrence@email.msn.com>
Re: Two-byte characters substitution ? (M.J.T. Guy)
Re: Using shell aliases from within Perl scripts, quest <barnett@houston.Geco-Prakla.slb.com>
what is the meaning of "constant"? <mariana.wuerz@fernuni-hagen.de>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 6 Jan 1998 15:06:09 GMT
From: gabor@vinyl.quickweb.com (Gabor)
Subject: Re: "shift @array" question
Message-Id: <slrn6b4hmf.6i5.gabor@vinyl.quickweb.com>
In comp.lang.perl.misc, Jerry Lineberry <jerryl@connecti.com> wrote :
# Hello,
# Ok, I have a script that works fine. However, I feel that it could
# have been done better. For instance, at one point I have to use the shift
# command three times in a row. Can this be done with one command?
use splice.
splice @array,0,3;
gabor.
--
/* And you'll never guess what the dog had */
/* in its mouth... */
-- Larry Wall in stab.c from the perl source code
------------------------------
Date: Tue, 6 Jan 1998 09:01:55 -0500
From: "Thomas Charron" <twolf@sampo.creighton.edu>
Subject: Re: Advanced Perl Programming book
Message-Id: <68tdgk$nmk3@biko.telecom.ups.com>
Definatly am enjoying it..
Allen Choy wrote in message <349848E6.E0D54461@us.oracle.com>...
>Hi.
>
>Does anyone have any opinions, good and bad, re: the Advanced Perl
>Programming book?
>I'm considering purchasing it, but don't know much about it.
>
>Thanks!
>
>Allen
>
------------------------------
Date: Tue, 06 Jan 1998 15:09:20 GMT
From: draggs@hawkeye.idx.com
Subject: Can I create a Linked List in Perl
Message-Id: <34b2488f.6292731@news.idx.com>
I'm reasonably new to Perl, but am an old C programmer. I was
wondering if it was possible to create a c-style linked list and perl.
If it is, how would I go about doing so?
------------------------------
Date: Tue, 06 Jan 1998 07:31:55 -0800
From: eharley@pacbell.net (Eric Harley)
Subject: Re: Can I create a Linked List in Perl
Message-Id: <eharley-0601980731560001@ppp-207-214-149-12.snrf01.pacbell.net>
> I'm reasonably new to Perl, but am an old C programmer. I was
> wondering if it was possible to create a c-style linked list and perl.
> If it is, how would I go about doing so?
I dont think you would want to. Arrays (and all other types) are much more
flexible in Perl and there really is no need for linked lists.
Just Another Perl Hacker
------------------------------
Date: 6 Jan 1998 10:56:27 -0500
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Can I create a Linked List in Perl
Message-Id: <68tk7b$2bu$1@stok.co.uk>
In article <34b2488f.6292731@news.idx.com>, <draggs@hawkeye.idx.com> wrote:
>I'm reasonably new to Perl, but am an old C programmer. I was
>wondering if it was possible to create a c-style linked list and perl.
>If it is, how would I go about doing so?
It's possible, but many of the things people use linked lists for can be
done with perl arrays, especially now that perl 5 has introduced
references which allow an array entry to contain a reference to some other
(possibly complex) data structure.
the splice function can be used to insert or remove elements from any
position in the array, (push, pop, shift and unshift are convenient for
dealing with the ends of lists) and it's relatively easy to get the number
of elements in an array (use @array in a scalar context) or the index of
the first ($[) or last ($#array) elements.
If you want to implement linked lists then you might consider reading the
following manual pages which come with recent perl distributions:
perldata Perl data structures
perlref Perl references
perldsc Perl data structures intro
perllol Perl data structures: lists of lists
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: 6 Jan 1998 16:31:00 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Can I create a Linked List in Perl
Message-Id: <68tm84$b56$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
draggs@hawkeye.idx.com writes:
:I'm reasonably new to Perl, but am an old C programmer. I was
:wondering if it was possible to create a c-style linked list and perl.
:If it is, how would I go about doing so?
Well, usually you don't want to. Perl arrays are abstract data types
that grow on demand. They manifest O(1) type for simple access
as well as for pop() and shift, and usually for push as well;
unshift and splice take O(N) however.
You might look at http://www.perl.com/perl/misc/CS-Talk.tar.gz
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
In general, they do what you want, unless you want consistency.
--Larry Wall in the perl man page
------------------------------
Date: Tue, 6 Jan 1998 16:07:51 GMT
From: Jacqui Caren <Jacqui.Caren@ig.co.uk>
Subject: Re: Getting values from ResultSet is slow (vs. Perl/DBI)
Message-Id: <EMDE56.28u@ig.co.uk>
NG trimmed to comp.lang.perl.misc
emailed to Mike Linksvayer
In article comp.lang.perl.misc:<349F0E59.22E3BD92@justintime.com>,
Mike Linksvayer <ml@justintime.com> writes:
>7 seconds to 2 seconds (for 13 total). This seems to indicate that the
>column type was being checked again for each row!
>
>Running on the same machine against the same database the following
>Perl/DBI/DBD::Oracle code does much better:
>
> $select = "select 13 columns from several tables...";
> $cursor = $dbh->prepare($select);
> $cursor->execute;
> while (@row = $cursor->fetchrow) {}
This is slow - see fetch which will provide a reference instead.
For large reacords/queries this will improve performance.
Remember also that queries using DBI/OCI bind params for variables
will share the same entry in the query cache. This results in a much
fast query for high hit rates.
There are lots of tricks to get higher throughput using DBI/DBD::Oracle
- most are common (perl or OCI/SQL*Net/Oracle) sense,
>Typically it takes 6 seconds to execute the query (equivalent to creating
>a ResultSet).
Do you seperate out Commect time (which involves the database allocating
SGA space etc)? My slow dev system takes 4+ seconds to do this... Another
system with more memory takes <1 second.
For a web application my mod_perl code runs in sub second times with the
same functionality as a 10+ seconds perl hit CGI version. This is mostly
due to connection and data caching.
>Looping through the cursor AND putting the columns from each
>row into an array only takes an additional second.
>The query used in both of the above tests produces 3000 rows. Saving the
>results (e.g. putting them in an array of arrays) has negligible overhead
>in both Java and Perl.
>
>In both cases, it is taking 6 or 7 seconds for the database to finish
>executing its query (this is also how long it takes in sqlplus, as expected).
>
>Why does Perl loop through the cursor and retrieve the results so much
>faster? I can only think of these possibilities...
Cleaner, tighter better written code :-)
Seriously DBI/DBD::Oracle was written to provide a clean. FAST
interface to oracle from perl. We have systems generating one
full color seven page report at an average of just over one second.
That covers 14+ queries, including the generation of tables and graphs.
In this project, milliseconds count and we used high-end tools to
design and tune the database schema,queries and software.
>* Perl is retrieving whole rows at a time, Java a column at a time. I
> don't see anything like ResultSet.getArray(String[]) in JDBC.
OCI will obtain *sets of* rows at a time - it is called readahead. :-)
Remember DBD::Oracle talks to OCI, and provide a clean interface to a lot
of its functionality...
If JDBC is anything like ODBC you have significant overheads
in order to provide the functionality offered by ODBC. Each query
has far more data processing and manipulation than a mere DBI
query would (by default).
>* ResultSet.getString() returns a new String, which is expensive.
>* One or more of Java, Sun's VM, JDBC, and Oracle's driver are slow.
Your example $csr->fetchrow() is as expensive. using
$rowref = $csr->fetch() will remove an array copy etc...
>So... Anyone have any suggestions as to how I can speed up getting
>results out of JDBC? In summary, here's what I tried:
>
>* Use column indices instead of names with ResultSet.get*() methods (obvious)
>* Tell the driver what data type you will request of each column (is there
> a generic way to do this in JDBC?)
>* Tell the driver how many rows to fetch at a time (this didn't help me, but
> I would be interested to know if there is a generic way to do this in JDBC).
There are tuning params in DBD::Oracle (actually) OCI. They may work for
JDBC if it uses an OCI backend. Read your OCI documentation.
Also ala ODBC there may be JDBC configuration parameters that will reduce
the amount of work done for your query and so speed things up.
All the best,
Jacqui Caren - just another DBI user :-)
--
Jacqui Caren Email: Jacqui.Caren@ig.co.uk
Paul Ingram Group Fax: +44 1483 419 419
140A High Street Phone: +44 1483 424 424
Godalming GU7 1AB United Kingdom
------------------------------
Date: Tue, 6 Jan 1998 08:47:05 -0500
From: "Thomas Charron" <twolf@sampo.creighton.edu>
Subject: Re: Interprocess Communication
Message-Id: <68tckv$nmk2@biko.telecom.ups.com>
Wow, someone else who had this problem.. I thought I was the only one..
Well, here's the kicker.. I didn;t find the CAUSE of the problem, but I DID
find a solution.. Instead of directly calling bind and the such, I used the
IO::Socket package, and it miraculously solved the problem (Also makes it a
WHOLE lot easier and reliable, IMHO). Instead of this:
if (socket(S,2,1,6)) { print "socket ok\n"; } else { die $!; }
if (bind(S,$this)) { print "bind ok\n"; } else { die $!; }
if (connect(S,$that)) { print "connect ok\n"; } else { die $!; }
Try something like this:
print "\nConnecting to $centername[$i].....";
$remote = IO::Socket::INET->new( Proto => "tcp",
PeerAddr => $ip[$i],
PeerPort => 23,
);
print "Connected!\n";
unless ($remote) { die "cannot connect to telnet daemon on $host" }
$remote->autoflush(1);
Naturally, PerrAddr => $ip[$i], should be replaced to point directly to
either the named or IP address, and PerrPort should go to the port. Setting
the $remote->autoflush(1); is important, it allows for automatic flushing of
the buffers back and forth.
I simply cut that little segment from some source of mine, hope it helps a
bit.. $remote is now a standard handle, when your done with it, just close
$remote.
Allan Krause wrote in message <686ojd$gtl1@sol.connect.usq.edu.au>...
>I am trying to write a client/server type application.
>
>The client application is a perl script which will compile and link all the
>components of an application. This application will run on a unix machine
>(solaris).
>
>The server application will extract all the software components to be
>compiled from a configuration management repository (Microsoft SourceSafe)
>using supplied utilities. This application will run on a
>Windows95/WindowsNT machine (i386).
>
>The extraction step performed by the server process will occur after the
>client application has set up the specified destination environment and
>before the compilation commences.
>
>It is envisaged that the client application will send a message to the
>server application which will trigger it to perform the extraction
operation
>and signal the client application when it is finished.
>
>I have tried copying sample routines from several books such as "Perl 5 for
>Dummies" (see attached). These routines seem to work ok when both the
>client and server processes are running on the unix box. When both
routines
>are run on a Windows95 or WindowsNT box, the client application fails on
the
>'bind' statement with "unknown Error: 0x00002741 at client line 16".
>
>I've no idea how to modify the scripts so one will run on unix and the
other
>on NT and have them talk to each other!!!
>
>Does anyone out there have any idea how I can get this to work??????
>
>
>
------------------------------
Date: 06 Jan 1998 17:37:48 +0100
From: Dominique Dumont <domi@marlis.grenoble.hp.com>
Subject: Re: Interprocess Communication
Message-Id: <vkzen2lmucj.fsf@marlis.grenoble.hp.com>
"Allan Krause" <allank@techone.com.au> writes:
> I am trying to write a client/server application in perl which will allow a
> client process (perl script) running on a unix (solaris) platform to
> communicate with a server process (perl script) running on a WindowsNT
> (i386) platform.
>
> Basically, the client process should signal the server process to start
> doing its thing, and wait. The server process should send some indication
> back to the client process when it has finished doing its thing so it can
> resume.
>
> I've looked at the sample 'client' and 'server' scripts supplied with perl
> and which appear in the book 'Perl 5 for Dummies'. When both scripts are
> run on unix only, they seem to work ok. When both are run on NT only, the
> server seems to hum along ok, but the client fails on the 'bind' statement.
> I've no idea how to modify the scripts (or even if I need to) to get them
> communicating with each other on different platforms?????
>
> If someone could help, I'd really appreciate it!!
>
You may also want to use the RPC::Simple module I wrote.
That said, I must add some warnings:
- It works on HP-UX, but I've never tested it on NT (although it does
use IO::Socket instead of calling directly socket and likes).
- It still in alpha development, the interface may change
- It needs Tk on the client part (I use Tk to have a GUI for driving
remote operations)
- The client calls do not block, a callback is made when the server has
completed the request (hence the need for a control loop).
Hope this helps
--
Dominique_Dumont@grenoble.hp.com
------------------------------
Date: 6 Jan 1998 14:06:30 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Lexical scope and embedded subroutines.
Message-Id: <68tdp6$suq$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, "Aaron Harsh" <ajh@rtk.com> writes:
:This behavior brings up the following questions:
: o Did the Perl gods just decide that scheme-like behavior was less
:important than the pseduo-static variables described in perlsub?
Have to ask Chip.
: o Does anyone else find Perl's behavior counter-intuitive?
I do.
A solution is to use a closure not a named function, which will
fix this.
--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: 06 Jan 1998 14:19:59 +0100
From: Casper Kvan Clausen <ckc@dmi.dk>
Subject: Re: Looping through hashes
Message-Id: <wvpsor1eo3k.fsf@edb.ejoper.dmi.min.dk>
Boris Statnikov <boromir@mindspring.com> writes:
> Is there a way to know the number of elements in a hash IN ONE OPERATION
> (is there an equivalent of $# for hashes)? I don't think so, but maybe
> someone knows better.
There is no $# for hashes. I have attempted to concoct something along
the lines of $#{keys %hash}, but have not been succesful. You may want
to investigate that line of thought by looking up $# in the
documentation to see if it can be used without an intermediate array
at all.
In two operations, do this:
@hash_keys=keys %hash;$hash_length=$#a;
> for (($key, $val) = each %myhash) {
> if ($val eq "donkey") {
> $myhash{"parrot"} = "silly bird";
> }
> }
>
> In other words, one is not permitted to ADD elements to a hash while
> EACHing through it. Now, how do I accomplish the same thing (and how do
> I break out of each loop in order to accomplish it)?
Is there something here I'm not getting? It seems like you want to:
foreach $val (values %myhash) {
if ($val eq "donkey") {
$myhash{"parrot"} = "silly bird";
}
}
Regards,
Kvan.
--
-------Casper Kvan Clausen------ | 'Ah, Warmark, everything that passes
----------<ckc@dmi.dk>---------- | unattempted is impossible.'
Lokal 544 |
I do not speak for DMI, just me. | - Lord Mhoram, Son of Variol.
------------------------------
Date: 6 Jan 1998 07:46:25 -0600
From: jima@REMOVE.ME.mcs.com (Jim Allenspach)
Subject: Re: Looping through hashes
Message-Id: <68tcjh$9es$1@Venus.mcs.net>
>> Is there a way to know the number of elements in a hash IN ONE OPERATION
>> (is there an equivalent of $# for hashes)?
>In two operations, do this:
>@hash_keys=keys %hash;$hash_length=$#a;
Or, in one operation, do this:
$hash_length = scalar keys %hash;
Subtract 1 if you want it to correspond to the values you get with $#, of
course. Hope this helps....
jm "I *think* that code is Y2K compliant.." a
--
#!/usr/bin/perl -- Jim Allenspach (jima at mcs dot com)
split(//,'23331333333312333133333310');foreach(split(/\s/,'bcdilnpx
aghjqsvyz bdghikoqwy acghlpuvxz bcfhkotuvw')){map{$_[$_]<<=1}(0..$#_);
map{++$_[ord()-97]}split(//);}print map{chr}@_;
------------------------------
Date: Tue, 06 Jan 1998 09:29:58 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Looping through hashes
Message-Id: <-0601980929580001@aggie.coaps.fsu.edu>
In article <wvpsor1eo3k.fsf@edb.ejoper.dmi.min.dk>, Casper Kvan Clausen
<ckc@dmi.dk> wrote:
+ Boris Statnikov <boromir@mindspring.com> writes:
+
+ > Is there a way to know the number of elements in a hash IN ONE OPERATION
+ > (is there an equivalent of $# for hashes)? I don't think so, but maybe
+ > someone knows better.
+
+ There is no $# for hashes. I have attempted to concoct something along
+ the lines of $#{keys %hash}, but have not been succesful.
I dunno. This is what I tried:
%hash=("a"=>"b",
"c"=>"d",
"e"=>"f",
"g"=>"h",
"i"=>"j");
$res=keys %hash;
print "$res number of keys in \%hash\n";
Result:
5 number of keys in %hash
James
--
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>
------------------------------
Date: 6 Jan 1998 15:17:47 GMT
From: gabor@vinyl.quickweb.com (Gabor)
Subject: Re: Looping through hashes
Message-Id: <slrn6b4ic8.6i5.gabor@vinyl.quickweb.com>
In comp.lang.perl.misc, Boris Statnikov <boromir@mindspring.com> wrote :
# I have two questions on this topic:
#
# 1.
# Is there a way to know the number of elements in a hash IN ONE OPERATION
# (is there an equivalent of $# for hashes)? I don't think so, but maybe
# someone knows better.
You could do this
$size = keys %hash;
#
# 2.
# It turns out one is not supposed to do this:
#
# for (($key, $val) = each %myhash) {
# if ($val eq "donkey") {
# $myhash{"parrot"} = "silly bird";
# }
# }
#
# In other words, one is not permitted to ADD elements to a hash while
# EACHing through it. Now, how do I accomplish the same thing (and how do
# I break out of each loop in order to accomplish it)?
for $key (keys %hash) {
$hash{parrot} = 'silly bird' if $hash{$key} eq 'donkey';
}
gabor.
--
Remember though that
THERE IS NO GENERAL RULE FOR CONVERTING A LIST INTO A SCALAR.
-- Larry Wall in the perl man page
------------------------------
Date: Tue, 06 Jan 1998 15:00:00 GMT
From: jzawodn@wcnet.org (Jeremy D. Zawodny)
Subject: Re: MIME Decoder
Message-Id: <34b34413.1110497120@igate.hst.moc.com>
[original author automagically cc'd via e-mail]
On Tue, 06 Jan 1998 12:34:34 +0100, Martin Button <marty@kc3ltd.co.uk>
wrote:
>We are trying to develop a perl script to decode MIME messages, but are
>unable to write the script ourselves. Can anyone give us a ready to use
>script which we can simply implement. We are using Perl version 5.001
>for Solaris 2.4.
There are modules on CPAN that will do what you need. Just search the
module list for 'MIME' and see what pops up.
Jeremy
--
Jeremy D. Zawodny jzawodn@wcnet.org
Web Server Administrator www@wcnet.org
Wood County Free Net (Ohio) http://www.wcnet.org/
------------------------------
Date: Tue, 06 Jan 1998 15:20:34 +0100
From: Bela Garzo <gand@vtsoft.hu>
Subject: newbie question
Message-Id: <34B23DB2.714D@vtsoft.hu>
Hi,
Could anybody help how to fix this code?
I really need to store filehandle in a hash.
#!/usr/bin/perl
$fd{'in'}=\*STDIN;
$fd{'out'}=\*STDOUT;
while ( <$fd{'in'}> ) {
print { $fd{'out'} } $_;
}
thanks,
gand.
------------------------------
Date: Tue, 06 Jan 1998 17:00:29 +0100
From: Achim Selz <selz@wise.wiwi.tu-dresden.de>
To: joseph@5sigma.com
Subject: Re: newbie question: install perl on solaris 2.5.1
Message-Id: <34B2551C.BAECCA34@wise.wiwi.tu-dresden.de>
Joseph N. Hall schrieb:
>
> Beats me. Really. How about some output from your install
> attempt? Installing as root should not make any difference.
>
> -joseph
>
> Achim Selz wrote:
> >
> > I try to install perl 5.004_04 on a Sun Netra with Solaris 2.5.1.
> > Configure correctly detects the Solaris 2 system and then hangs. Any
> > hints? BTW, I am installing as root.
Here is the Configure Dialogue:
------- snip -------
# sh Configure
Beginning of configuration questions for perl5.
Checking echo to see how to suppress newlines...
...using \c
The star should be here-->*
First let's make sure your kit is complete. Checking...
Looks good...
Would you like to see the instructions? [n]
Locating common programs...
awk is in /bin/awk.
cat is in /bin/cat.
comm is in /bin/comm.
cp is in /bin/cp.
echo is in /bin/echo.
expr is in /bin/expr.
find is in /bin/find.
grep is in /bin/grep.
ls is in /bin/ls.
mkdir is in /bin/mkdir.
rm is in /bin/rm.
sed is in /bin/sed.
sort is in /bin/sort.
touch is in /bin/touch.
tr is in /bin/tr.
uniq is in /bin/uniq.
Don't worry if any of the following aren't found...
I don't see Mcc out there, offhand.
I don't see byacc out there, either.
cpp is in /usr/local/bin/cpp.
csh is in /bin/csh.
date is in /bin/date.
egrep is in /bin/egrep.
gzip is in /usr/local/bin/gzip.
I don't see less out there, either.
line is in /bin/line.
ln is in /bin/ln.
more is in /bin/more.
nroff is in /bin/nroff.
I don't see perl out there, either.
pg is in /bin/pg.
sendmail is in /usr/lib/sendmail.
test is in /bin/test.
uname is in /bin/uname.
I don't see zip out there, either.
Using the test built into your sh.
Checking compatibility between /bin/echo and builtin echo (if any)...
They are compatible. In fact, they may be identical.
Symbolic links are supported.
Good, your tr supports [:lower:] and [:upper:] to convert case.
First time through, eh? I have some defaults handy for the following
systems:
3b1 dynixptx isc next_4
sunos_4_0
aix epix isc_2 opus
sunos_4_1
altos486 esix4 linux os2 svr4
amigaos fps lynxos os390 ti1500
apollo freebsd machten powerux
titanos
aux_3 genix machten_2 qnx
ultrix_4
bsdos greenhills mips sco umips
convexos hpux mpc sco_2_3_0 unicos
cxux i386 mpeix sco_2_3_1
unicosmk
cygwin32 irix_4 ncr_tower sco_2_3_2
unisysdynix
dcosx irix_5 netbsd sco_2_3_3 utekv
dec_osf irix_6 newsos4 sco_2_3_4 uts
dgux irix_6_0 next_3 solaris_2
dynix irix_6_1 next_3_0 stellar
You may give one or more space-separated answers, or "none" if
appropriate.
If your OS version has no hints, DO NOT give a wrong version -- say
"none".
Which of these apply, if any? [solaris_2]
------- snap -------
Does anyone have an idea why Configure hangs here? I can abort with ^C,
but I'd rather continue the installation.
Any hints are welcome!
Regards
Achim Selz
e-mail: selz@wise.wiwi.tu-dresden.de
WWW: http://www.tu-dresden.de/wwwise/mitarb/adrselz.html
Technische Universitaet Dresden
Fakultaet Wirtschaftswissenschaften
Lehrstuhl fuer Wirtschaftsinformatik, insb. Systementwicklung
D-01062 Dresden
------------------------------
Date: Tue, 6 Jan 1998 15:30:21 GMT
From: Jacqui Caren <Jacqui.Caren@ig.co.uk>
Subject: Re: ORAPerl
Message-Id: <EMDCEo.266@ig.co.uk>
In article comp.lang.perl.misc:<34a19198.23523242@news.ais.net>,
syarbrou@ais.net (Steve) writes:
>The ORAperl interface does not work with perl 5.004. It's only
>designed for Perl 4. From what I have heard, there is no further
>development being done on it.
oraperl - the perl4 extension is unsupported as is perl4.
Oraperl.pm the oraperl emulation layer is fully supported as is the DBI
and many of the DBD modules.
>Besides, DBI/DBD's are much better and
>use the latest version of Perl.
Oraperl provides a good migration tool (its primary purpose) and because
$lda and $csr are actually $dbh and $sth's (read the perldoc's), you can
use DBI methods on the $lda and $csr handles...
So, if you are already using oraperl then
use Oraperl; # :-)
if you are a "DB newbie" then take your pick. DBI is probably my
preference simply because it is more flexible and allows easier DB
migration. As always YMMV...
All the best,
Jacqui
--
Jacqui Caren Email: Jacqui.Caren@ig.co.uk
Paul Ingram Group Fax: +44 1483 419 419
140A High Street Phone: +44 1483 424 424
Godalming GU7 1AB United Kingdom
------------------------------
Date: Tue, 06 Jan 1998 16:53:43 +0100
From: Peter John Acklam <jacklam@math.uio.no>
Subject: Pattern match causing runtime exception
Message-Id: <34B25387.14A2@math.uio.no>
I want to match a chunk of Matlab code which is neither a string
nor a comment, and I have come up with
(?: # Non-backreferencing grouping parenthesis.
[])}\w.]' # Either a character followed by a single quote
# character that is a transpose operator
| # or else
[^'%] # any character except single quote (which starts
# a string) or a percent sign (which starts a
# comment).
)+ # Match one or more times.
A Matlab string is started by a single quote (') and a comment is
started by a percent sign. The single quote is also a transpose
operator but only if after a closing delimiter, letter, digit,
underscore or dot.
This regex works, but if the matched code is larger than 5648 bytes
and it is only matched by the [^'%] part (i.e., code has no transpose
operators), Perl crashes with a runtime exception.
Why?
Here is a way to see that it goes wrong. First generate a test
file, then apply regex. If the 78 is replaced by 77 everyting
is OK.
perl -we "print( ('x' x 72 . \"\n\") x 78)" > test.txt
perl -0777 -wne "print 'OK' if /(?:[])}\w.]'|[^'%])+/" test.txt
I use Perl for Win32 so the delimiters might need to be changed.
Peter
------------------------------
Date: Tue, 06 Jan 1998 08:57:34 -0500
From: Scott Vetter <svetter@ameritech.net>
Subject: Perl pgm to provide web page date?
Message-Id: <34B2384E.5EE0@ameritech.net>
Is there a Perl program that will provide the date of last update of
the web page that is being displayed? It sure would beat haveing to
chage the date every time the web page is updated.
------------------------------
Date: Tue, 06 Jan 1998 14:47:29 GMT
From: jzawodn@wcnet.org (Jeremy D. Zawodny)
Subject: Re: Perl pgm to provide web page date?
Message-Id: <34b243cc.1110426649@igate.hst.moc.com>
[original author automagically cc'd via e-mail]
On Tue, 06 Jan 1998 08:57:34 -0500, Scott Vetter
<svetter@ameritech.net> wrote:
>Is there a Perl program that will provide the date of last update of
>the web page that is being displayed? It sure would beat haveing to
>chage the date every time the web page is updated.
If there is one, you'll probably find it on CPAN.
If not, you might consider using some sort of server-side directives
in your HTML source to achieve the same effect.
Jeremy
--
Jeremy D. Zawodny jzawodn@wcnet.org
Web Server Administrator www@wcnet.org
Wood County Free Net (Ohio) http://www.wcnet.org/
------------------------------
Date: Tue, 06 Jan 1998 11:21:10 -0500
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Perl sort( ) Argument Passing Problem
Message-Id: <pudge-0601981121110001@ppp-10.ts-1.kin.idt.net>
In article <34B13804.57390ED9@EBay.Sun.COM>, MICHAEL JONES
<michael.jones@EBay.Sun.COM> wrote:
You can look at the code for File::Sort 0.11 (just uploaded to CPAN) for
some ideas.
--
Chris Nandor pudge@pobox.com http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10 1FF7 7F13 8180 B6B6'])
#== MacPerl: Power and Ease ==#
#== Publishing Date: Early 1998. http://www.ptf.com/macperl/ ==#
# Hi,
#
# I have two questions relating to Perl sort functions. I am trying to
# write
# a module file that incorporates sort functions used in other scripts in
# a
# package.
#
# I would like to call the external subroutine like
#
# foreach $i ( sort External_Module->sort_subroutine ( keys %HASH ) ) {
#
# ...
#
# }
#
# I have the following problems:
#
# 1) When calling an external subroutine, the first argument passed to the
# subroutine is the module name (i.e. 'External_Module'). This seems
# to mess up the $a, $b arguments that sort passes to the sorting sub-
# routine.
#
# 2) I would like to pass a reference to the hash to the sorting
# subroutine
# so I could sort on more than just the key, but I can't find a way to
# pass this reference without messing up $a and $b.
#
# Any suggestions on how to make this work would be greatly appreciated.
#
# Thank you,
#
# Michael Jones
# ___________________________________________________________________________
#
# Michael V. Jones Sun Microsystems, Milpitas
# Facility
# Component Supply Engineer 1421 California Circle,
# UMIL01-125
# LSI Logic ASIC Devices Milpitas, CA 95035
#
# michael.jones@ebay.sun.com (408) 276-0837 fax (408) 276-0746
# ___________________________________________________________________________
------------------------------
Date: Tue, 06 Jan 1998 09:23:53 -0500
From: "Jack H. Ostroff" <jack_h_ostroff@groton.pfizer.com>
Subject: Re: problem parsing conditional operator.
Message-Id: <34B23E79.317C@groton.pfizer.com>
Rob Maniatis wrote:
>
> #!/usr/local/bin/perl -w
> $variable1 = 2;
> $variable2 = 2;
>
> print $var1 == $var2 ? "equal\n" : "not equal\n"; # TEST 1
>
> print ($var1 == $var2) ? "equal\n" : "not equal\n"; # TEST 2
>
> If you run this little script the TEST 1 line will produce "equal" while
> the TEST 2 line will produce "1" and a warning about Useless use of a
> scalar in a void context.
>
I think your problem here is one of precedence. The parens create a
term,
which binds to the function "print" and the result of the print is then
tested by the question mark. What you probably want to do is not to
drop
the parens, but add another pair around the entire expression whose
value
you want to print:
print (($var1 == $var2) ? "equal\n" : "not equal\n");
Jack
------------------------------
Date: 06 Jan 1998 08:30:18 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: Rob Maniatis <robm@transmeta.com>
Subject: Re: problem parsing conditional operator.
Message-Id: <8ciurxei2d.fsf@gadget.cscaper.com>
>>>>> "Rob" == Rob Maniatis <robm@transmeta.com> writes:
Rob> print ($var1 == $var2) ? "equal\n" : "not equal\n"; # TEST 2
Rob> If you run this little script the TEST 1 line will produce "equal" while
Rob> the TEST 2 line will produce "1" and a warning about Useless use of a
Rob> scalar in a void context.
[...]
Rob> This can be fixed in a number of ways including:
Rob> print "",(EXPR1) == (EXPR2) ? "equal\n" : "not equal\n";
I prefer:
print +(EXPR1 == EXPR2) ? "eq" : "ne", "\n";
That leading plus is merely discarded in the syntax tree, but it's
enough to make print a operator instead of a function. I generally
don't do this on "code for long term", however. I'll go the otherway
and make print the "ugly print with parens" :-):
print ((EXPR1 == EXPR2) ? "eq" : "ne", "\n");
I suppose it doesn't look ugly to C hackers, but I've been away from C
for so long that I just can't bear putting parens around *every*
function call any more. Not when they're optional! :-)
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 238 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@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: 6 Jan 1998 08:51:57 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: readdir() and file named '0'
Message-Id: <68tctt$c8n@panix.com>
In <34B210B0.BB4@bigfoot.com> Koos Pol <koos_pol@bigfoot.com> writes:
>while ($next_entry = readdir ($dirh)) {
>Why does it fall-through as soon as I reach a file named '0' (null) ?
>Although '0' is FALSE in perl terms, what has it got to do with the
>name of the file ?
Read about 'defined' in your pod or at:
http://www.perl.com/CPAN-local/doc/manual/html/pod/perlfunc/defined.html
Basically:
Many operations return undef to indicate failure, end of file, system
error, uninitialized variable, and other exceptional conditions. This
function allows you to distinguish undef from other values. (A simple
Boolean test will not distinguish among undef, zero, the empty string,
and ``0'', which are all equally false.)
So you'd want something like:
while (defined ($next_entry = readdir $dirh)) {
--
Clay Irving <clay@panix.com> I think, therefore I am. I think?
http://www.panix.com/~clay/
------------------------------
Date: 6 Jan 1998 10:44:33 -0500
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Review of CGI/Perl book
Message-Id: <68tjh1$2ac$1@stok.co.uk>
In article <34B20242.24B88082@5sigma.com>,
Joseph N. Hall <joseph@5sigma.com> wrote:
>Craig Patchett wrote:
>> And while I'm at it, Perl 4 is far from dead.
>
>I was with you until you said that. Perl 4's shortcomings really
>are odious, especially when you have (1) been around Perl 5 for a while,
>and/or (2) taught Perl for a living for a while.
>
>If only Perl 4 WERE dead.
Opinion alert! Don't read this if you don't want to.
In the brave new world of computing people seem to forget that legacy
systems live much longer than "coputer people" think. I know people who
still use Word Perfect on a CPM box to do some of their letters - when the
box or printer gives up then they'll upgrade, and people still run old
perl 4 scripts I wrote for them on little 386 based PCs.
While perl 5 might make it easier to develop larger and more robust
applications it's a resource and performance hog in comparison to perl 4
when it starts up (even though perl 5 may run faster once started.) There
are a whole bundle of existing apps for which perl 4 might seem perfectly
reasonable, especially if you're running on old PCs etc., or if you're
running on a web server (maybe a commercial server or an old apache) doing
little CGI or SSI scripts which get called many times a minute where
start-up is a big chunk of the overall time spent on the script.
The ability to compile perl 5 one day is a mixed blessing, one of the
reasons I like using perl was that it's hard to misplace the source of a
perl utility...
Perl 5 seems to address a significantly larger problem space than perl 4,
but people using the perl 4 subset still pay a price for moving "up."
I'm not advocating writing all new code in perl 4, but wishing perl 4 dead
seems like wishing C dead now that Java's around. Stable might be another
word for "dead" - how many people responsible for multiple machines feel
pangs of anticipation when a new script needs a module which needs a new
version of perl 5 or some existing module?
As for ease of teaching, I'd rather have a language which is difficult to
teach but useful than some elegant easy to teach monstrosity which
consumes all the machine resources you can throw at it.
Idle thoughts,
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: Tue, 6 Jan 1998 07:32:58 -0800
From: "Myles Lawrence" <myleslawrence@email.msn.com>
Subject: This may sound like a stupid question
Message-Id: <OAniDerG9GA.215@upnetnews03>
but not to me.
When you use the <input type="file"... upload statement. Where does the file
go?
myleslawrence@msn.com
------------------------------
Date: 6 Jan 1998 15:59:26 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Two-byte characters substitution ?
Message-Id: <68tkcu$56i$1@lyra.csx.cam.ac.uk>
In article <68sc4a$8vs$1@news.ncu.edu.tw>,
Wu <weihan@ziyou.math.ncu.edu.tw> wrote:
>I use perl to match Chinese characters which are two-byte oriented.
>I know it is not easy for perl to handle the match. However, here
>is the problem that I don't know how to solve.
>
>I have a Chinese character with rear part of its two-byte is "[" ,
>which has special meaning in regexps and will certainly get compilation
>error. How am I supposed to do ?
By escaping it with a preceding \. The \Q escape and the quotemeta()
function are often useful for doing this.
See perldoc perlre for \Q
perldoc -f quotemeta
Mike Guy
------------------------------
Date: Tue, 06 Jan 1998 09:08:16 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: Using shell aliases from within Perl scripts, question.
Message-Id: <34B248E0.3FBC709B@houston.Geco-Prakla.slb.com>
Eli the Bearded wrote:
>
> Philip R Ventura <pventura@cs.buffalo.edu> wrote:
> > I have several aliases setup in my .cshrc file. The shell I use is
>
> Um, alright.
>
> > tcsh. I am trying to write a Perl script which will be able to use
>
> Probably should be using a .tcshrc then, but anyway.
>
> > the aliases defined in the .cshrc file simply calling them, but to no
> > avail. When I run something like the following:
>
> Perl is not csh or tcsh. It has a different syntax. You are going to
> find this a futile effort, I think.
>
> > print <<`EOC`;
> > alias
> > EOC
> >
> > My aliases are not shown. What do I need to do?
IMHO:
Perl wisdom suggests always using absolute paths to programs, thus
preventing 'spoofing' your Perl script to run some other (possibly bogus
and potentially fatal) program.
That said:
1. If you wish to pursue this, why not open your .alias file, slurp it
into an array, create a hash from the array, and then do setenv of the
hash key to the hash value? Convoluted, sure, wasteful, probably, but
....
2. The other option is to somehow set (manually? or with a shell script
that does the setenv & then runs the perl script?) environment variables
of the aliases you want, and then use the %ENV hash to reference them.
i.e. setenv Test_Program "/what/ever/you/want" from tcsh In perl,
$ENV{Test_Program) can then be used to run your "alias"ed command.
Again, convoluted, and seems silly, but ....?
3. Setting the $ENV{alias_name} = alias_value in your perl script
Did I mention that having absolute paths in your perl script is probably
the best solution?
>
> Replace all your aliases with perl scripts?
Sounds fair.
>
> Elijah
> ------
> replacing your login shell with perl would be an interesting effort, too.
Interesting.... What should we call it? posh? psh? pcsh? ;-)
--
"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: Tue, 06 Jan 1998 16:08:15 +0100
From: Mariana Wuerz <mariana.wuerz@fernuni-hagen.de>
Subject: what is the meaning of "constant"?
Message-Id: <34B248DE.7F83C92E@fernuni-hagen.de>
I append the text of an AUTOLOAD subroutine because the meaning of
line 4 is not clear for me.
I could not find a function called constant and I cannot figure out the
meaning of this word.
Could you please tell me the way in which this word should be
understood. Thanks!
1: sub AUTOLOAD {
2: local($constname);
3 : ($constname = $AUTOLOAD) =~ s/.*:://;
4: $val = constant($constname, @_ ? $_[0] : 0);
5: if ($! != 0) {
6: if ($! =~ /Invalid/) {
7: $AutoLoader::AUTOLOAD = $AUTOLOAD;
8: goto &AutoLoader::AUTOLOAD;
}
else {
($pack,$file,$line) = caller;
die "Undefined Sybase::CTlib macro $constname, used at
$file line $line. ";
}
}
eval "sub $AUTOLOAD { $val }";
goto &$AUTOLOAD;
}
if ($no_autoloader) {
boot_Sybase__CTlib;
}
else {
bootstrap Sybase::CTlib;
}
1;
__END__
Mariana Wuerz
------------------------------
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 1588
**************************************