[6730] in Perl-Users-Digest
Perl-Users Digest, Issue: 355 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 23 14:17:25 1997
Date: Wed, 23 Apr 97 11:00:47 -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 Wed, 23 Apr 1997 Volume: 8 Number: 355
Today's topics:
Re: "Dummies" book any good? <tchrist@mox.perl.com>
Re: Designed vs. Jes' Grew [was: Ousterhout and Tcl los <thant@nospam.acm.org>
Re: Document Contains No Data <rootbeer@teleport.com>
Execute Perl with Mosaic labajo@tid.es
Re: Find something in a string (Honza Pazdziora)
Get Chars up to first | without splitting <flg@vhojd.skovde.se>
Re: Getting image size <lpa@sysdeco.no>
Re: HELP! Matching a multi line pattern and replacing i (David Alan Black)
Help: how to use 'sys/time.ph' in perl (Tung Lee)
Re: I/O on serial device? (Matthew H. Gerlach)
Re: I/O on serial device? <tchrist@mox.perl.com>
Interpolating subroutine names? <herkimer@cs.wisc.edu>
Re: Interpolating subroutine names? (Andrew M. Langmead)
Re: Interpolating subroutine names? (Mike Stok)
Re: Interpolating subroutine names? <ajohnson@gpu.srv.ualberta.ca>
Re: Lisp is neither (was Re: Ousterhout and Tcl lost th <prasadm@polaroid.com>
Re: Lisp is neither (was Re: Ousterhout and Tcl lost th <erik@naggum.no>
Re: Mac version of Perl ... (Richard Petty)
NEWBIE regexp q: <keesh@cs.cmu.edu>
Re: Odd array sizing information <merlyn@stonehenge.com>
Re: Odd array sizing information <nospam!dcaugh@nortel.ca>
Re: Odd array sizing information <eryq@enteract.com>
Re: Ousterhout and Tcl lost the plot with latest paper (Cyber Surfer)
Output to a printer? (Bob)
Re: Passing parameter <a.aitken@unl.ac.uk>
Re: Passing parameter (Mike Stok)
Problem with "utbuf" when building on Next <dirk@joe.org>
Script needed to append parsed form field data to dBase <keys101@wgn.net>
Re: Split and IF / ELSE statements (Chipmunk)
switch and if <igandham@prestel.net>
Re: why cant I access/print a list-of-lists this way (Chipmunk)
Re: Why perl/TK hardly mentioned in Camel Book? <merlyn@stonehenge.com>
Re: Win32 UNC path question <rootbeer@teleport.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 23 Apr 1997 15:13:26 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: "Dummies" book any good?
Message-Id: <5jl8um$cgt$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, Tom Grydeland <tom@eiscat.uit.no> writes:
:I won't ramble on about this book. I ment to write a review of it
:once, but it has come in a second edition by now, and Tom Christiansen
:seems to like it, mostly, so I never bothered. I wouldn't recommend
:it to anyone though.
Reviews from other people are highly encouraged. Send yours in.
I like the start of P5P21D/2e, but not the end.
:This book has the great advantage of only 340 pages against the more
:than 800 pages of TYPI21D. And the noise level is a lot more
:comfortable. I managed to read it through in one afternoon without
:getting my blood pressure up.
Wow, you sound like me reading these books. :-)
:And it keeps refering the reader to the online documentation for
:in-depth information. If all books did that ...
I think it's a good idea, too. We're trying to do that in Llama-2E.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
sum to check equivalent files should use sum -a. --Andrew Hume
------------------------------
Date: Wed, 23 Apr 1997 09:28:29 -0700
From: Thant Tessman <thant@nospam.acm.org>
Subject: Re: Designed vs. Jes' Grew [was: Ousterhout and Tcl lost the plot with latest paper]
Message-Id: <335E38AD.41C6@nospam.acm.org>
Steven D. Majewski wrote:
[...]
> Another binary classification of computer languages is 'academic languages'
> vs. 'toolkit languages' :
[...]
> But I think it's reasonable to say that Scheme, ML and Haskell --
> good picks for archetypal academic languages -- were all developed to
> demonstrate the wide utility of a few powerful concepts. [...]
I think ML was originally created specifically for writing theorem provers.
So ML really started out as an academician's toolkit language.
[...followups severely trimmed...]
-thant
------------------------------
Date: Wed, 23 Apr 1997 08:06:29 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Gregory Reddin <ranger@onramp.net>
Subject: Re: Document Contains No Data
Message-Id: <Pine.GSO.3.96.970423080604.9127H-100000@kelly.teleport.com>
On Tue, 22 Apr 1997, Gregory Reddin wrote:
> Subject: Document Contains No Data
When you're having trouble with a CGI form in Perl, you should first look
at the please-don't-be-offended-by-the-name Idiot's Guide to solving such
problems. It's available on the perl.com web pages. Hope this helps!
http://www.perl.com/perl/
http://www.perl.com/perl/faq/
http://www.perl.com/perl/faq/idiots-guide.html
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: Wed, 23 Apr 1997 16:07:31 +0100
From: labajo@tid.es
Subject: Execute Perl with Mosaic
Message-Id: <335E25B3.66FC@tid.es>
Hello,
I'm trying to execute SATAN in my computer. It uses the Netscape browser
as User Interface, but it has several .pl files which looks like:
print CLIENT <<EOF;
<HTML>
<HEAD>
<title> Tutorials - Security Problems </title>
<LINK REV="made" HREF="mailto:satan\@fish.com">
</HEAD>
<BODY>
<H1><IMG SRC=$HTML_ROOT/images/satan.gif> Tutorials - Security problems
</h1>
<hr>
<h2>Table of contents</h2>
<ul>
EOF
foreach (<$html_root/tutorials/vulnerability/*.html>) {
s;.*/([^\/]+);\1;;
($_tutorial = $_) =~ s;([^\/]+).html;\1;;
$_tutorial =~ tr /_/ /;
print CLIENT <<EOF;
<p><dt> <IMG SRC=$HTML_ROOT/dots/blackdot.gif>
<a href=$HTML_ROOT/tutorials/vulnerability/$_>
<strong>$_tutorial </stro
ng></a>
EOF
}
print CLIENT <<EOF;
</ul>
<hr> <a href=$HTML_STARTPAGE> Back to the SATAN start page </a>
</BODY>
</HTML>
EOF
How can I config my Netscape to execute the perl script and print the
web page too. If I config the mime types to use the perl program with
the .pl files nothing happens; and if I remove the .pl suffix from the
x-application/x-perl myme type (as somebody told me), ths Netscape print
the script on the screen as if it were plain text.
Thanks in advance
--David
------------------------------
Date: Wed, 23 Apr 1997 16:16:26 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Find something in a string
Message-Id: <adelton.861812186@aisa.fi.muni.cz>
"Dustin0123" <dharber@bitstream.net> writes:
> How do you find characters within strings? For example, let's say:
> $day = "A nice day today"
> How would I find 'nice' in $day?
$day =~ /nice/;
will return true if 'nice' can be found somewhere in the string
referenced by =~. Is that what you mean?
--
------------------------------------------------------------------------
Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
I can take or leave it if I please
------------------------------------------------------------------------
------------------------------
Date: 23 Apr 97 15:54:01 GMT
From: "Fredrik Lindberg" <flg@vhojd.skovde.se>
Subject: Get Chars up to first | without splitting
Message-Id: <01bc4ffe$8fca0440$e20f10c2@odens.di.vhojd.skovde.se>
>>> Christopher wrote
> I've got a text file that contains this -
>
> 001|something|something else|and some more
>
> - reading into $line a line at a time and I want to just put the 001 bit
> into $FirstBit.
> Can I extract the characters up to the first occurrence of | ?
> Currently I'm splitting the whole line into $FirstBit and the rest into
> $junk1,$junk2 etc but this seems a long way round perhaps ? There could
> be any number of characters before the |.
Hi, here are two ways of doing it. First using a split and the other with a
regexp
for more information about split() checkout the perlfunc man page, and for
more
information about the regexps, checkout the perlre man page.
#!/usr/bin/perl -w
while(<>) {
# Split on | but limit the split to two, and only capture the
first.
($onebit) = split(/\|/, $_, 2);
print "Onebit through split : $onebit\n";
# Using regexp. Capture any character up to the first |.
($onebit) = /^(.*?)\|/;
print "Onebit through regexp: $onebit\n";
}
__END__
Hope this helps
/Fredrik
------------------------------
Date: Wed, 23 Apr 1997 17:06:28 +0200
From: Luca Passani <lpa@sysdeco.no>
To: Willem van den Bosch <willem@ozartnet.com.au>
Subject: Re: Getting image size
Message-Id: <335E2574.300A@sysdeco.no>
Willem van den Bosch wrote:
>
> Hi All
>
> Is there anyway of getting the image size in pixels from a gif or jpeg
> file, using perl. If the answer is yes Please tell me how.
this perl4 script is good because it produces the width and height
attributes for the <img src> tag, but it only works for gifs, but it
understands globbing.
#!/usr/local/bin/perl
for (@ARGV) {
if (!open(GIF, $_)) {
warn "Can't open $_: $!";
next;
}
($type, $s) = ("", "");
read(GIF, $type, 6);
if ( ($type !~ /GIF8[7,9]a/) || (read(GIF, $s, 4) != 4) ) {
warn "Invalid or Corrupted GIF: $_\n";
$size="";
} else {
($a,$b,$c,$d)=unpack("C"x4,$s);
$size=join ("", 'width="', $b<<8|$a, '" height="', $d<<8|$c, '"');
}
print "$_: $size\n";
}
--
======================================================================
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: 23 Apr 1997 16:01:41 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: HELP! Matching a multi line pattern and replacing it
Message-Id: <5jlbp5$827@pirate.shu.edu>
Hello -
>David Millier wrote:
>>
>> I need to match somthing that looks like this:
>> New files in F:\ozzy_data\buckeye
>>
>> 04/03/97 05:35p 59,525 Backup of index.wbk
>> 04/04/97 01:42p 59,591 index.htm
>> 03/26/97 11:26a 2,179 Whats_New.txt
>>
>> New files in F:\ozzy_data\buckeye\OEM_DOCUMENTS
>>
>>
>> New files in F:\ozzy_data\buckeye\OEM_DOCUMENTS\CUSTOMER_NOTIFICATION
>>
>> Need to remove the "New files in ........." followed by two blank lines.
>> This takes out the listings of new files in directorys that have none. I am
>> simply having trouble matching a multi-line string(cant use foreach)
>> recursivly. Thanks in advance for any help. PS. Reply here, i have no email
>> currently.
That P.S. makes for a refreshing change of pace :-)
Here are a couple of possibilities:
#!/usr/local/bin/perl -w
open (IN, "files.dat") or die "Can't open for input: $!";
my @ok;
while (<IN>) {
if (/New files in/) {
my $one = <IN>;
my $two = <IN>;
push @ok, ($_, $one, $two) if ($two =~ /./);
}
else { push @ok, $_ };
}
close (IN) or die "Can't close: $!";
# etc....
__END__
or, if you want the Grand Gesture:
open...
undef $/;
$whole = <IN>;
$whole =~ s/New files in.*\n\n\n//g;
# possibly refining the \n\n\n test to check for
# stray whitespace.
close...
David Black
dblack@icarus.shu.edu
------------------------------
Date: 23 Apr 1997 14:51:18 GMT
From: tlee@attila.stevens-tech.edu (Tung Lee)
Subject: Help: how to use 'sys/time.ph' in perl
Message-Id: <5jl7l6$dug$1@apocalypse.dmi.stevens-tech.edu>
Hey,
I need to get the system time in msec ...how can I make
system call through sys/time.ph .....I mean, how to write
this kind of program?
thanks
Tony
------------------------------
Date: Wed, 23 Apr 1997 15:32:51 GMT
From: gerlach@netcom.com (Matthew H. Gerlach)
Subject: Re: I/O on serial device?
Message-Id: <gerlachE93KIr.FJ8@netcom.com>
In article <335D6B60.3976B227@netscape.com> Jamie Zawinski <jwz@netscape.com> writes:
>I want to have a Perl script that talks to my modem. This doesn't
>work:
I have found serial i/o to be more tricky that it seems on the surface. It
usually involves working with termio's and being sure to set every field
exactly right.
I have had great luck having my perl scripts talk to a serial program
rather than talking to the device directly. Specifically, I use Comm.pl
to talk to ckermit from columbia.edu. You could use cu, or tip, but
I don't suggest it.
Matthew H. Gerlach
------------------------------
Date: 23 Apr 1997 16:09:58 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: I/O on serial device?
Message-Id: <5jlc8m$fim$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, Jamie Zawinski <jwz@netscape.com> writes:
:I want to have a Perl script that talks to my modem. This doesn't
:work:
: open(DEV,"</dev/ttyf1");
: print DEV "AT\n";
You can't write to something you've opened read-only. The -w
flag would have warned you of this.
:
: while(<DEV>) {
: print "<== " . $_;
: }
:
:I tried \r and \r\n as well.
:
:It works fine if instead of /dev/ttyf1, I use some other device that
:is in use by a shell (what "tty" returns for that shell.)
:
: crw-rw-rw- 1 uucp uucp 0, 97 Apr 22 18:45 /dev/ttyf1
:
:Any suggestions? This is on Irix 6.2, if that matters.
Oh boy. I answered a jwz question. Do I get a free fix for a netscape
bug? :-)
See http://www.perl.org/CPAN/doc/manual/html/pod/perlfaq.html
http://www.perl.org/CPAN/doc/FAQs/
Here are some tasty excerpts:
How do I read and write the serial port?
This depends on which operating system your program is running
on. In the case of Unix, the serial ports will be accessible
through files in /dev; on other systems, the devices names will
doubtless differ. Several problem areas common to all device
interaction are the following
lockfiles
Your system may use lockfiles to control multiple access. Make
sure you follow the correct protocol. Unpredictable behaviour
can result from multiple processes reading from one device.
open mode
If you expect to use both read and write operations on the
device, you'll have to open it for update (see the section on
"open" in the perlfunc manpage for details). You may wish
to open it without running the risk of blocking by using
sysopen() and `O_RDWR|O_NDELAY|O_NOCTTY' from the Fcntl module
(part of the standard perl distribution). See the section on
"sysopen" in the perlfunc manpage for more on this approach.
end of line
Some devices will be expecting a "\r" at the end of each
line rather than a "\n". In some ports of perl, "\r" and
"\n" are different from their usual (Unix) ASCII values of
"\012" and "\015". You may have to give the numeric values
you want directly, using octal ("\015"), hex ("0x0D"),
or as a control-character specification ("\cM").
print DEV "atv1\012"; # wrong, for some devices
print DEV "atv1\015"; # right, for some devices
Even though with normal text files, a "\n" will do the trick,
there is still no unified scheme for terminating a line that
is portable between Unix, DOS/Win, and Macintosh, except to
terminate *ALL* line ends with "\015\012", and strip what
you don't need from the output. This applies especially to
socket I/O and autoflushing, discussed next.
flushing output
If you expect characters to get to your device when you
print() them, you'll want to autoflush that filehandle,
as in the older
use FileHandle;
DEV->autoflush(1);
and the newer
use IO::Handle;
DEV->autoflush(1);
You can use select() and the `$|' variable to control
autoflushing (see the section on "$|" in the perlvar manpage
and the "select" entry in the perlfunc manpage):
$oldh = select(DEV);
$| = 1;
select($oldh);
You'll also see code that does this without a temporary variable, as in
select((select(DEV), $| = 1)[0]);
As mentioned in the previous item, this still doesn't work
when using socket I/O between Unix and Macintosh. You'll
need to hardcode your line terminators, in that case.
non-blocking input
If you are doing a blocking read() or sysread(), you'll
have to arrange for an alarm handler to provide a timeout
(see the "alarm" entry in the perlfunc manpage). If you have
a non-blocking open, you'll likely have a non-blocking read,
which means you may have to use a 4-arg select() to determine
whether I/O is ready on that device (see the section on
"select" in the perlfunc manpage.
How come when I open the file read-write it wipes it out?
Because you're using something like this, which truncates the
file and *then* gives you read-write access:
open(FH, "+> /path/name"); # WRONG
Whoops. You should instead use this, which will fail if the file
doesn't exist.
open(FH, "+< /path/name"); # open for update
If this is an issue, try:
sysopen(FH, "/path/name", O_RDWR|O_CREAT, 0644);
Error checking is left as an exercise for the reader.
How do I randomly update a binary file?
If you're just trying to patch a binary, in many cases something
as simple as this works:
perl -i -pe 's{window manager}{window mangler}g'
/usr/bin/emacs
However, if you have fixed sized records, then you might do
something more like this:
$RECSIZE = 220; # size of record, in bytes
$recno = 37; # which record to update
open(FH, "+<somewhere") || die "can't update somewhere: $!";
seek(FH, $recno * $RECSIZE, 0);
read(FH, $record, $RECSIZE) == $RECSIZE || die "can't read record $recno: $!";
# munge the record
seek(FH, $recno * $RECSIZE, 0);
print FH $record;
close FH;
Locking and error checking are left as an exercise for the
reader. Don't forget them, or you'll be quite sorry.
Don't forget to set binmode() under DOS-like platforms when
operating on files that have anything other than straight text
in them. See the docs on open() and on binmode() for more details.
--
Tom Christiansen tchrist@jhereg.perl.com
Never eat more than you can lift.
--Miss Piggy
------------------------------
Date: 23 Apr 1997 15:35:16 GMT
From: Dan Bongert <herkimer@cs.wisc.edu>
Subject: Interpolating subroutine names?
Message-Id: <5jla7k$977@spool.cs.wisc.edu>
I have a program that is going to call different subroutines based on the
values of variables in an array.
Say I have this array:
@items = (
"foo",
"bar",
"baz",
"bizarro",
)
and I want to call dofoo, dobar, dobaz, and dobizarro.
what I want to do is something like this:
&do$items[$loc];
where $loc is a placeholder that tells where in the array I am.
Is something like this possible? I realize that this probably could be done
just fine with a switch-like statement, but it feels like this should be
possible.
Thanks,
--
Dan Bongert | Hire the Morally Handicapped--It's More Fun
dbongert@students.wisc.edu | National Institute for the Morally Handicapped
herkimer@upl.cs.wisc.edu | just a guy made of dots and lines
------------------------------
Date: Wed, 23 Apr 1997 16:38:53 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Interpolating subroutine names?
Message-Id: <E93nKt.GxL@world.std.com>
Dan Bongert <herkimer@cs.wisc.edu> writes:
>I have a program that is going to call different subroutines based on the
>values of variables in an array.
>Say I have this array:
> @items = (
> "foo",
> "bar",
> "baz",
> "bizarro",
> )
>and I want to call dofoo, dobar, dobaz, and dobizarro.
>what I want to do is something like this:
> &do$items[$loc];
>where $loc is a placeholder that tells where in the array I am.
Well, you can do it with soft references:
&{"do$items[$loc]"};
maybe needing to say:
{
no strict 'refs';
&{"do$items[$loc]"};
}
to keep "use strict" from complaining.
Another option would be to use a hash containing hard references to
the subroutines:
%call =
foo => \&dofoo,
bar => \&dobar,
baz => \&dobaz,
bizarro \&dobizarro,
);
&{ $call{$items[$loc]} };
This will run under "use strict" and doesn't limit the subroutine
names to being the contents of @items, preceded by "do".
--
Andrew Langmead
------------------------------
Date: 23 Apr 1997 16:55:13 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Interpolating subroutine names?
Message-Id: <5jleth$kan@news-central.tiac.net>
In article <5jla7k$977@spool.cs.wisc.edu>,
Dan Bongert <herkimer@cs.wisc.edu> wrote:
>I have a program that is going to call different subroutines based on the
>values of variables in an array.
DB<1> sub doone {print "doone here (@_)\n";}
DB<2> @list = ('one')
DB<3> $index = 0
DB<4> &{"do$list[$index]"} ('foo', 'bar')
doone here (foo bar)
In perl 4 (or in perl 5) you can say
DB<5> $sub = "do$list[$index]"
DB<6> &$sub ('foo', 'bar')
doone here (foo bar)
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@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: Wed, 23 Apr 1997 11:28:26 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Interpolating subroutine names?
Message-Id: <335E38AA.434BE2DF@gpu.srv.ualberta.ca>
Dan Bongert wrote:
!
! I have a program that is going to call different subroutines
! based on the values of variables in an array.
!
! Say I have this array:
! @items = (
! "foo",
! "bar",
! "baz",
! "bizarro",
! )
!
! and I want to call dofoo, dobar, dobaz, and dobizarro.
!
! what I want to do is something like this:
! &do$items[$loc];
! where $loc is a placeholder that tells where in the array I
! am.
!
! Is something like this possible? I realize that this
! probably could be done just fine with a switch-like
! statement, but it feels like this should be possible.
certainly, use eval:
@items = (
"foo",
"bar",
"baz",
"bizarro",
);
foreach $loc (0..3) {
eval "&do$items[$loc]";
}
sub dofoo {
print "foo\n";
}
sub dobar {
print "bar\n";
}
sub dobaz {
print "baz\n";
}
sub dobizarro {
print "ajsdonwejaaanejf\n";
}
regards
andrew
------------------------------
Date: Wed, 23 Apr 1997 12:38:19 -0400
From: "M. Prasad" <prasadm@polaroid.com>
Subject: Re: Lisp is neither (was Re: Ousterhout and Tcl lost the plot)
Message-Id: <335E3AFB.73B4@polaroid.com>
Bjxrn Remseth wrote:
>
> "M. Prasad" <prasadm@polaroid.com> writes:
>
> > If this experience is BS, what is the truth? Why _did_
> > the Lisp machines die? People keep blaming "marketing", but
> > did LMI/Symbolics founders not have enough smarts or the money
> > to hire some good marketing people? I would doubt either
> > of these two was the case.
>
> Well, I am not too sure about that, I have seen worse examples of
> misjudgement from management :)
>
> My 0.02 USD worth of theory on the failure of the lisp-machines is:
> The machines were pretty expensive. At least initially, they were also
> targeted at a very limited market (the AI market) which then sort of
> collapsed (details omitted :). Now, the Lisp machines were truely
> excellent at interoperability and communication with just about any
> weird piece of hardware, language, file-format and network protocol,
> so "not compatible" was probably a very minor issue. But you _did_
> need to be very rich to get one in the first place. If you had any
> sanity at all (not all rich people do :), you probably also needed a
> very good product idea before you could justify the kind of investment
> such a machine represented, _and_ you needed to be pretty successfull
> in the execution of your project to defend the investment afterwards.
> This last issue was probably particularly true if your project ran
> over budget, didn't complete properly or ran into any number of other
> problem not necessarily related to your unconventional choice of
> plattform
>
> Now, are these kinds of issues marketing issues? Yes probably.
We seem to have lots of opinions, with a fair amount
of blame placement on management. But you don't get to manage
a start-up with that many high-powered brains, unless
you are really good and proven. So I still doubt the
"bad management" theory very much.
Maybe Lisp is just not suited for commercial use. I have
also seen (been at, actually) a very highly successful
company, SAI, bet the farm on Lisp-like languages, and
lose it big. Lisp success stories dramatic enought to balance
that, seem to be missing.
Or maybe it was just some really bad Karma :-) I understand rms
was very unhappy with at least one of these dudes...
------------------------------
Date: 23 Apr 1997 17:14:02 +0000
From: Erik Naggum <erik@naggum.no>
Subject: Re: Lisp is neither (was Re: Ousterhout and Tcl lost the plot)
Message-Id: <3070804442620792@naggum.no>
* Erik Naggum
| (yes, CPU's _do_ have instructions that C compilers don't use.)
* Donal K. Fellows
| I take it you don't work in computer hardware design, and haven't even
| looked at the field for at least 10 or 15 years, since that last
| statement is plain wrong. Maybe Vaxes had a "Reverse Bit Shift, Cast
| to Type and Catch Fire if the Programmer is Stupid" instruction (with
| mnemonic RBSCTCFPS :^) but technology is substantially advanced since
| then. RISC CPU's have only the instructions that are measured as
| being needed in practice, and virtually all new designs are RISC (with
| the notable distiction of the ix86 line of processors). In future, try
| to check your facts, and especially those that have been contradicted
| by people (with good reason) for loads of years...
geez.
the SPARC architecture has several instructions that C compilers doesn't
use, but which are convenient with type-tagged languages. the _fact_ is
that it has an the instruction, with Sun's recommended mnemonic "taddcctv",
that is specifically useful in Lisp, and specifically unused in C. other
instructions are also measurably useful in languages _other_ than C.
C is _not_ the be-all, end-all of programming languages and C is _not_ the
universal assembler that some would like it to be. that you cannot even
put this instruction to use without a lot of prior work that you also have
a hard time doing in C, shows that the SPARC designers thought of more than
increasingly myopic C crowd.
actually, I find it rather astonishing to learn that some people are so
belligerently ignorant as to believe they can pull off a stunt like the
above from D. K. Fellows.
but to demonstrate the point with a real-life example, take the following
(silly) function, compiled by Allegro Common Lisp for Unix on a SPARC:
(defun foo (x y) (declare (fixnum x y)) (+ x y))
0: cmp %g3, #x2
4: tne %g0, #x13
8: taddcctv %g0, %g1, %g0
12: sra %o0, #x2, %o0
16: sra %o1, #x2, %o1
20: add %o0, %o1, %o0
24: ld [%g4 + 135], %g2 ; fixnum-or-bignum
28: jmp %g2 + 0
32: xor %g0, #x1, %g3
the intelligent reader will recognize that this function sports a few
features not commonly found in C compiler output: the number of incoming
arguments is in a register, there are traps to handle error conditions, and
it concludes with a jump to a function instead of a call and return. (no
programmer knowledgeable of pipelines RISCs will wonder why the jmp occurs
before the argument count is stored into %g3.)
I welcome suggestions on how to accomplish the _exact equivalent code_ from
C source code. if this cannot be done, could Donal K. Fellows then accept
that some CPU's (1) do have instructions that C compilers don't use, and
(2) that he shot his mouth off? I assume both, so let's return to our
regular program.
#\Erik
--
Bastard Sex Therapist from Hell: "Read the F*cking Manual!"
------------------------------
Date: Wed, 23 Apr 1997 11:39:54 -0500
From: rwvr90@email.sps.mot.com (Richard Petty)
Subject: Re: Mac version of Perl ...
Message-Id: <rwvr90-2304971139540001@rpetty.sps.mot.com>
In article <5j5sjo$nil@bmerhc5e.bnr.ca>, brodger@bnr.ca (Roger
Balakrishnan ) wrote:
>Hi,
>
>Where (FTP sites etc) can I get a Mac version
>of perl.
>
>BTW I am using a Mac SE, I dont think its using
>system 7 (Its been so long since Ive powered it
>up !!!)
MacPerl is in all the expected places (infomac mirrors, etc). Just look.
I think I have bad news for you, though. You own a large paperweight.
I'm not intimately familiar with MacPerl but I'm positive the most recent
version is a no-go for you. And even if it is, Perl programming implies
you've got some Perl processing in mind and an SE runs at less than 10%
the speed of the cheapest currently shipping Mac/clone.
Good to learn Perl on, maybe.
Good luck,
--Richard
--
rwvr90@email.sps.mot.com
(512) 933-8325
Motorola
Austin, Texas
------------------------------
Date: Wed, 23 Apr 1997 12:29:35 -0400
From: Eric Kischell <keesh@cs.cmu.edu>
Subject: NEWBIE regexp q:
Message-Id: <335E38EF.41C6@cs.cmu.edu>
Hello,
I am currently reading the "Camel" book in order to learn Perl.
I have a simple regexp parsing problem.
I wish to extract specific taggged lines(may include embedded newlines)
from a file up to but not including the next tagged line(unless the next
tagged line is the tag that I am currently looking for).
ex.)
----
Report: This is a report.hhhhh
Yes it is. It is.
You betcha.
Precaution: ffjsdfdfjfjdjdfjfj
Finish: This is a report2.
Yes it is 2. It is 2.
You betcha 2.
----
if my tag is "Report:" extract
Report: This is a report.hhhhh
Yes it is. It is.
You betcha.
Two questions:
1) Is there anyway to read multiple lines(with embedded newlines) at one
time up to some tag designation or should I read the file into an array?
(ie do I need to maintain state info myself?)
2) What is wrong with my regexp?
code frag)
# open IOS log file
my $file = $ARGV[0];
open(FILE, $file) or die "$PROGRAM_NAME: Can't open $file for reading:
$!\n";
#define "tags" to match
my $mytags = "(Patient Selection:|Logfile
Selection:|Precaution:|Configuration:|Collect World Rigid
Body:|Calibrate Probe:|Verify Calibration of Probe:|Calibration Decision
for Probe:|Insertion of Spike:|Data Acquisition for Sphere:|Data
Acquisition for Registration:|Registration Application:|Verify
Registration Application:|Tracking Application:|Finish:|Optofov
Application:|Report:|???:)";
#print "$mytags \n";
my $mytag = "Report:";
my $line = "";
#while ( <FILE> =~ m/(^$mytag .+? [^ $mytags] + $mytags)/gos )
while ( $line = <FILE> ){
# while ( $line =~ m/^$mytag.+[^$mytags]/gos )
while ( $line =~ m/^$mytag .+? [^$mytags]/gosx )
{
print "$1 \n";
print "$& \n";
}
}
thx in adv
e.-
------------------------------
Date: 23 Apr 1997 09:26:06 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: Eryq <eryq@enteract.com>
Subject: Re: Odd array sizing information
Message-Id: <8cn2qpzowx.fsf@gadget.cscaper.com>
>>>>> "Eryq" == Eryq <eryq@enteract.com> writes:
Eryq> $#x == (int(@x) - 1)
Hey Eryq, have you been getting a lot of arrays with fractional sizes
lately? :-)
I think Eryq meant to say:
$#x == @x - 1
or, if tchrist had his way:
$#x = scalar(@x) - 1
:-)
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 495 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: Wed, 23 Apr 1997 12:14:31 -0400
From: Dan Caugherty <nospam!dcaugh@nortel.ca>
Subject: Re: Odd array sizing information
Message-Id: <335E3567.4826@nortel.ca>
Alastair Aitken wrote:
>
> Dan Caugherty wrote:
>
> > Hi! I ran across what I believe to be a Perl bug.
[snip]
>
> I don't think it's a bug.
[snip]
You're right. (Sigh.) The joke and the error are on me.
Thx for replying to this (newbie) question, tho'.
-- Dan C.
+------------------dcaugh@pas_de_spammer!.nortel.ca------------------+
| Dan Caugherty | All opinions herein are MINE. Not yours, |
| Nortel RTP, NC | theirs, his, hers, or its. So there. |
| Pursuant to US Code, Title 47, Chapter 5, Subchapter II, '227, |
| ANY AND ALL UNSOLICITED COMMERCIAL E-MAIL is subject to a download |
| and archival fee in the amount of $100 US. E-mailing this address |
| denotes acceptance of these terms. (And I can use the money.) |
+------------------dcaugh@pas_de_spammer!.nortel.ca------------------+
------------------------------
Date: Wed, 23 Apr 1997 11:51:29 -0500
From: Eryq <eryq@enteract.com>
Subject: Re: Odd array sizing information
Message-Id: <335E3E11.2B756B6E@enteract.com>
Randal Schwartz wrote:
>
> >>>>> "Eryq" == Eryq <eryq@enteract.com> writes:
>
> Eryq> $#x == (int(@x) - 1)
>
> Hey Eryq, have you been getting a lot of arrays with fractional sizes
> lately? :-)
Fractional? Heck, I've been working with arrays of with *irrational*
sizes for a while now (I think a 5MB array has a pretty
irrational size, don't you?)... I look forward to Perl5.005, which
I understand will support arrays with both negative and imaginary
numbers of elements as well... and since most of the work I do is
imaginary, Perl will once again be the perfect language. ;-)
> I think Eryq meant to say:
>
> $#x == @x - 1
Point taken, but actually, I meant to say it as I did: I figured
that since it was an answer to a newbie question, I wanted them to see
the scalar context and grouping explicitly, via the int() and
parens.
Regards,
--
___ _ _ _ _ ___ _ Eryq (eryq@enteract.com)
/ _ \| '_| | | |/ _ ' / Hughes STX, NASA/Goddard Space Flight Cntr.
| __/| | | |_| | |_| | http://www.enteract.com/~eryq
\___||_| \__, |\__, |___/\ Visit STREETWISE, Chicago's newspaper by/
|___/ |______/ of the homeless: http://www.streetwise.org
------------------------------
Date: Wed, 23 Apr 1997 17:46:42 +0100
From: cyber_surfer@gubbish.wildcard.demon.co.uk (Cyber Surfer)
Subject: Re: Ousterhout and Tcl lost the plot with latest paper
Message-Id: <MPG.dc83ab56b77580498979b@news.demon.co.uk>
With a mighty <AF837FB99668DC55@ppp131.itw.com>,
perez@acm.org uttered these wise words...
> Apple, as usual, addressed this problem several years ago. It's called
> OSA (I think it stands for Open Scripting Architecture).
Excellent. I guess I missed it coz I'm not a Mac developer. Since it
has some relevance to this thread, I wonder how it compares with Tcl?
> You have your choice of syntaxes (Perl, AppleScript or Frontier are
> available or you can make your own). You can do it from C (but man!
> does that hurt from what I hear).
Even better. Is it possible to use Lisp? Tcl? You're saying that it
can be done, but has anyone _actually_ done it yet?
Not that it matters. What's important is that Apple - and now MS -
have a way of making the scripting language irrelevant. The choice is
with the user, instead of hardcoded by the app developer. Now, if the
Unix people could also use something like this...
Thanks.
--
<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: Wed, 23 Apr 1997 15:44:31 GMT
From: xxbbell@voicenet.com (Bob)
Subject: Output to a printer?
Message-Id: <5jlatq$g0k@news1.voicenet.com>
I need to output the result of a script in Unix to a printer.
To make things complicated, my boss would really like it to go to
printer that's on a Win95 network. I see two ways to do this: Either
write a quick VC++ or VB program, or write a Unix program that puts
the output in a file, and another VC++ or VB program that occasionally
uses Net::FTP to get that file and output it to the printer. Anybody
see another way, or can make a recommendation? Thanks. I haven't
seen any CPAN modules referring to this.
- Bob
xxbbell@voicenet.comxx
remove x's to reply
------------------------------
Date: Wed, 23 Apr 1997 17:06:52 +0100
From: Alastair Aitken <a.aitken@unl.ac.uk>
Subject: Re: Passing parameter
Message-Id: <335E339C.4995@unl.ac.uk>
Postmaster wrote:
>
> Hi,
>
> I was wondering if the following would be possible.
> I have a Perl script, which calls an exe-file with
> following method and passes one parameter into it:
> Example:
>
> $test01 = "test.exe";
> $test02 = "1234567890";
> system "$test01 $test02";
>
> Test.exe returns a string, which I would like to use
> later in my script. The two problems are these:
> Am I using the right way to call an external program
> with a parameter?
This works:
$prog = "test.exe";
$parm = "0123456789";
$results = `$prog $parm`;
Note that those are backticks and that the output from the program will
be in $results, a scalar.
Alastair.
------------------------------
Date: 23 Apr 1997 16:47:50 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Passing parameter
Message-Id: <5jlefm$jvd@news-central.tiac.net>
In article <335E1F63.14FA@ts-group.fi>,
Postmaster <Postmaster@ts-group.fi> wrote:
>I was wondering if the following would be possible.
>I have a Perl script, which calls an exe-file with
>following method and passes one parameter into it:
>Example:
>
>$test01 = "test.exe";
>$test02 = "1234567890";
>system "$test01 $test02";
>
>Test.exe returns a string, which I would like to use
>later in my script. The two problems are these:
>Am I using the right way to call an external program
>with a parameter?
>$test03 = system"$test01 $test02";
You might want to say something like:
chomp ($test03 = `$test01 $test02`);
and maybe look in the System Interaction section of the new FAQ on
http://www.perl.com/FAQ/
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@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: 23 Apr 1997 15:32:07 GMT
From: "Dirk Herr-Hoyman" <dirk@joe.org>
Subject: Problem with "utbuf" when building on Next
Message-Id: <01bc4ffb$b5dbae70$9a1f9bce@madison>
I am attempting to build Perl 5.003 on a Next 3.3 computer. I had built
4.036 on it some time ago and am trying to upgrade.
The Configure script does know about the next3, so I figured not have any
any problems. However, duing the make, I get this error:
rilian{hoymand}8: make
`sh cflags libperl.a doio.o` doio.c
CCCMD = cc -c -DUSE_NEXT_CTYPE -I/usr/local/include -O
doio.c: In function `Perl_apply':
doio.c:1182: storage size of `utbuf' isn't known
*** Exit 1
Stop.
I'm kinda stuck, as I don't see utbuf being defined anywhere. Not in
config.sh.
Can someone suggest what I should try next (no pun intended)? TIA.
--
Dirk Herr-Hoyman <hoymand@joe.org>
Journal of Extension
------------------------------
Date: 23 Apr 97 15:49:47 GMT
From: "keys101" <keys101@wgn.net>
Subject: Script needed to append parsed form field data to dBase dbf file
Message-Id: <01bc4ffd$8aeded20$5a06d5cf@keys101>
Perl Misc,
Using PERL, I can parse form submitted field data into comma separated text
and append it to a flatfile so each line of data reflects the results of a
single form submission. Very common. Done all the time.
(ex: after two forms received, parsed by PERL script and appended to
data.dat the result would be)
Tommy,Jones,123 Vain St.,Norman,NY,14332
Susan,Clive,56 Strange Rd.,Los Gatos,CA,93456
The thing is, rather than comma separated data, I need .dbf formatted data
to append to a .dbf file.
Does anyone know of an existing script available for download? Or can
someone offer the scripting to help me out.
Thanks,
keys101
------------------------------
Date: 23 Apr 1997 13:56:27 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: Split and IF / ELSE statements
Message-Id: <5jl4eb$1cq$1@dartvax.dartmouth.edu>
In article <335d0c37.3426594@news1.pei.sympatico.ca>
dico@peionline.com (Dico Reyers) writes:
> Now... it will print "ITEM ONE" "HELLO THERE" and "WHO CARES"
> regardless of whether the statement is true.... why is that? And it
> will repeat saying it many times.....
I tested your program, and it worked fine. It printed "ITEM ONE" for
1, "HELLO THERE" for 2, and "WHO CARES" for everything else.
I assume that's not the actual code you use in your program. What is
the code you're using there, and what input are you giving the program?
Chipmunk
------------------------------
Date: Wed, 23 Apr 1997 17:40:14 +0100
From: iqbal gandham <igandham@prestel.net>
Subject: switch and if
Message-Id: <335E3B6E.39D8@prestel.net>
Hi
Is it better to use an if statement or switch, or doesn't it make much
difference.
I have about eight if else statemants.
As far as I know if you use if statements then it checks through every
statement, whereis using the switch method you can fall out of the block
when say the pattern is met.
Thanks
Iqbal
igandham@prestel.net
I would be grateful if you mail me th reply
------------------------------
Date: 23 Apr 1997 14:09:46 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: why cant I access/print a list-of-lists this way
Message-Id: <5jl57a$1cq$2@dartvax.dartmouth.edu>
Here's how I've printed my lists-of-lists:
Both of these print one row of the array, so they would need to be
inside a for loop to access the whole array.
foreach $a (@{ $a[$i] }) {
print $a;
}
For this one $,=" " so that it prints a space between each element:
print (@{ $B[$l] });
Chipmunk
------------------------------
Date: 23 Apr 1997 09:23:53 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: dlrip@one.net
Subject: Re: Why perl/TK hardly mentioned in Camel Book?
Message-Id: <8cpvvlzp0m.fsf@gadget.cscaper.com>
>>>>> "Dave" == Dave Ripberger <dlrip@one.net> writes:
Dave> Nothing about TK in the index, though I haven't completed the book
Dave> yet. I also see very few posts and zero responses in
Dave> comp.lang.perl.tk. What gives? Is tcl/tk still the "choice" of perl
Dave> programmers?
For the camel, we made a very conscious choice to document *only* those
things that come with the core distribution. Perl-TK is *not* part
of the core.
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 495 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: Wed, 23 Apr 1997 09:46:01 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Jeff Lawrence <jeff@qcsn.com>
Subject: Re: Win32 UNC path question
Message-Id: <Pine.GSO.3.96.970423094515.9127P-100000@kelly.teleport.com>
On Mon, 21 Apr 1997, Jeff Lawrence wrote:
> I need to see if this directory exist
Maybe you want -d, documented under -X in perlfunc. Hope this helps!
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
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 355
*************************************