[6707] in Perl-Users-Digest
Perl-Users Digest, Issue: 332 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 21 07:07:07 1997
Date: Mon, 21 Apr 97 04:00:21 -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, 21 Apr 1997 Volume: 8 Number: 332
Today's topics:
Re: -e switch (Greg Bacon)
Re: -e switch <jhi@alpha.hut.fi>
Re: <A HREF=script.pl?page.html> (ALASTAIR AITKEN CLMS)
bug or feature ("my" semantics)? (York Werres)
bug or feature (tied scalars)? (York Werres)
Delete List Element <christop@ozinter.co.jp>
Filename Wildcard Command-line Interpolation mwise@tzl.de
Re: hard carriage return problem (YorSpecial)
Re: Lisp is neither (was Re: Ousterhout and Tcl lost th (Marc Wachowitz)
Re: Lisp is neither (was Re: Ousterhout and Tcl lost th <erik@naggum.no>
Re: Lisp is neither (was Re: Ousterhout and Tcl lost th (Rainer Joswig)
New to Perl and Loving it (YorSpecial)
Re: perl and multithreading (Malcolm Beattie)
Re: Universal scripting interfaces (Was: Ousterhout and (Cyber Surfer)
Re: Would like to test cgi-scripts offline. (YorSpecial)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 20 Apr 1997 19:13:33 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
To: Bill Banyai <banyai@llnl.gov>
Subject: Re: -e switch
Message-Id: <5jdpst$3ff$2@info.uah.edu>
[Posted and mailed]
In article <335A64CD.7FF@llnl.gov>,
Bill Banyai <banyai@llnl.gov> writes:
: When I enter: perl -e 'print("hello\n");'
: I see a blank line and then a c:\ on the next line; e.g.
: c:\ perl -e 'print("hello\n");'
:
: Any ideas about why -e is not working?
:
: Another clue is that when I enter perl -e 'print "hello\n";'
: then I received an error message:
: "Can't find string terminator "'" anywhere before EOF at -e on line 1."
: It appears to be sensitive to the space between print and "hello\n"
It's because of COMMAND.COM's unuseful ^H^H^H^H^H^H^H^H^H way of quoting.
To use -e, you'll want to do something like
perl -e "print(\"Hello, world!\");"
Of course, the parens are unnecessary.
Greg
--
Greg Bacon <gbacon@cs.uah.edu>
Unix / Perl Consultant
Perl Institute Partner - http://www.perl.org/
------------------------------
Date: 20 Apr 1997 22:18:40 +0300
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: -e switch
Message-Id: <oee2085qz8v.fsf@alpha.hut.fi>
> Any ideas about why -e is not working?
Yeah. You haven't read the Perl FAQ.
http://www.perl.com/CPAN/doc/FAQs/PerlFAQ.html
Search for "one-liner".
--
$jhi++; # Jarkko Hietaniemi <URL:http://www.iki.fi/~jhi/>
# Each is given a bag of tools, A shapeless mass, A book of rules;
# And each must make Ere life is flown--A stumbling-block Or a stepping-stone.
------------------------------
Date: 21 Apr 1997 09:54:29 GMT
From: zpalastair@unl.ac.uk (ALASTAIR AITKEN CLMS)
Subject: Re: <A HREF=script.pl?page.html>
Message-Id: <5jfdgl$f6f@epsilon.qmw.ac.uk>
In article <01bc4ba4.5732d480$44c4cfcf@sholmes.eclipse.net>, "Scott Holmes" <sholmes@eclipse.net> writes:
>I want to generate a simple script that spits out a customized html page
>without using an HTML form. I've seen a link like this used elsewhere (<A
>HREF=script.pl?page.html>). I've been playing around with it, but have
>been unable to successfully parse and pass the 'page.html' value into the
>body of the script. Any help would be appreciated.
$ENV{'QUERY_STRING'} contains everything after the "?" in the *URL. Just use
this in your script. This is standard CGI behaviour.
Alastair.
------------------------------
Date: Mon, 21 Apr 1997 10:45:54 GMT
From: werres@informatik.uni-bremen.de (York Werres)
Subject: bug or feature ("my" semantics)?
Message-Id: <335b454b.1019216@news.informatik.uni-bremen.de>
Hi,
is this a bug or a feature ("my" semantics in 5.002):
sub strange {
my $x = 1;
sub { my $y = 2; sub { print $x, $y; } }
}
&{ &{ &strange } }; # prints 2
sub very_strange {
my $x = 1;
sub { my $y = 2; my $x = $x; sub { print $x, $y; } }
}# ^^^^^^^^^^^
&{ &{ &very_strange } }; # now it prints 1
sub extremely_strange {
my $x = 1;
sub { my $y = 2; my $z = $x; sub { print $z, $y; } }
}# ^^^^^^^^^^^
&{ &{ &extremely_strange } }; # prints nothing at all!
sub workaround {
my $x = 1;
sub {
my $y = 2;
&{+sub{my($x,$y)=@_; # <-- this line for workaround
sub { print $x, $y; }
}}($x,$y); # <-- and this line, too
}
}
&{ &{ &workaround } }; # prints 12 (ok)
Will 5.004 still require this workaround? (It puts the free
variables into the same lexical layer.)
Note that this isn't esoteric nonsense. Just take the SCHEME-line
(define a (let a ((b 1)(c 2)) (write b) (write c) (lambda () (a b c))))
It translates to:
$a = &{ my $a; $a = sub { my ($b, $c) = @_;
print $b, $c;
&{+sub{my($a,$b,$c)=@_; # <--- same workaround
sub { &$a($b, $c) }
}}($a,$b,$c) # <--- is required here
} } (1, 2); # prints 12
I have one more question on this matter: In a book about a one-hump
dromedary I found on p.120 the lovely promise of making @_ "lexically
scoped someday". Of what use would that be? Wouldn't @_ be hidden by
inner subs anyway?
Oh, and a fourth question: Why is the '+' necessary in the workaround?
21.04.97 -- York.
--
werres@informatik.uni-bremen.de (PGP key available)
http://www.informatik.uni-bremen.de/~werres
------------------------------
Date: Mon, 21 Apr 1997 10:44:08 GMT
From: werres@informatik.uni-bremen.de (York Werres)
Subject: bug or feature (tied scalars)?
Message-Id: <335b4288.311845@news.informatik.uni-bremen.de>
Hi,
is this a bug or a feature (tied scalars in 5.002):
tie $q, 'Q';
$q = [1, 2];
print $q->[0]; # prints 1
print $q->[1]; # prints 3
print $q->[0], # prints nothing
$q->[1]; # prints 3
print "$q->[0]$q->[1]"; # prints 3
print "$q->[0] $q->[1]"; # prints 1 3
package Q;
sub TIESCALAR { my $t; bless \$t; }
sub STORE { my $t=shift; $$t = shift; }
sub FETCH { my $t=shift; [$$t->[0], $$t->[1] + 1] }
21.04.97 -- York.
--
werres@informatik.uni-bremen.de (PGP key available)
http://www.informatik.uni-bremen.de/~werres
------------------------------
Date: Mon, 21 Apr 1997 19:13:03 +0900
From: "christop@ozinter.co.jp" <christop@ozinter.co.jp>
Subject: Delete List Element
Message-Id: <335B3DAF.54D@ozinter.co.jp>
It took a while but my next question for the wise has appeared:
If I have (an) %array that looks like this:
row1=>[1,2,3,4],
row2=>[5,6,7,8]
and I want to delete row2; do I say
delete($array{'row1'})
for this is what I'm trying to not much success, though I'm not sure if
the not much success element comes from a bug somewhere else, hence my
asking for assistance again..
Thanks; we're getting there (slowly)
Christopher
http://www.wonderlandinorbit.com
------------------------------
Date: Mon, 21 Apr 1997 05:41:06 -0600
From: mwise@tzl.de
Subject: Filename Wildcard Command-line Interpolation
Message-Id: <861618134.9000@dejanews.com>
While reading a note by Saul Cozens in which he said:
>
>I wish to pass a filename which includes a wildcard to my Perl script.
>
> my_script.pl a_file*.ext
>
>this, as you might already realise, produces an array @ARGV which
>contains every filename matching a_file*.ext (ie a_fileA.ext,
a_fileX.ext,
>etc). Which is not what I want.
>
I noticed that Eric Grote replied:
>
>I'm afraid that there's no way to avoid some kind of quotes (single
> or double). It's because before a script in a shell is really
> executed the shell (I assume you are using some kind of UNIX ...)
> does filename interpolation (extending all '*' and '?' to lists
> of names) and the only way to prevent the shell from doing this is
> (as far as I know) using quotes.
>
At first I swallowed this, now I am wondering if it is really true. Surely
grep wouldnt work if this were the case now, would it? Or am I missing
something here?
And I dont see why Win32 Perl should behave this way either, the shell
doesnt do filename interpolation there.
Can some one enlighten me here? I too would like to write a script that
takes a wildcard, and I really dont want to quote the argument, or
backslash the asterixes.
thanks in advance,
mike wise
mwise@tzl.de
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 20 Apr 1997 08:39:04 GMT
From: yorspecial@aol.com (YorSpecial)
Subject: Re: hard carriage return problem
Message-Id: <19970420083901.EAA12670@ladder01.news.aol.com>
James,
If this is for a web page, then use the html tag <P>. That works in a web
server instead of \n.
The actual PERL for this is:
print "whatever your text<P>";
That should work.
Bruce Chamoff
http://www.ysd.com
If you want it, now is the time to get it
------------------------------
Date: 20 Apr 1997 08:28:14 GMT
From: mw@ipx2.rz.uni-mannheim.de (Marc Wachowitz)
Subject: Re: Lisp is neither (was Re: Ousterhout and Tcl lost the plot)
Message-Id: <5jck2u$ce9$1@trumpet.uni-mannheim.de>
Scott Schwartz (schwartz@galapagos.cse.psu.edu.NO-SPAM) wrote:
> Erik Naggum <erik@naggum.no> writes:
> | ANSI Common Lisp, and even Common Lisp the Language, 2nd edition, specify a
> | language that is, in practice, _routinely_ compiled to code as fast as C,
> | often faster because Common Lisp programmers use better algorithms and have
> | more time to optimize where it is needed than C programmers.
> The catch, as you well know, is that those implementations also have
> huge, expensive runtime systems and slow startup times, so to be
> usable you have to live inside them.
If there was sufficient relevant interest to produce a Common Lisp with
a very small first-time startup (further runs of the free CMU Common Lisp
don't take any humanly noticable time even on my old 486 Linux system),
that wouldn't be technically difficult at all; it just doesn't appear to
be an important goal so far. As a typical Lisp system does already have
facilities to load compiled code dynamically, it could also defer the
loading of major parts of the integrated development system and libraries
until they are needed, or factorize those facilities into shared libraries.
> On this topic, you yourself have
> argued that the lisp repl should be one's shell and that it should be
> judged in that context. While that might be to your taste, you should
> acknowledge that it is totally at odds with how things are done in the
> (much nicer) underlying system, and pretty much proves Ousterhout's
> point.
You may find that much nicer, but there are also excellent reasons
why many members of the Lisp community have been preferring the usage
of Lisp as the center of their work. A good implementation of Common
Lisp is so powerful and expressive that one misses something almost
all of the time when working with a less integrated (but at most merely
assembled) system with those primitive "shells". Sure, there are also
arguments for the "part assembly" model, which could be nice if done
really well (however, usually it's crippled) - but don't misinterpret
pressure of stupid mainstream market tendencies as technical arguments.
-- Marc Wachowitz <mw@ipx2.rz.uni-mannheim.de>
------------------------------
Date: 20 Apr 1997 19:13:51 +0000
From: Erik Naggum <erik@naggum.no>
Subject: Re: Lisp is neither (was Re: Ousterhout and Tcl lost the plot)
Message-Id: <3070552431069683@naggum.no>
* Henry Baker
| Two words: 'Lisp Machine'.
* Mike Pinkerton
| Oh, yeah, and that was successful. I've got a friend with a Symbolics
| machine he uses as a table.
well, I for one expected this response.
do you remember the IBM PC? a friend of mine claims he uses one as an
anchor. was it successful? how about any of the current crop of hardware
and software that is claimed, by the vendors themselves, to be useless and
unsupported and that you should never buy them? (ask your favorite PC
salesdroid for a 386 with 4M RAM, a VGA card, 40M of disk, and whatever
MS-DOS version just preceded Windows, including Word Perfect 4.0 or
whatever it was. then listen to the way he describes this once great
solution. look at how the PC magazines describe their own progress.)
the Lisp Machines died for reasons totally unrelated to quality. actually,
they died for the same reason that mind-bogglingly inferior systems won.
the answer is a single word: "marketing". this is the one concept that
John Ousterhout has learned from history. and very little else, it seems.
the Lisp Machines are still highly respected for their design and usability.
such will not happen to today's mass-marketed computers ten years hence any
more than it happens to their progenitors of ten years ago.
#\Erik
--
Bastard Sex Therapist From Hell: "Read The F*cking Manual!"
------------------------------
Date: Sun, 20 Apr 1997 22:08:01 +0200
From: joswig@lavielle.com (Rainer Joswig)
Subject: Re: Lisp is neither (was Re: Ousterhout and Tcl lost the plot)
Message-Id: <joswig-ya023180002004972208010001@news.lavielle.com>
In article <mpinkert-2004971242230001@fire.cc.gatech.edu>,
mpinkert@cc.gatech.edu (Mike Pinkerton) wrote:
> In article <hbaker-2004970914430001@10.0.2.1>, hbaker@netcom.com (Henry
> Baker) wrote:
>
> >Two words: 'Lisp Machine'.
>
> Oh, yeah, and that was successful. I've got a friend with a Symbolics
> machine he uses as a table.
I got two in my office. Working. Daily. Cool.
--
http://www.lavielle.com/~joswig/
------------------------------
Date: 20 Apr 1997 08:52:49 GMT
From: yorspecial@aol.com (YorSpecial)
Subject: New to Perl and Loving it
Message-Id: <19970420085201.EAA13072@ladder01.news.aol.com>
I was a web designer and have designed over 40 web sites in the past 18
months. But with the disturbingly large handful of people out there who
have jumped on the HTML bandwagon, the money for web design just is not
there, anymore. Either these people learn HTML or buy one of the web page
editors on the market and it just burns me up.
I am grateful that PERL is real programming and especially glad that most
web designers don't know how to program. Now, I am marketing my business
to web designers to do CGI scripts for their web design clients. I can
charge large hourly rates again.
I want to know if anyone is doing the same thing and what you are charging
to other web designers. I have 3 clients who are web designers and I
charge them $50 per hour. Then, they can simply mark up my price and pass
it on to their clients. Is this a good price or is it too low? What are
some of you out there charging either per hour or per script?
Bruce Chamoff
http://www.ysd.com
------------------------------
Date: 20 Apr 1997 11:23:21 GMT
From: mbeattie@sable.ox.ac.uk (Malcolm Beattie)
Subject: Re: perl and multithreading
Message-Id: <5jcub9$skd@news.ox.ac.uk>
In article <rsmithE8t0uH.IF1@netcom.com>,
Richard S. Smith <rsmith@netcom.com> wrote:
>I want to thank the people who replied to my query. I know a lot more
>about threads now than I did 24 hours ago...
>
>This thread (is this word overloaded? ;-) raises some interesting
>questions...
>
>1. When 5.005 comes out, will there be a call like fork() to create
> threads? I've heard that some implementations use a clone() call.
There's still some uncertainty as to whether there's enough new
stuff scheduled to make a 5.005 and a 5.006. For example, if it turns
out that enough new features are ready to release before the threading
stuff is ready to turn on, then a 5.005 may come out first. Either
way, it's just numbering and it won't affect (much) how long it takes
to get out a proper release of a multi-threading perl.
>2. Will Solaris users be able to choose Solaris threads over Posix during
> the installation process?
For installation, I don't see the point. The current thread.h supports
the POSIX API which should built fine under Solaris. I don't think that
recoding the API macros for the sake of it would gain much. I assume
that both APIs map properly to the underlying Solaris LWP model.
>
>3. Will it be up to the Perl programmer to deal with things like mutex
> locks or will the Perl implementors find a clever abstraction to hide
> them behind? (Or both?)
Both. There will be an explicit API for synchronisation primitives
but there are some places where it looks as though perl might be able
to handle things automagically. The current programmer API for a
mutex-like-thing is
lock($foo);
which can be applied to any variable: it upgrades it to have "mutex
magic" and initialises the mutex (if necessary) and then tries to
gain a lock on $foo. It acts like a recursive mutex so the same thread
can gain it multiple times without trouble. The lock is released
automatically at the end of the scope (so no more forgetting to unlock
a mutex before each return of a function). A method function can get
the effect of a Java "synchronised" method (i.e. a lock for the object
argument) by doing
sub mymeth {
my $self = shift;
lock(@$self);
...
}
The mutex magic also will include a condition variable too so that
you can
lock($foo);
cond_wait $foo while @bar == 0;
return shift @bar;
There will be enough appropriate primitives to build any higher
level sync features that you want. The details of the internal
implementation of some of the more esoteric features are still in
discussion but the basics are there are work.
>4. Will it be transparent across Unix<-->NT? (That would be a major win!)
The internal threading primitives are implemented with a small set
of abstracted-out macros that should be fairly easy to rejig for
any decent C threading API. The people that "do MicroSoft" are
planning to do the relevant coding.
>5. What about debugging?
That might depend greatly on the platform unless somebody manages to
do something clever with ther perl debugger.
>It looks like as of now there is no language other than C/C++ that gives
>people robust access to threading. Python sort of does it if you are
>clever and keep up with all the latest traffic on comp.lang.python.
>
>Java suppossedly does it, except it seems to me that you are threading
>within the "java virtual machine" which would tend to negate the
>performance gains that threads buy you.
No. Java uses a real underlying threads implementation.
--Malcolm
--
Malcolm Beattie <mbeattie@sable.ox.ac.uk>
Oxford University Computing Services
"Widget. It's got a widget. A lovely widget. A widget it has got." --Jack Dee
------------------------------
Date: Mon, 21 Apr 1997 11:38:59 +0100
From: cyber_surfer@gubbish.wildcard.demon.co.uk (Cyber Surfer)
Subject: Re: Universal scripting interfaces (Was: Ousterhout and Tcl lost the plot with latest paper)
Message-Id: <MPG.dc552b8f2907cc798978b@news.demon.co.uk>
With a mighty <19970420.40022388.FA37@contessa.phone.net>,
bouncenews@contessa.phone.net uttered these wise words...
> I don't think this is a language-specific solution. After all, you can
> use _any_ language that can be compiled to Java bytecodes. Java was
> the first one. Last time I looked, people were talking about or
> working on Java bytecode compilers for Python, Scheme and Perl. There
> are problably others as well.
>From the discussions that I've read about compiling languages that use
features like closures, tail recursion, continuations, etc to JVM
bytescodes, you might think that there's at least a language bias.
Personally, I'm not worried about a little loss of performance, as
long as it's _possible_.
My point about ActiveX Scripting is that there's _no_ language bias at
all, so even those people who worry about a small loss of performance
(obsessive bean counters or realists?) will be happy. We don't need to
use every language to write MPEG drivers, so I don't think that we
need to judge every language by that standard - even if some people
will. Either these people really believe that there's no difference
between an MPEG driver and any other software, or they're just trying
to convince us that we should all be using assembly language and C.
> If all you give them is JVM binaries, why should they CARE what the
> source language was? I have as yet to run into a user who really
> cares whether a program was written in C, Scheme or Perl. I've seen a
> few who complain that the programs are to big and blame it on the
> implementation language, but they are a minority (and usually wrong
> anyway).
I agree with you about this, which is why I'm not talking about the
language used to write the app, but the scripting language, or even
the means by which a user may choose the language in which to write
scripts to extend an app.
> If you believe the Gabriel paper you referenced, technical suepriority
> doesn't count. Personally, I believe the paper, and further believe
> that marketing counts for far more than technical superiority once
> you've reached the "good enough" level described in my paper.
My experience is that most people don't care about what we like to
call "technical superiority", as they only want an app that performs a
useful task, at a reasonable price. This may be why marketing is such
a powerful factor in deciding what succeeds and what fails.
> Believing that technical superiority counts left me with lots of
> orphans.
It's also a very subjective issue. Jonathon Swift made an excellent
point about what I call "egg orientation". It's a lesson that I
learned at an early age, but it's the "advocacy" threads here on
UseNet (and elsewhere) that've taught me that it's not just an amusing
story for children. It's also a painful lesson for adults.
These days, I prefer my eggs fried, not boiled.
--
<URL:http://www.wildcard.demon.co.uk/> You can never browse enough
Martin Rodgers | Programmer and Information Broker | London, UK
Please note: my email address is gubbish.
------------------------------
Date: 20 Apr 1997 08:45:47 GMT
From: yorspecial@aol.com (YorSpecial)
Subject: Re: Would like to test cgi-scripts offline.
Message-Id: <19970420084501.EAA12871@ladder01.news.aol.com>
I am not sure if anyone wants to spend some pocket change, but for $32, I
bought the Perl for Dummies book.
The CD-ROM with the book comes with a version of Perl 5 which runs on
Windows 95.
You can run PERL scripts right in DOS.
It works for me and I do test scripts offline successfully.
Bruce Chamoff
http://www.ysd.com
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 332
*************************************