[6761] in Perl-Users-Digest
Perl-Users Digest, Issue: 386 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 28 20:17:22 1997
Date: Mon, 28 Apr 97 17:00:42 -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 Mon, 28 Apr 1997 Volume: 8 Number: 386
Today's topics:
** The Perl Journal ** (Jon Orwant)
Re: Calling Win32 Perl from DELPHI ()
Can a Perl script understand if it's being run in debug <lpa@sysdeco.no>
Re: case sensitive comparisons <a.aitken@unl.ac.uk>
Re: Good editor for W95? ()
hip/activeware perl site down? <jim.condit@fmr.com>
Integrating Perl 5 with databases - Need info. (MTurner582)
mirror code <mmm@msi.com>
Multiple classes, one object? (Colin Kuskie)
Multiple filehandles or File:Copy <daleweb@io.com>
RE: Multiple Page Forms???? ("S. Sebastein Dixxonn")
Re: multiple STDOUT formats <billc@tibinc.com>
Re: Need Help making random number! (Matthew Cravit)
Re: Need help with Perl <a.aitken@unl.ac.uk>
Re: Network Programming and Sockets <passani@eunet.no>
Re: Notice to antispammers <mcampbel@tvmaster.turner.com>
Re: Object IDs are bad (was: Ousterhout and Tcl lost th <garrigue@safran.kurims.kyoto-u.ac.jp>
OLE and Perl:Memory management <pirc@pirc.demon.co.uk>
Re: Ousterhout and Tcl lost the plot with latest paper (L.J. Wischik)
Re: Passwork perl <a.aitken@unl.ac.uk>
Re: Perl auto-replier <mcampbel@tvmaster.turner.com>
Re: pre-RFD: comp.lang.perl.{data-structure,inter-proce <tchrist@mox.perl.com>
Re: pre-RFD: comp.lang.perl.{data-structure,inter-proce (Jari =?ISO-8859-1?Q?M=E4kel=E4?=)
Re: pre-RFD: comp.lang.perl.{data-structure,inter-proce (A. Deckers)
Re: print <<THIS_PART; won't work <mcampbel@tvmaster.turner.com>
Re: Printing to Files. really_eliot@dg-rtp.dg.com_but_mangled_to_stop_junk_email
problem: array assignment to hashref slice <gmarzot@baynetworks.com>
Re: problem: array assignment to hashref slice (David Alan Black)
Re: problem: array assignment to hashref slice (Paul D. Smith)
Re: Problem: hex() and Unsigned vs. Signed (M.J.T. Guy)
Re: raw input <slash@deil.de>
Re: References in foreach loop variable (M.J.T. Guy)
Re: Removing 2 or more spaces ? <seay@absyss.fr>
Re: Run UNIX commands <a.aitken@unl.ac.uk>
Re: unpack() problem: bug, or just me? (M.J.T. Guy)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 28 Apr 1997 20:03:39 GMT
From: orwant@fahrenheit-451.media.mit.edu (Jon Orwant)
Subject: ** The Perl Journal **
Message-Id: <ORWANT.97Apr28160339@fahrenheit-451.media.mit.edu>
The Perl Journal is a quarterly, printed magazine
devoted to All Things Perl.
http://tpj.com
Issue #6 is speeding toward press, and will be mailed in
mid-late June. Now would be a good time to subscribe
if you want to receive it hot off the presses.
Some heartfelt testimonials:
"It is the most useful technical publication I have seen."
-Lisa Nyman
"TPJ is the most consistently relevant, content-rich publication
I get, and I get a pile of them. You folks do a great job."
-John Bazik
"Do yourself a favor and subscribe."
-SunExpert magazine
"...a really hot magazine..."
-HotWired, in Packet
"My first issue of The Perl Journal (vol 1 issue 2) is the best
single issue of a technical journal I have read."
-Andrew Duncan
"The Perl Journal outsells WiReD here."
-Quantum Books of Cambridge, MA
Prices: $18 U.S., $25 international. Back issues are $7 ($9 non-U.S.)
and are first-class/air-mail so you get 'em quick.
All back issues are available (totalling 192 pages for all five)
and when you order four issues, get the fifth free!
TPJ accepts checks, money orders, VISA, and MasterCard, but
operates on *prepayment only* -- we have neither the time nor
the money to send out individual invoices. There's an order form at
http://tpj.com/tpj/subscription_form for postal orders. Our address:
The Perl Journal
P.O. Box 54
Boston MA 02101
USA
** Order online at http://tpj.com/tpj/ordering **
Enjoy, and a big thank you to all subscribers, authors, and
advertisers for their support!
-Jon
----------------
Jon Orwant
The Perl Journal
http://tpj.com
Complete Table of Contents
Issue #6 (tentative):
The First Annual Obfuscated Perl Contest
Randomness, Part Two
Using the AutoLoader and AutoSplit modules
Perl/Tk: A Tour of the Nonstandard Widgets
CGI and the Web: Computing Coolness
Just the FAQs: Sorting Tutorial
Making Your Own Sundials with Perl
WebClip: Gathering Data from the Web
A Perl in the Oil Patch
Object Oriented Programming
3-D Graphics and Perl
Perl News / New Modules
Information Retrieval and What "pack 'w'" is For
Issue #5
Programming like you mean it: Pattern Languages
In Sync With Your Data (Understanding Regular Expressions)
DBI - The Database Interface for Perl 5
Perl/Tk: Signals, Sockets, and Pipes
Creating Surreal HTML Pages With The Mangler
Perl News / New Modules
Perl and the X protocol
PDL: The Perl Data Language
Perl And Nuclear Weapons Don't Mix
Issue #4:
A Subjective Look at Object Oriented Programming
Best of Both Worlds: Embedding Perl in C
The LWP Library: CGI Programming
use Lovecraft qw(cthulhu necronomicon)
New Modules
Randomness
Understanding Regular Expressions
The Grid Geometry Manager: Perl/Tk Programming
The Perl Purity Test
Using Usenet from Perl
Issue #3:
Data Hiding
Perl, Politics, and Pairwise Voting
CGI Scripts and Cookies
Penguin: The First Tentative Waddle
New Modules
Perl/Tk: Events and Other Things
FTP: File Transfer Using Perl
Understanding Regular Expressions
The Perl Institute
Obfuscated Perl Contest Results
Issue #2:
How Perl Saved The Human Genome Project
The Perl Compiler
Penguin: Java Done Right
MacPerl
Perl And The Tk Toolkit: The Mouse Odometer
Saving State with CGI.pm
Understanding Regular Expressions
Results of the Prisoner's Dilemma
The Zeroth Obfuscated Perl Contest
Issue #1:
Wherefore Art, Thou?
Perl And The Tk Toolkit
Creating, Processing, And Sending Mail From Perl
HTML Hacking with Regular Expressions
Programming For The Web: CGI.pm
The Prisoner's Dilemma
------------------------------
Date: 28 Apr 1997 15:12:59 GMT
From: scott@lighthouse.softbase.com ()
Subject: Re: Calling Win32 Perl from DELPHI
Message-Id: <5k2epr$8mn$3@mainsrv.main.nc.us>
Martin Liesin (mliesen@netg.se) wrote:
: What is the best way to call Win32 Perl from a non C++ language, like
: Delphi.
: I'ld like to work directly agains the PERL300.DLL if possible, but it looks
: to me
: like it is restricted to C++ usage, as it returns a class.
Does it? If it is designed for C++, it would be limited to one
single C++ compiler as they all implement C++ differently.
I can't imagine this would be useful.
If so, just call the Perl binary yourself and pass it a script
to execute.
Scott
------------------------------
Date: Mon, 28 Apr 1997 17:57:56 +0200
From: Luca Passani <lpa@sysdeco.no>
Subject: Can a Perl script understand if it's being run in debug mode
Message-Id: <3364C904.28D4@sysdeco.no>
Hallo,
is there a snippet of code which can let the script understand if it's
being run in debug mode or not?
thanx for attention
Luca
--
Luca Passani. | Sysdeco Innovation AS, http://www.sysdeco.no
Email: lpa@sysdeco.no | Trondheimsveien 184, 0570 Oslo, Norway
Tel: (+47) 22 09 66 06 | Fax: (+47) 22 09 65 03
------------------------------
Date: Mon, 28 Apr 1997 16:55:11 +0100
From: Alastair Aitken <a.aitken@unl.ac.uk>
Subject: Re: case sensitive comparisons
Message-Id: <3364C85F.3648@unl.ac.uk>
Lina Trivedi wrote:
>
> I am trying to read a text file through my perl script and find matchs
> to certain strings, however, I am looking to make matches that are case
> sensitive. Currently, my script is matching strings without
> consideration to case. I have my script as follows:
>
> if ($_ eq "$FORM{'userid'}") {
>
> However this will match string to String or STRING or StrinG. Any clues
> to help me out? Thanks!!!
It shouldn't be. Are you you running any translation (tr///;) on the
input before the match test?
eq is definitely case sensitive in normal usage.
Alastair.
------------------------------
Date: 28 Apr 1997 15:52:59 GMT
From: scott@lighthouse.softbase.com ()
Subject: Re: Good editor for W95?
Message-Id: <5k2h4r$a0r$1@mainsrv.main.nc.us>
George Rogers Clark (clarkgr@erinet.com) wrote:
: Your Unix boxes and Win95 (or DOS) boxes use different end-of-line
: markers. You need an editor which works on Win95, but allows you to
: save the file to a Unix file format for transport to your Unix boxes.
I just use vi on the UNIX machine (I don't even bother writing a sed
script) to change this. (As in :g/[enter]/s/// to delete all ^M's.) You
could write a sed script to translate multiple files if you had a
lot to do.
It's not a big deal, and not worth the solution of abandoning Emacs
for some shareware editor you'd have to learn all over again.
Scott
------------------------------
Date: Mon, 28 Apr 1997 10:44:03 -0400
From: Jim Condit <jim.condit@fmr.com>
Subject: hip/activeware perl site down?
Message-Id: <3364B7B3.3280@fmr.com>
I have been trying to open the Activeware perl site for a few days now
(checking for perl 5.004), and I get an error message, "server down" or
some such. Has the site moved, had big server problems, or what?
Thanks, Jim
------------------------------
Date: 28 Apr 1997 16:45:03 GMT
From: mturner582@aol.com (MTurner582)
Subject: Integrating Perl 5 with databases - Need info.
Message-Id: <19970428164400.MAA13211@ladder01.news.aol.com>
Has anyone integrated Perl 5 with Ingres or an o-o database such as
Versant? I need ideas in how to integrate Perl to these databases. Any
feedback would be appreciated. Please e-mail: MTurner582@aol.com
------------------------------
Date: Mon, 28 Apr 1997 20:24:09 GMT
From: Maurice Manning <mmm@msi.com>
Subject: mirror code
Message-Id: <33650769.6201@msi.com>
folks,
am looking for some help in using the mirror script in the
/CPAN/scripts/nftpstuff/ area. Is there anyone that is familiar
with this that would not mind answering a few questions??
in particular:
downloaded the mirror script off the CPAN archive last week.
Uncompressed and want to be able to call it to update different
directories at night but the only option i can get to work is
the -g method.
can it be used in command line mode?
ex: mirror -pnr.Z -site=ncbi.nlm.nih.gov -local_dir=/home/mmm ....
or passed different default files?
ex: mirror -p nr.Z /home/mmm/mirror.defaults.1
as i said, when i pass it the following defaults file, it never even
connects. know i am just using it wrong but have been looking at the
code and stepping thru with the perl debugger for 3 days and cannot
figure out my mistake. Seems to decide there are no sites in
interpret_config_files() and exits.
trying to get this to connect to the NCBI site and pull nr.z
outta /blast/db:
/home/mmm/MIRROR/mirror -pnr.Z /home/mmm/MIRROR/mirror.defaults.1
where mirror.defults.1 is:
package=defaults
# The LOCAL hostname - if not the same as `hostname` returns
hostname=msi.com
# Keep all local_dirs relative to here
local_dir=/usr/people/mmm/dnld/MIRROR/
remote_password=mmm@msi.com
mail_to=mmm@msi.com
remote_dir=/blast/db
# Don't compress a thing. It is already compressed
# but doesn't look it.
compress_patt=
site = ncbi.nlm.nih.gov
update_log=.mirror
get_patt="nr.Z"
as i said, it doesn't even connect. ANY HELP or where to get help
GREATLY appreciated!!!
Mo
--
Maurice Manning Molecular Simulations, Inc.
mmanning@msi.com 9685 Scranton Road
(619) 546 - 5316 San Diego, Ca 92121-3752
Web: http://www.msi.com
-disclaimer-
unless stated otherwise, everything in the above message is personal opinion
and nothing in it is an official statement of molecular simulations inc.
------------------------------
Date: 28 Apr 1997 12:00:02 -0700
From: colink@latticesemi.com (Colin Kuskie)
Subject: Multiple classes, one object?
Message-Id: <5k2s3i$pr5@defiant.latticesemi.com>
I would like to build a module that supplies two classes, A and B, where
B inherits and builds on the functions in A. Can I place both classes
in the same module:
ie use Foo::Bar; ##Access the A and B methods
or do I have to call them individually:
use Foo::Bar::A; ##Access the A methods
use Foo::Bar::B; ##Access the B methods
Flame Protection:
I've read perltoot, perlmod, perlbot, and perlobj and
realize what I'm looking for is the example from the
'INSTANCE VARIABLE INHERITANCE' section of perlbot with a use statement.
Thanks for your time,
Colin Kuskie
colink@latticesemi.com
------------------------------
Date: Mon, 28 Apr 1997 10:31:53 -0500
From: Dale Churchett <daleweb@io.com>
Subject: Multiple filehandles or File:Copy
Message-Id: <3364C2E9.6856@io.com>
I need to direct the output from a large subroutine to STDOUT and
a file on the server in the most efficient way - I'd rather not have to
call the subroutine twice for different filehandles.
Is there a way to associate two filehandles with one, and simply select
that?
something like (in English):
MASTER_OUTPUT references STDOUT along with FILE_OUTPUT
where FILE_OUTPUT would be:
open (FILE_OUTPUT, ">path/to/file")
and then after selecting (MASTER_OUTPUT), any calls to print or write
are sent to both STDOUT and FILE_OUTPUT simultaneously.
Thanks.
------------------------------
Date: 27 Apr 97 14:05:49 UTC
From: dixxonn@dixxonn.on.ca ("S. Sebastein Dixxonn")
Subject: RE: Multiple Page Forms????
Message-Id: <01bc5313$c96bcae0$525588cf@ns.idirect.com>
To the guys who are sticking up for me,
Thankyou. And here's another piece of information you may want to know
about.
I didn't post the message in comp.lang.perl.modules. I don't even know how
it ended up in there. The only place I posted it was in
comp.lang.perl.misc. Which I was led to believe was for MISCellaneous perl
questions.
S. Sebastein Dixxonn
President/Owner
Dixxonn Corporation
info@dixxonn.on.ca
info2@dixxonn.on.ca
------------------------------
Date: Sun, 27 Apr 1997 20:09:13 -0400
From: Bill Cowan <billc@tibinc.com>
To: Tom Phoenix <rootbeer@teleport.com>, Richard, S., Guse, <fxrsg@Camelot.acf-lab.alaska.edu>
Subject: Re: multiple STDOUT formats
Message-Id: <3363EAA9.56A5@tibinc.com>
Tom Phoenix wrote:
>
> On Tue, 22 Apr 1997, Richard S. Guse wrote:
>
> > How do I juggle multiple stdout formats?
>
> There's no easy way. No, I take that back. The easy way is to re-write
> them using (s)printf. Hope this helps!
>
As another approach....
To assign multiple formats to same file handle, you would:
1. first select that filehandle.
2. assign a different format to the special variable "$~" (which is the
current format on that file handle).
3. do WRITE on the file handle.
For example:
#-----------------------------------------------------------------------
# Formats for detail print lines.
#
format REPORTFILE_Detail1 =
@<<<<<<<<<<<<<<<< @<<<<<<<<< @<<<<<<<<
@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$DataHashRef->{Field1},$DataHashRef->{Field2},$DataHashRef->{Field3},$DataHashRef->{Field4}
.
#-- end of format: first detail line
format REPORTFILE_Detail2 =
ID: @<<<<<< @<< @<<<<<<<<< @<<<<<<<<
@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$DataHashRef->{Field5},$DataHashRef->{Field6},$DataHashRef->{Field7},$DataHashRef->{Field8},$DataHashRef->{Field9}
.
#-- end of format: second detail line
format REPORTFILE_SkipLine =
.
#-- end of format: skip line (double spacing)
#-----------------------------------------------------------------------
#-- If you only have 1 format for detail printing, then there is no need
#-- for the following logic. This logic is only needed if you use
#-- multiple formats for printing to one file handle.
#-- write first detail print line.
$OldFileHandle = select(REPORTFILE); # change to correct handle
$~ = 'REPORTFILE_Detail1'; #-- change the format used for printing
write REPORTFILE;
#-- write second detail print line.
$~ = 'REPORTFILE_Detail2'; #-- change the format used for printing
write REPORTFILE;
#-- write blank print line between print groups.
$~ = 'REPORTFILE_SkipLine'; #-- change the format used for printing
write REPORTFILE;
select($OldFileHandle); #-- restore default file handle.
-- Bill
-----------------------------------------------------------------------
Bill Cowan <billc@tibinc.com> Voice:919-490-0034 Fax:919-490-0143
Tiburon, Inc./3333 Durham-Chapel Hill Blvd Suite E-100/Durham, NC 27707
------------------------------
Date: 28 Apr 1997 09:27:13 -0700
From: mcravit@shell3.ba.best.com (Matthew Cravit)
Subject: Re: Need Help making random number!
Message-Id: <5k2j51$8jf@shell3.ba.best.com>
In article <01bc52c5$58ea0d20$4571e8cb@Kornet.soback.kornet.nm.kr>,
=E@gH#(Jake Shin) <netj@nuri.net> wrote:
>Hi All?
>
>I'm trying to make randomized number.
>but I don't know the method.
The Perl Journal (an excellent magazine) has an article on their web
page about random numbers.
<URL:http://orwant.www.media.mit.edu/tpj/contest-random>
/MC
--
--
Matthew Cravit, N9VWG | Experience is what allows you to
E-mail: mcravit@best.com (home) | recognize a mistake the second
mcravit@taos.com (work) | time you make it.
------------------------------
Date: Mon, 28 Apr 1997 17:02:10 +0100
From: Alastair Aitken <a.aitken@unl.ac.uk>
Subject: Re: Need help with Perl
Message-Id: <3364CA02.1DA4@unl.ac.uk>
Mehdi Beygi wrote:
>
> I am new to Perl and would appreciate to get help with
> a Perl problem.
>
> Problem: I want to run a process and redirect STDOUT to a file.
> for example how to do:
> in C-Shell: ls -l > myfile in Perl: ???
>
> I know I can do domething like this:
> system("ls -l > myfile");
> but what I do is a bit more complex and this does not quite work.
> I basically start a process in which I get user's input from
> <STDIN> and save it to MyFile. Then I start another process and
> set up an input filter and redirect the output of this process to
> another MyFile2 (or append to a MyFile) and finally I want
> to read MyFile, MyFile2 and mail it to an address.
> When I read MyFile2 it is empty. Although after the Perl program
> is finished when I look at the file it has new data. It seems
> like my program terminates while the other process has not yet finished.
> I tied to add a pause to allow the second process to finish but that
> did not work either.
>
> #********************** Mail Info Script *****************************
> print "Print your message\n";
> print "> ";
> $eof = ".\n";
> open(DESCFILE, ">desc");
> $line = <STDIN>;
>
> if ($line eq $eof) {
> print DESCFILE "No Comment\n";
> } else {
> print DESCFILE $line;
> while($line ne $eof) {
> print "> ";
> $line = <STDIN>;
> print DESCFILE $line;
> }
> }
>
> close(DESCFILE);
> # start dbx process
> system("perl dbxit >> desc");
> #system("sleep 5");
> &mail_data;
>
> sub mail_data {
> open(DESCFILE, "desc") || die "could not open file: core_desc";
> open (MAIL, "|mail mjb@voodoo");
> while ($line = <DESCFILE>) {
This kills DESCFILE, $line is empty at this point and you just set the
filehandle to be empty too, use:
while ($line eq <DESCFILE>) {
> print MAIL $line;
> }
> close(MAIL);
> close(DESCFILE);
> 1; # return value is TRUE
> }
>
> #**************************dbxit scipt ******************************
>
> # open dbx as a file and initiate commands to look at stack
> open(DBX, "|dbx myexe my_core");
> print DBX "where\n";
> print DBX "quit\n";
> close(DBX);
>
> --
> mjb thanks you
------------------------------
Date: Mon, 28 Apr 1997 23:42:32 +0200
From: Luca Passani <passani@eunet.no>
To: "Nathan V. Patwardhan" <nvp@shore.net>
Subject: Re: Network Programming and Sockets
Message-Id: <336519C8.2898@eunet.no>
[mailed and posted]
Nathan V. Patwardhan wrote:
> I wonder if
> : 2) The Camel shouldn't explain more about how the server and the client
> : really work in the examples. This could turn out to be an introduction
> : to Network programming for many.
>
> Many people should try to understand things before attempting to bang
> something out. There are a number of resources around and about to
> learn about network programming. I prefer the TV Guide. :-)
If this logic was the one with which Perl was originally created, it
wouldn't be as widespread as it is today.
Perl is useful because it's simple when you have to do simple things,
yet it allows you to make more and more complex things as your
knowledge improves.
On the other hand, I don't think this is the case with network
programming, which really requires a lot of understanding before you can
do simple things.
Maybe I'm wrong, but I think that the difference is that defaults are
not used as they are elsewhere in Perl.
BTW if you have a resource which explains TCP/IP programming without
giving me tons of C code, I would be glad to access it.
Regards
Luca
------------------------------
Date: 28 Apr 1997 12:00:45 -0400
From: Mike Campbell <mcampbel@tvmaster.turner.com>
Subject: Re: Notice to antispammers
Message-Id: <r5k9lnjfwy.fsf@tvmaster.turner.com>
carroll@tjc.com (Terry Carroll) writes:
> People who use invalid email addresses to thwart spammers have made
> a decision to shift their problem of wanting to avoid spam from
> themselves to the persons who want to legitimately correspond with
> them. They have decided that the inconvenience to spammers
> outweighs the inconvenience to legitimate users, and they have
> decided on this without regard to the legitimate users.
As well they should. Like my telephone, my email is a convenience for
_me_, not for those wishing to correspond with me. I screen my phone
calls too, for precisely that reason.
(As this isn't perl-related anymore, followups trimmed, and a reply-to
given.)
------------------------------
Date: 28 Apr 1997 23:44:19 +0900
From: Jacques GARRIGUE <garrigue@safran.kurims.kyoto-u.ac.jp>
Subject: Re: Object IDs are bad (was: Ousterhout and Tcl lost the plot with latest paper)
Message-Id: <l2ohazp5q4.fsf@safran.kurims.kyoto-u.ac.jp>
Chris.Bitmead@alcatel.com.au (Chris Bitmead uid(x22068)) writes:
> ark@research.att.com (Andrew Koenig) writes:
>
> > > In the tree example that you started with, what is wrong with just
> > > passing round the whole subtree so that it can be compared with as
> > > necessary? Any reasonable implementation will only be passing round a
> > > pointer so you lose nothing.
> >
> > Because it will compare equal with any other subtree that happens to
> > have the same structure, which is not what I want.
>
> So all you have to do is generate a unique name for each node, right?
> Just an incremental number perhaps.
All languages are equivalent, so there is certainly a way to encode
any language in another. But this is not the point here. The point is
that physically those trees are represented by pointers, and the
question is whether you should be able to access this pointer in some
way or not. In terms of efficiency, there is a difference.
Remark that being able to acceed a pointer is not anecdotical. For
instance, being able to compare physically pointers with < or > means
restrictions on the garbage collector, that should keep these
inequalities when moving values around. Most GC's don't. C's pointer
arithmetic is even worse. On the other hand, GC's do keep pointer
identity. So being able to compare pointers for == and != should not
be so harmful. This is a constraint for the language: pointer identity
should be defined in some way, and some abstract operations might
become invalid.
It seems that SML chose not to allow pointer comparisons (you have to
explicitely buld a ref), while CAML does allow them (== and != do
compare pointers, not values, those being compared with = and
<>). This may be seen as a question of taste. I prefer the last one,
since anyway ML is a strict language, and all implementations that I
know of do satisfy the requisite to make it meaningful. But people may
prefer to be forced to write thing in a functional way, and not be
implementation dependent. By the way, since most implementations of
SML do allow you to make unsafe casts, you can perfectly convert your
trees to integers, and then compare them!
Finally, all this is a problem of how far a language is specified. C
is specified to such a level that you cannot touch anything without
observable change. Abstractly specified language allow potentially a
lot to the implementation, but this is rarely used. In the middle,
languages like Lisp, Scheme and CAML, allow almost anything to the
user, while defining what is unsafe, to give more power to the
implementation.
Also, do not criticize a paradigm based on properties of a
language. This is only an instance of this paradigm, and other
instances may have other properties. Finally, you choose your language
based on the paradigm and the properties you like to have.
Jacques
---------------------------------------------------------------------------
Jacques Garrigue Kyoto University garrigue@kurims.kyoto-u.ac.jp
<A HREF=http://wwwfun.kurims.kyoto-u.ac.jp/~garrigue/>JG</A>
------------------------------
Date: Mon, 28 Apr 1997 21:59:59 +0100
From: Ian <pirc@pirc.demon.co.uk>
Subject: OLE and Perl:Memory management
Message-Id: <IRjZNAAP$QZzEwdM@pirc.demon.co.uk>
Hi there,
The following question is based on Perl 5.3_007, NT 4.0
Has anyone out there come across the following problem?
When creating an OLE object in Perl (e.g. to Word 97), one issues
a command of type:
$word = CreateObject OLE 'word.application'
>From that moment onwards, any OLE call to Word eats more memory. This
memory isn't released when $OLE link to Word is destroyed; it is
released only when the perl command interpreter returns control to NT.
The process loops around, reading the word document of 103000 characters
one character at a time.
It sets a Range Object using a command of type
$word->ActiveDocument->Characters($i,$i)->Text
It seems to make no difference if I try and clean-up the references
or not.
Monitoring the memory processes using NT's resource manager shows that
memory usage only ever increases.
Has anyone come across similar such behaviour using Perl and OLE; if so,
any ideas of how I can stop the memory leak?
Thanks.
--
Ian
------------------------------
Date: 28 Apr 1997 19:53:42 GMT
From: ljw1004@cus.cam.ac.uk (L.J. Wischik)
Subject: Re: Ousterhout and Tcl lost the plot with latest paper
Message-Id: <5k2v86$e2@lyra.csx.cam.ac.uk>
>>The button example requires about 25 lines of code in three procedures
>>when implemented in C++ with Microsoft Foundation Classes. Just
>>setting the font requires 7 lines of code: ...
>
>>Come on! All this shows is the inconveniece of using the MFC
>>classes. An interface exactly the same as the Tcl one could easily be
>>written in C++.
>
>I invite anyone who believes this to try to do it, and post the results.
>I've had this argument before, and when people do this, one of two things
>happens: either they eventually concede that this is hard to do in C++, or
>they define new C++ APIs that are essentially untyped (e.g. they use
>strings for everything).
I think this is a silly debate. You could write it in C++Builder, and
select the button in the integrated development environment, and click on
the 'font' button, and select a font for it graphically, without any lines
of code. So what?
--
Lucian Wischik, Queens' College, Cambridge CB3 9ET. ljw1004@cam.ac.uk
------------------------------
Date: Mon, 28 Apr 1997 15:02:26 +0100
From: Alastair Aitken <a.aitken@unl.ac.uk>
Subject: Re: Passwork perl
Message-Id: <3364ADF2.2942@unl.ac.uk>
cc wrote:
>
> Hello, I a program that when you write a work in a form, this program ask
> in a database file and if this work ask right pass you, and is not right
> denied pass, the database file is very little.
>
> Thanks for all and sorry by my englihs.
sok :-) .. excuse my perl ...
#! /usr/local/bin/perl -w # or wherever your perl interpreter resides
require 5.003;
use strict;
my (%rqpairs,$rqpair);
require "cgi-handlers.pl";
&get_request;
dbmopen(%QA,"/path/to/dbfile_without_extension",0666);
foreach $rqpair (keys(%rqpairs)) { # $rqpair contains the name of each
form item
if (($QA{$rqpair} && ($QA{$rqpair} eq $rqpairs{$rqpair})) {
print "\n\nBINGO!\n\n";
} else {
print "\n\nARGH!!!!\n\n";
}
}
dbmclose(%QA);
exit 0;
Not tested.
Alastair.
------------------------------
Date: 28 Apr 1997 12:15:06 -0400
From: Mike Campbell <mcampbel@tvmaster.turner.com>
Subject: Re: Perl auto-replier
Message-Id: <r5hggrjf91.fsf@tvmaster.turner.com>
Ronald.J.Kimball@dartmouth.edu (Chipmunk) writes:
> Here's a great idea for a perl script.
> "You moron, look at the perlxxx man pages."
> "You moron, that's not a Perl question, try comp.xxx.xxx.xxx."
> "You moron."
Yeah, calling people "moron" in such a public forum is certainly a
great idea. And parsing English, (or worse, ASCIIbonics), is indeed
very easy to do too.
:-|
------------------------------
Date: 28 Apr 1997 14:13:16 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: pre-RFD: comp.lang.perl.{data-structure,inter-process,porters,regex}
Message-Id: <5k2b9s$njj$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
I-hate-cyber-promo@man.ac.uk writes:
So filter them.
:[[NB: the email address included in the headers is valid, but I've
:started using it in all my posts to Usenet. This way I get to filter
:out most of the spam. Fear not, anything you send to that address with
:/perl/i in the subject line will get to me and will be read.]]
I would like to see more moderation criteria. No promotions,
binaries, html postings, etc.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
"... an initial underscore already conveys strong feelings of
magicalness to a C programmer."
--Larry Wall in <1992Nov9.195250.23584@netlabs.com>
------------------------------
Date: 28 Apr 1997 17:32:15 +0300
From: jari@iki.fi (Jari =?ISO-8859-1?Q?M=E4kel=E4?=)
Subject: Re: pre-RFD: comp.lang.perl.{data-structure,inter-process,porters,regex}
Message-Id: <lchggrjk0g.fsf@ns2.avantcomp.fi>
I-hate-cyber-promo@man.ac.uk (A. Deckers) writes:
> The moderation script could also implement an autofaq mailing to first time
> posters, similar to the one currently implemented in clp.misc. I'm sure
> John Stanley will flame me for suggesting this. :-) (Obviously only one
> moderation site would implement the autofaq feature.)
> An open question is whether this moderation scheme should be extended to
> the existing clp.* groups, namely clp.{modules,tk}. It would probably be
> best if clp.misc remained unmoderated whatever happened.
It would be best if the auto-moderator should autoreject the first
time posters with the politest possible message about what one should
post and to which group and with pointers to a list of
documentation. And if this practice would be used on clp.misc too
maybe we saw less those non-perl postings and there would be no need
for clp.cgi which someone suggested.
Jari
--
Go not to UseNet for counsel, for they will say both `No' and `Yes'
and `Try another newsgroup'.
-- Usenet Rule #17:
------------------------------
Date: 28 Apr 1997 14:51:47 GMT
From: I-hate-cyber-promo@man.ac.uk (A. Deckers)
Subject: Re: pre-RFD: comp.lang.perl.{data-structure,inter-process,porters,regex}
Message-Id: <slrn5m9ebs.pfs.I-hate-cyber-promo@nessie.mcc.ac.uk>
In comp.lang.perl.misc,
tchrist@mox.perl.com wrote:
> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc,
> I-hate-cyber-promo@man.ac.uk writes:
>
>So filter them.
I do. The alias just makes it a lot easier. :-)
[...]
>I would like to see more moderation criteria. No promotions,
>binaries, html postings, etc.
html: can do. I've already implemented this in a regional group I moderate.
Do it by checking the Content-Type: header and rejecting anything that
contains 'html' or 'multipart' (the second one also gets rid of some
binaries).
binaries: ditto, any post containing more than a certain number of
consecutive lines without [ \t] is rejected. In order to allow PGP sigs
through, I set the limit at 100 lines. It's not perfect, but it works
most of the time.
promotions: hmmm... you mean like adverts, job offers, etc.? This gets
into content-moderation, which would require manual moderation to be
robust (a script could probably pick out blatant ones by checking for
keywords/patterns, but this wouldn't work in general).
Anyway, I think that forcing each post to contain a given keyword such as
/perl/i should keep a lot of the crud out. It would incidentally also
eliminate some of the CGI- but not Perl-related questions.
Alain
--
Perl information: <URL:http://www.perl.com/perl/>
Perl FAQ: <URL:http://www.perl.com/perl/faq/>
Perl archive: <URL:http://www.perl.com/CPAN/>
------------------------------
Date: 28 Apr 1997 12:13:27 -0400
From: Mike Campbell <mcampbel@tvmaster.turner.com>
Subject: Re: print <<THIS_PART; won't work
Message-Id: <r5iv17jfbs.fsf@tvmaster.turner.com>
Mark Smith <mark@backlash.net> writes:
> According to my PERL books, this is the way that you need to do it:
>
> print <<'STOP';
> HTML blah blah blah
> STOP
This is _one_ way to do it. Using 'STOP' means that no variables in
the here-doc will get interpolated. Using "STOP" means they will.
Using `STOP` means that the commands in the here doc will get run, and
replaced with their output.
#!/usr/local/bin/perl
$foo = "echo howdy";
print <<'HERE1';
$foo
HERE1
print <<"HERE2";
$foo
HERE2
print <<`HERE3`;
$foo
HERE3
------------------------------
Date: 28 Apr 1997 20:40:48 GMT
From: really_eliot@dg-rtp.dg.com_but_mangled_to_stop_junk_email
Subject: Re: Printing to Files.
Message-Id: <ELIOT.97Apr28164048@kern1.dg.com>
Exactly right. If you're willing to reduce efficiency a little and flush
the buffer upon every print, you could use the $| variable to do so; it's
documented in perlvar(1). (You could also flush the buffer just once, if
you're a little trickier with $|, but in this case it probably doesn't
matter.)
I've wondered about how to flush a file exactly once, and why such an
"fflush" functionality doesn't appear to be part of standard perl.
Care to expand on how to do it with $| ?
Do you just toggle its value back and forth?
Topher Eliot Data General Unix Core Development
(919) 248-6371 eliot at dg-rtp.dg.com
Obviously, I speak for myself, not for DG.
Visit misc.consumers.house archive at http://www.geocities.com/Heartland/7400
"Awesome . . . and super-dee-duper!" Peter, age 5, trying to sound like his
big brother, but not quite making it.
------------------------------
Date: 28 Apr 1997 11:17:57 -0400
From: Joe Marzot <gmarzot@baynetworks.com>
Subject: problem: array assignment to hashref slice
Message-Id: <pdwwpni3bu.fsf@baynetworks.com>
don't know if I'm missing something here
I know I can say
@hash{a,b,c,d} = (1,2,3,4);
but how do I do this with a hashref?
$hashref={};
@$hashref->{a,b,c,d} = (1,2,3,4); # does not work
$hashref->{a,b,c,d} = (1,2,3,4); # nor does this
@hashref->{a,b,c,d} = (1,2,3,4); # nor does this
any ideas? or maybe "ya caahhnt get they-ahh from hee-uh".
-GSM
--
G. S. Marzot <gmarzot@baynetworks.com> Network Management Development
Bay Networks Inc. (508)670-8888 x63990
--
------------------------------
Date: 28 Apr 1997 16:04:33 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: problem: array assignment to hashref slice
Message-Id: <5k2hqh$jp4@pirate.shu.edu>
Hello -
Joe Marzot <gmarzot@baynetworks.com> writes:
>don't know if I'm missing something here
>I know I can say
>@hash{a,b,c,d} = (1,2,3,4);
>but how do I do this with a hashref?
>$hashref={};
>@$hashref->{a,b,c,d} = (1,2,3,4); # does not work
>$hashref->{a,b,c,d} = (1,2,3,4); # nor does this
>@hashref->{a,b,c,d} = (1,2,3,4); # nor does this
>any ideas? or maybe "ya caahhnt get they-ahh from hee-uh".
When in doubt, try as minimal and literal a substitution
of one expression for another as possible. In this case,
you can replace the name 'hash' with a hash reference:
@{$hashref}{qw(a b c d)} = (1,2,3,4);
or
@$hashref{qw(a b c d)} = (1,2,3,4);
(give or take some qw-ing :-)
This is analogous to the syntactical difference between:
%hash
and
%$hashref
David Black
dblack@icarus.shu.edu
------------------------------
Date: 28 Apr 1997 12:21:18 -0400
From: psmith@baynetworks.com (Paul D. Smith)
To: Joe Marzot <gmarzot@baynetworks.com>
Subject: Re: problem: array assignment to hashref slice
Message-Id: <p5afmj6rup.fsf@baynetworks.com>
%% Joe Marzot <gmarzot@baynetworks.com> writes:
jm> I know I can say
jm> @hash{a,b,c,d} = (1,2,3,4);
jm> but how do I do this with a hashref?
This works for me:
@{$hashref}{a,b,c,d} = (1,2,3,4);
--
-------------------------------------------------------------------------------
Paul D. Smith <psmith@baynetworks.com> Network Management Development
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
These are my opinions--Bay Networks takes no responsibility for them.
------------------------------
Date: 28 Apr 1997 15:42:45 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Problem: hex() and Unsigned vs. Signed
Message-Id: <5k2ghl$h5r@lyra.csx.cam.ac.uk>
Eric Magnusson <emagnuss@mcd.intel.com> wrote:
>I added some new entries in the table showing more inconsistent and
>erroneous behavior for
>hex() with unsigned numbers. Any help in figuring out this problem or
>identifying a
>bug fix would be appreciated.
>
>-Eric
A number of bugs have been mended since perl 5.003 relating to bit
operations, sign bits etc. Here is your table updated according to
the Perl 5.004beta (perl5.003_93):
#----+----+
# +2G| -2G|
#----+----+
$x = hex("80"); # # #
>0( $x << 24 ); # 45 # #
#----+----+
$x = hex("80"); # # #
>0( $x * 0x1000000 );# 45 # #
#----+----+
>0( hex("80") << 24 ); # 45 # #
#----+----+
>0( hex("80") * 0x1000000 );# 4 # 5 #
#----+----+
>0( 0x80000000 ); # 45 # #
#----+----+
>0( hex("80000000") ); # 45 # #
#----+----+
>0( 0x80 * 0x1000000 ); # 45 # #
#----+----+
>0( 0x80000000 << 24 ); # # 45 #
#----+----+
>0( 0x80 << 24 ); # 5 # 4 #
#----+----+
sub gt0 {
print "", (0 < $_[0]) ? "Positive\t" : "Negative\t";
}
So it's a bit better, but probably not entirely right.
I've passed this info to perl5-porters.
Mike Guy
------------------------------
Date: Mon, 28 Apr 1997 17:37:51 +0200
From: Sascha Teske <slash@deil.de>
To: Tad McClellan <tadmc@flash.net>
Subject: Re: raw input
Message-Id: <3364C44F.6E9A3616@deil.de>
Tad McClellan wrote:
>
> Chipmunk (Ronald.J.Kimball@dartmouth.edu) wrote:
> : In article <5jpui7$q3b@info.abdn.ac.uk>
> : junkmail@sysa.abdn.ac.uk (Kyzer) writes:
>
> : > Sascha Teske, while smelling of fish, wrote:
> : > : I have a Problem i want to write an more intelligent chat and want to
> : > : use perl is there a way to get data before or without a newline "amen" ?
> : > : don't say RTFM to me, I DID !!!
> : >
> : > Perl keeps newlines because it hsn't been told not to.
> : > The easiest way to fix it is:
> : >
> : > $my_string_with_newline = "Hello wurld\n";
> : >
> : > chop($my_string_with_newline); # now it's "Hello wurld" no newline
>
> : That's a good way to remove newlines (chomp is better, if you have
> : perl5)
> : but that's not what Sascha asked about. The problem is how to get data
> : without having to wait for a newline.
>
> : I'd offer a suggestion here, but I haven't a clue how to do it. ;-)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> read() or sysread() ?
>
> --
> Tad McClellan SGML Consulting
> Tag And Document Consulting Perl programming
> tadmc@flash.net
Can you give me an example so that i can see how to use
read()||sysread()
it could help me
slash@deil.de
------------------------------
Date: 28 Apr 1997 14:48:16 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: References in foreach loop variable
Message-Id: <5k2dbg$e3o@lyra.csx.cam.ac.uk>
David Alan Black <dblack@icarus.shu.edu> wrote:
>If it were a glob reference:
>
>$i = \*foo;
>
>then you'd get "123" again - but, as in the third example, the
>assignment would be to $foo.
That's not _quite_ right. Trying
$i = \*foo;
foreach $$i (1..3) { print $$i };
prints
*main::foo*main::foo*main::foo
whereas
$i = \*foo;
foreach $$i (1..3) { print $$$i };
prints
123
Perhaps you can explain that - I can't.
Mike Guy
------------------------------
Date: Mon, 28 Apr 1997 16:00:21 +0100
From: Douglas Seay <seay@absyss.fr>
To: C Carr <clint@netcom.com>
Subject: Re: Removing 2 or more spaces ?
Message-Id: <3364BB84.4448F4B4@absyss.fr>
[posted and mailed]
> Is there a quick way to remove two or more spaces in a variable?
remove? or chop down to just a single space? and when you say "space",
do you mean just the blank character, or were you thinking about tabs
and whatnot? and if you chop down to a single character, which one?
the first? the last? always a space?
with all that said, what I think that you want would be one of
$var =~ s/(\s)\s+/$1/g; # keep first
$var =~ s/\s{2,}/ /g; # use space
but what you asked for would be more like
$var =~ s/ {2,}//g;
- doug
------------------------------
Date: Mon, 28 Apr 1997 17:06:29 +0100
From: Alastair Aitken <a.aitken@unl.ac.uk>
Subject: Re: Run UNIX commands
Message-Id: <3364CB05.47F4@unl.ac.uk>
William Krige wrote:
>
> Hi all
>
> I was wondering if it is possible to run a command with a perl script,
> just like you would normally do with UNIX.
> e.g last root
> tail -f /usr/adm/syslog/syslog.log | grep "Thu 18"
>
> How would you run a commands like the ones above in perl, if it can be
> done.
exec(), system() or backticks. Courtesy of
http://www.perl.com/perl/nmanual/pod/perlfaq.html
Alastair.
------------------------------
Date: 28 Apr 1997 14:04:23 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: unpack() problem: bug, or just me?
Message-Id: <5k2ap7$c15@lyra.csx.cam.ac.uk>
E. <erisson@kallisti.sw-tech.com> wrote:
>Please, tell me this is a bug. Or, failing that, tell me where the
>glaring error that I cannot see is. Please.
Yep, it's a bug in perl5.003. Dunno exactly what, but it's mended in the
Perl 5.004beta, available from a CPAN near you as perl5.003_93.
Mike Guy
------------------------------
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 386
*************************************