[6667] in Perl-Users-Digest
Perl-Users Digest, Issue: 292 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Apr 13 12:27:14 1997
Date: Sun, 13 Apr 97 09:00:26 -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 Sun, 13 Apr 1997 Volume: 8 Number: 292
Today's topics:
-e command-line option <earl@bell.us>
Re: abort a script (Andrew M. Langmead)
Can you index multiple files (John Hansen)
Re: Can you index multiple files (Eric D. Friedman)
Re: CGI Module - I have a syntax problem. (Tim Gim Yee)
Re: CGI Module - I have a syntax problem. (Tim Gim Yee)
Re: Could some one please help <togtog@bewley.net>
Re: Getting single keystroke (David Alan Black)
Re: How can I create a C extension to Win32 Perl? (McWilliams)
Re: Match ? (sam)
Re: Newbie: Webify A Program? (Tim Gim Yee)
Re: Newbie: Webify A Program? <critter@quack.kfu.com>
Re: Ousterhout and Tcl lost the plot with latest paper <erik@naggum.no>
Perl Database Question (Rob Mangiafico)
perl executable by core dump <dmorgan@nght.demon.co.uk>
Re: Perl-Books. (I R A Aggie)
Re: Perl-Books. <jhi@alpha.hut.fi>
Re: Perl2awk or Perl2sed translators <merlyn@stonehenge.com>
Re: Reply to Ousterhout's reply (was Re: Ousterhout and (Cyber Surfer)
Re: Split a line on "^M" <tchrist@mox.perl.com>
the new version of the BSD::Resource 1.05 announcement <jhi@iki.fi>
Re: Transliterate from a pattern? <tchrist@mox.perl.com>
Re: Transliterate from a pattern? <dbenhur@egames.com>
Tutorial on OmniHTTP? (Kevin Posen)
Re: Tutorial on OmniHTTP? (Nathan V. Patwardhan)
Re: Unexpected Behavior using open () <tchrist@mox.perl.com>
Re: Unique Filename <tchrist@mox.perl.com>
Re: Unix and ease of use (WAS: Who makes more ...) <0lette01@almere.flnet.nl>
Re: Unix and ease of use (WAS: Who makes more ...) sinecto@[anti-spam coating, remove before use]clark.net
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 09 Apr 1997 11:02:15 -0700
From: Chris Andrew <earl@bell.us>
Subject: -e command-line option
Message-Id: <334BD9A7.485F@bell.us>
Can anyone tell me where to read more about the -e option or where to
find some examples of *larger* uses of it.
What I've found in Learning Perl, Software Engineering with Perl or
Programming Perl (both editions) is simply almost nothing. The largest
descrition I've found is in Learning Perl page 191 and doesn't tell much.
I need larger examples passing parameters.
Thank you
------------------------------
Date: Sun, 13 Apr 1997 14:14:42 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: abort a script
Message-Id: <E8Ky8I.63z@world.std.com>
periat@ens.ascom.ch (Periat Henri) writes:
>I have a Perl program, which starts compilers with system(gcc ...)
>or `gcc ...` in a loop. Now I want to be able to abort the program when
>ever I want to. But when I press Ctrl-C, the compiler stops but not my
>Perl program and the loop goes on.
You could check if the return value from the system() command
indicates that it was ended in by a signal and quit if it has.
my $ret = system('gcc -o hello hello.c');
my $signal = $ret & 0xff;
kill $signal, $$ if $signal;
--
Andrew Langmead
------------------------------
Date: Sun, 13 Apr 1997 11:56:27 GMT
From: sasjwh@unx.sas.com (John Hansen)
Subject: Can you index multiple files
Message-Id: <E8Kru4.8EB@unx.sas.com>
Keywords: index sdbm files
I have a lot of (17,000) ascii text files for which I would like to index
every word and then allow users to do a search for that word and present the
title and filename of any document that has those words.
I have played around with the SDBM_File module but it does not seem up to the
task, capability wise. Could someone point me in a different direction?
Perhaps there is another way to do this or someone else has tackled it already
and has a solution I can retrofit.
Many thanks,
John Hansen
sasjwh@sas.com
------------------------------
Date: 13 Apr 1997 13:31:36 GMT
From: friedman@medusa.acs.uci.edu (Eric D. Friedman)
Subject: Re: Can you index multiple files
Message-Id: <5iqn7o$rvo@news.service.uci.edu>
Keywords: index sdbm files
[mailed, posted]
In article <E8Kru4.8EB@unx.sas.com>, John Hansen <sasjwh@unx.sas.com> wrote:
>I have a lot of (17,000) ascii text files for which I would like to index
>every word and then allow users to do a search for that word and present the
>title and filename of any document that has those words.
Use glimpse and glimpsehttp or webglimpse.
HTH,
Eric
--
Eric D. Friedman
friedman@uci.edu
------------------------------
Date: Sun, 13 Apr 1997 10:06:37 GMT
From: tgy@chocobo.org (Tim Gim Yee)
Subject: Re: CGI Module - I have a syntax problem.
Message-Id: <3350ad81.57208511@news.seanet.com>
On 13 Apr 1997 01:14:06 GMT, gdaswani@mail.odc.net (George Henry C.
Daswani) wrote:
>Problem is with the
>
> foreach $item (@checklist) {
> if ( $cgi_query->param('$item') eq "" ){
> ^^^^^^^^^
> This doesn't seem to work properly.
> even though at that loop $item = "first_name".
> $cgi_query->param('$item') returns a NULL
>
> while
>
> $cgi_query->param('first_name') returns
> first name from the form properly.
>
>I'm pretty sure this is just a weird variable subtitution syntax
>problem on my end.
You've quoted yourself in the foot, my friend. The single quotes
force a literal translation. Don't use them. Don't use double quotes
either -- "$item" -- when just...
$cgi_query->param($item)
...will do.
-- Tim Gim Yee tgy@chocobo.org
http://www.dragonfire.net/~tgy/moogle.html
"Will hack perl for a moogle stuffy, kupo!"
------------------------------
Date: Sun, 13 Apr 1997 11:38:24 GMT
From: tgy@chocobo.org (Tim Gim Yee)
Subject: Re: CGI Module - I have a syntax problem.
Message-Id: <3350c5ae.63397150@news.seanet.com>
On 13 Apr 1997 01:14:06 GMT, gdaswani@mail.odc.net (George Henry C.
Daswani) wrote:
>Problem is with the
>
> foreach $item (@checklist) {
> if ( $cgi_query->param('$item') eq "" ){
> ^^^^^^^^^
> This doesn't seem to work properly.
> even though at that loop $item = "first_name".
> $cgi_query->param('$item') returns a NULL
>
> while
>
> $cgi_query->param('first_name') returns
> first name from the form properly.
>
>I'm pretty sure this is just a weird variable subtitution syntax
>problem on my end.
You've quoted yourself in the foot, my friend. The single quotes
force a literal translation. Don't use them. Don't use double quotes
either -- "$item" -- when just...
$cgi_query->param($item)
...will do.
-- Tim Gim Yee tgy@chocobo.org
http://www.dragonfire.net/~tgy/moogle.html
"Will hack perl for a moogle stuffy, kupo!"
------------------------------
Date: Sun, 13 Apr 1997 05:29:11 -0300
From: Paul Ramsey <togtog@bewley.net>
Subject: Re: Could some one please help
Message-Id: <33509948.17D4@bewley.net>
> Hi
>
> Please could some one shed some light onto this problem. I'm trying to
> return some of the enviroment variables to my script using the following
> code
<SNIP>
> And when I run it I get the following error message...
<SNIP>
> CGI Error
>
> The specified CGI application misbehaved by not returning a complete set
> of HTTP headers. The headers it did return are:
I'm guessing that you are trying to access this outside a shell, ie a
web browser. If you have it print anything put 'print "Content-Type:
text/plain\n\n";' before the other prints. If you don't want it to print
anything then still put that line in. Hope this helps.
------------------------------
Date: 13 Apr 1997 13:11:40 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: Getting single keystroke
Message-Id: <5iqm2c$1l2@pirate.shu.edu>
Hello -
alecto@arlington.pe.net (D. Black) writes:
So there's two of us. Take *that*, N.V. Patwardhan! :-)
>root (root@localhost.localdomain) wrote:
>>It's outrageous that perl doesn't have a built-in function to get single
>>keystroke input from the keyboard. Thompson Automation's awk compiler
>>(TAWK) has getkey() and even QBasic has inkey$ to do the trick.
>>I've wasted the last few hours downloading, installing, and trying to
>>figure out how to use the term::ReadKey perl module from CPAN. If someone
>>could explain this to an irritated newbie, I give my thanks in advance.
>#! /usr/bin/perl
>print "\tType all ya want, only the first keystroke counts... \n";
>($a,@rest) = split //,<STDIN>;
>print "first letter was: $a\n";
I don't think this is what root wanted to do - I think s?he wanted
unbuffered input.
Quick example, subject to comment from anyone who has used this
module more than I have (which wouldn't take much):
#!/usr/local/bin/perl -w
use Term::ReadKey;
ReadMode 4; # go into raw mode
$key = ReadKey 0;
print "You typed $key\n";
ReadMode 0; # go back to normal
David Black
dblack@icarus.shu.edu
------------------------------
Date: Sun, 13 Apr 1997 11:24:30 GMT
From: len@clark.net (McWilliams)
Subject: Re: How can I create a C extension to Win32 Perl?
Message-Id: <5iqfiq$oe2@clarknet.clark.net>
I neglected to mention that I also have MS Visual C++ 4.0.
My OS is MS 4.0 Server SP2.
Len McWilliams
------------------------------
Date: Sun, 13 Apr 1997 10:13:29 GMT
From: please_do_not@email.me (sam)
Subject: Re: Match ?
Message-Id: <334bea36.5758254@newshub.ccs.yorku.ca>
On Thu, 03 Apr 1997 02:18:02 GMT, soccer@microserve.net (Geoffrey
Hebert) wrote:
>O.K. I should be able to read one of the books on perl and understand
>
>([^ ]*) What is this doing?
>
>Thanks
>
storing the first match in the variable $1
------------------------------
Date: Sun, 13 Apr 1997 11:38:28 GMT
From: tgy@chocobo.org (Tim Gim Yee)
Subject: Re: Newbie: Webify A Program?
Message-Id: <3350c5b1.63400805@news.seanet.com>
On 13 Apr 1997 01:53:11 GMT, "Jeff Oien" <jeffo@execpc.com> wrote:
>Hi,
>Here is a program based on one of the exercises in
>the Llama book. I have two questions.
>1. How can I get this to work within a browser
>environment either on the same page if possible or with
>the answer being stated in a new page. I'm familiar with
>the Content-type...print etc. but not sure how to put it
>in a form and run it.
This question would be better answered in a CGI newsgroup:
comp.infosystems.www.authoring.cgi
Or better yet, reading about it first:
http://hoohoo.ncsa.uiuc.edu/docs/cgi/overview.html
>2. Why doesn't this work when I eliminate the spaces
>in the $ax$b=$c so that it prints 3x2=6 (or whatever)?
print "${a}x$b=$c"; # in case perl thinks there's a variable $ax.
-- Tim Gim Yee tgy@chocobo.org
http://www.dragonfire.net/~tgy/moogle.html
"Will hack perl for a moogle stuffy, kupo!"
------------------------------
Date: Sun, 13 Apr 1997 06:47:52 -0700
From: "Charles F. Ritter" <critter@quack.kfu.com>
Subject: Re: Newbie: Webify A Program?
Message-Id: <3350E408.4314A540@quack.kfu.com>
Jeff Oien wrote:
> 2. Why doesn't this work when I eliminate the spaces
> in the $ax$b=$c so that it prints 3x2=6 (or whatever)?
> --------------
> print "I am a multiplication robot.\nPlease type in any number, then
> press Enter: ";
> chomp($a = <STDIN>);
> print "Please type in another number: ";
> chomp($b = <STDIN>);
> $c = $a * $b;
> print "$a x $b = $c\n";
> print "Yay!";
What you have here should work, but if you try to print $ax$b=$c perl
will print the value of $ax: an undefined scalar. Using perl with the
"-w" option gives better error messages.
---
Charles Ritter
Microsoft NT - when they are finally finished it will be the best
documented unix operating system on the market.
------------------------------
Date: 13 Apr 1997 13:30:28 +0000
From: Erik Naggum <erik@naggum.no>
Subject: Re: Ousterhout and Tcl lost the plot with latest paper
Message-Id: <3069927028655845@naggum.no>
* Chris Trimble
| Perl has its place -- as do Tcl, Python, C++, Scheme, and Self -- and
| is great for certain tasks. But, I agree with Ousterhout on this one:
| there is no end-all-be-all language out there.
BEOL and ENDOL -- the ultimate general purpose programming languages.
(not mine, I didn't keep notes of where I saw it first.)
#\Erik
--
I'm no longer young enough to know everything.
------------------------------
Date: Sun, 13 Apr 1997 15:35:26 GMT
From: rmang@lexiconn.com (Rob Mangiafico)
Subject: Perl Database Question
Message-Id: <5iqueq$fd4$1@news-s01.ca.us.ibm.net>
If I have a text database of say 20,000 one line records, and I want
to open the file and set the file pointer on say the 15,000 record,
what is the best way to go about this? I am using a text database and
making it searchable by 50 entries at a time, and if the 51st entry
is at line # 16,000, then it takes a while to search through the 1st
15,999 lines to get to this point. I would like to be able to open
the file and set the file pointer to line 16,000 to begin getting the
next xxx records. Basically I want to speed up the searching process
by setting the file pointer / cursor to a known location in the file
before resuming the search, instead of reading through the first
gazillion entries that I have already searched through.
Thanks in advance for any help/redirection of where to find a good
answer to this.
Sincerely,
Rob Mangiafico
rmang@lexiconn.com
------------------------------
Date: Sun, 13 Apr 1997 16:02:11 +0100
From: DJ Morgan <dmorgan@nght.demon.co.uk>
Subject: perl executable by core dump
Message-Id: <2dJE3AAzVPUzUwjj@nght.demon.co.uk>
A question about Perl
I Understand that under unix you can convert a perl script into a
executable binary by causing it to core dump and thereby have a compiled
version. Is this true and if yes how.
many thanks in advance to any sensible replys
--
DJ Morgan
------------------------------
Date: Sat, 12 Apr 1997 22:22:23 -0500
From: fl_aggie@hotmail.com (I R A Aggie)
Subject: Re: Perl-Books.
Message-Id: <fl_aggie-ya02408000R1204972222240001@news.fsu.edu>
In article <E8JEnv.2HF@nonexistent.com>, abigail@fnx.com wrote:
+ It makes me wonder, how suitable is Perl for teaching fundamental
+ programming concepts?
Not very. Perl will quite cheerfully hand you more than enough rope
to hang yourself.
James
--
Consulting Minster for Consultants, DNRC
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>
------------------------------
Date: 13 Apr 1997 16:00:40 +0300
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: Perl-Books.
Message-Id: <oeehghbulfr.fsf@alpha.hut.fi>
: Not very. Perl will quite cheerfully hand you more than enough rope
: to hang yourself.
"Got light?"
"Sure. Do you want 20 megaton or 50 megaton?"
--
$jhi++; # Jarkko Hietaniemi <URL:http://www.iki.fi/~jhi/>
# To each is given a bag of tools, A shapeless mass, and a book of rules,
# And each must make, ere life is flown, A stumbling-block or stepping-stone.
------------------------------
Date: 13 Apr 1997 06:39:11 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: Harsha Krishnamurthy <hxk1076@cacs.usl.edu>
Subject: Re: Perl2awk or Perl2sed translators
Message-Id: <8c912nrqio.fsf@gadget.cscaper.com>
>>>>> "Harsha" == Harsha Krishnamurthy <hxk1076@cacs.usl.edu> writes:
Harsha> I am aware of the availability of awk2Perl translator. But could
Harsha> anyone please let me know if there are Perl2awk or Perl2sed translators
Harsha> available somewhere ?
That'd be about as difficult as "english2perl". :-)
For example, what awk code would you generate for this Perl code?
use LWP::Simple;
getprint "http://www.stonehenge.com/merlyn/WebTechniques/";
Or better yet, I'd like to see sed try that. :-)
In case you're not following, every meaningful action of awk or sed
can be represented rather directly in Perl. The reverse is not true
at all.
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 506 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: Sun, 13 Apr 1997 13:32:53 +0100
From: cyber_surfer@gubbish.wildcard.demon.co.uk (Cyber Surfer)
Subject: Re: Reply to Ousterhout's reply (was Re: Ousterhout and Tcl ...)
Message-Id: <MPG.dbaa4deac2b5dc8989767@news.demon.co.uk>
With a mighty <tz8d8s0au6l.fsf@aimnet.com>,
nouser@nohost.nodomain uttered these wise words...
> Many people don't care about learning programming at the level of
> SICP; they simply want to get some particular problem done quickly.
> You may frown on them, but hands-on books like "Learn XYZ in 21 Days",
> "Writing CGI Scripts in XYZ", "Neural Networks in XYZ", "Database
> Programming in XYZ", and "GUI Apps in XYZ" are very useful to lots
> of people.
Yes, most people won't be as interested as I am in comiler theory.
That's one of those YMMV type things. The same goes for every other
kind of tutorial, which is why I mentioned K&R. Not everyone will
appreciate the difference between integers and pointes, so a book that
makes that point clear _may_ be better than another, which lets a
programmer think that tricks with pointers may be more "portable" than
they at first seem.
Some programmers might not be concerned with writing portable code at
all! However, I've used enough C compilers on enough different
machines to appreciate this issue. Even when you know which CPU and OS
you're using, and the compiler vendor, changes in the language itself
can trip you up. It's not for nothing that the C++ compiler I've use
most during the last year will give you "new behaviour" warnings, when
you give it code that earlier versions of the same compiler just
accepted without comment.
> Since I write software that is used by other people, the existence of
> such books is an important consideration when picking an extension
> language, because it saves me considerable time when documenting what
> I did when I can simply point at existing books for a lot of the
> functionality.
If I had the time, I'd write a "Lisp for Dummies" book. At least, I'd
attempt it. The result probably wouldn't get published, as I doubt
that I can communicate at that kind of level - not without a dummy to
test it on. Still, if I did do it, and failed, I could just put the
text in my homepage, where anyone can read it.
CGI scripts...now there's something I can write about. I might even be
able to find some "dummies" to proof read it - if I can pursuade them
to find the time. Alas, these are the people least likely to believe
that they _have_ the time for such things, and they won't know
otherwise until they read it, assuming that it _is_ readable etc.
Hmm. Watch this space...
--
<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: 13 Apr 1997 12:48:45 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Split a line on "^M"
Message-Id: <5iqknd$ra5$3@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, nvp@shore.net (Nathan V. Patwardhan) writes:
:Do these lines end in \r\n or just \r?
:If they end in just \r, you can do:
:@result = split(/\r/, $line_to_split);
Be aware that it is rather hard to read a line with a "\r" in
it, or even a "\r\n". Barring raw mode processing, some place
between your kernel, the tty driver, and the C library, these
things get converted into the virtual "\n", to make for easier
processing.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
s = (unsigned char*)(SvPVX(sv)); /* deeper magic */
--Larry Wall, from util.c in the v5.0 perl distribution
------------------------------
Date: 13 Apr 1997 15:11:57 GMT
From: Jarkko Hietaniemi <jhi@iki.fi>
Subject: the new version of the BSD::Resource 1.05 announcement
Message-Id: <5iqt3t$7nj$1@nadine.teleport.com>
The module BSD::Resource has been updated to version 1.05.
The BSD::Resource gives an interface to the BSD process resource and
priority control functions
getrusage()
getrlimit() setrlimit()
getpriority() setpriority()
Issues addressed in this release:
- portability
(now: AIX, Digital UNIX, FreeBSD, HP-UX, IRIX, Linux, Solaris, SunOS)
- 64-bit resource limits (Digital UNIX, FreeBSD, IRIX)
- object oriented interfaces added: $ru->stime
- more rlimits recognized if available (NPROC, MEMLOCK)
- get_rlimits() function to list all the available rlimits
- documentation enhancements
The new release is available from
http://www.perl.com/CPAN/modules/by-module/BSD/BSD-Resource-1.05.tar.gz
Enjoy.
--
$jhi++; # Jarkko Hietaniemi <URL:http://www.iki.fi/~jhi/>
# To each is given a bag of tools, A shapeless mass, and a book of rules,
# And each must make, ere life is flown, A stumbling-block or stepping-stone.
------------------------------
Date: 13 Apr 1997 11:38:27 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Transliterate from a pattern?
Message-Id: <5iqgjj$ra5$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Andrew Johnson <ajohnson@gpu.srv.ualberta.ca> writes:
:$str=~s/^\s*//;
:$str=~s/\s*$//;
You mean:
for ($str) {
s/^\s+//;
s/\s+$//;
}
Note the plus where you had a star.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
echo $package has manual pages available in source form.
echo "However, you don't have nroff, so they're probably useless to you."
--Larry Wall in Configure from the perl distribution
------------------------------
Date: Sat, 12 Apr 1997 19:41:06 -0700
From: Devin Ben-Hur <dbenhur@egames.com>
Subject: Re: Transliterate from a pattern?
Message-Id: <335047C2.31D6@egames.com>
Devin Ben-Hur wrote:
> This is generally considered the clearest and most
> efficient way to strip leading & trailing spaces from
> a string:
> $str =~ s/^\w+//; $str =~ s/\w+$//;
Opps! I meant \s, not \w, of course. :)
--
Devin Ben-Hur <dbenhur@egames.com>
eGames.com, Inc. http://www.egames.com/
eMarketing, Inc. http://www.emarket.com/
"It's people like you wot cause unrest!"
------------------------------
Date: Sun, 13 Apr 1997 10:13:31 GMT
From: posenj@lancet.co.za (Kevin Posen)
Subject: Tutorial on OmniHTTP?
Message-Id: <3350b13e.1845400@news.saix.net>
Hi.
I downloaded OmniHTTP to use on a PC with Windows '95. I tried to set it up
but it did not work.
Does anyone know of a tutorial for OmniHTTP, bearing in mind that I know
nothing about Unix or servers?
Thanks,
Kevin Posen
------------------------------
Date: 13 Apr 1997 13:26:43 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Tutorial on OmniHTTP?
Message-Id: <5iqmuj$9rj@fridge-nf0.shore.net>
Kevin Posen (posenj@lancet.co.za) wrote:
: I downloaded OmniHTTP to use on a PC with Windows '95. I tried to set it up
: but it did not work.
I'm sorry to hear that. :-(
: Does anyone know of a tutorial for OmniHTTP, bearing in mind that I know
: nothing about Unix or servers?
I'd suggest rolling over and going back to sleep until the bandwagon
leaves town. :-)
Seriously, you should really consider posting this question to:
comp.infosystems.www.servers.misc
[followups set]
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
Date: 13 Apr 1997 11:56:07 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Unexpected Behavior using open ()
Message-Id: <5iqhkn$ra5$2@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Bob Minnick <bobmi@digital-cafe.com> writes:
:Geetings,
: Can someone explain this behavior to me? It was unexpected to say the
:least.
:
: Considering the following code fragment;
:
: if (open (FILE, "filename.dat)) ----> this works fine, opens the file
:for reading.
:
: But when I wanted to open the file for reading & writing;
:
: if (open (FILE, "+>filename.dat))
:
: This statement allowed me to read the file, but it also emptied the
:file! Can someone tell me why it emptied the file?
Because you *told* it to. Did you read the entry for open in
the perlfunc manpage? Did you read the FAQ? Here's the FAQ
entry for that:
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.
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.
: Also, does anyone have any thoughts on file locking to prevent
:concurrency problems? I am assembling a system which may require
:multiple users to be accessing the same data file at the same time.
Did you read what the FAQ says on file locking?
: If I can't get this thing to allow me to read a multiline file, and
:rewrite a single line without having to rewrite the entire file, it's
:going to be a nightmare. (ie file semaphoring)
Why is that a nightmare?
A text file is not a fixed format file. The records are of different
lengths. You cannot hope to insert or delete lines from a file (well,
unless at the end). The best you can do is modify *WITH THE EXACT SAME
NUMBER OF BYTES AS THE ORIGINAL*. As soon as that stipulation fails,
you lose, and *must* rewrite the file.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
if (rsfp = mypopen("/bin/mail root","w")) { /* heh, heh */
--Larry Wall in perl.c from the perl source code
------------------------------
Date: 13 Apr 1997 12:51:01 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Unique Filename
Message-Id: <5iqkrl$ra5$4@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, dloud@erols.com writes:
:Anyone have ideas on how to generate unique filenames limited to 8.3
:notation?
$fname = sprintf("%08d.DUM", $count++);
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
You want it in one line? Does it have to fit in 80 columns? :-)
--Larry Wall in <7349@jpl-devvax.JPL.NASA.GOV>
------------------------------
Date: 13 Apr 1997 13:19:36 GMT
From: "Marcel Lette" <0lette01@almere.flnet.nl>
Subject: Re: Unix and ease of use (WAS: Who makes more ...)
Message-Id: <01bc47f1$f44feb60$LocalHost@default>
Steve Mading <madings@earth.execpc.com> wrote in article
<5iof70$h2b$1@earth.execpc.com>...
| compare:
| x = func1(); y = func2(); z = func3();
| w = func( x, y, z );
| with:
| w = func( func1(), func2(), func3() );
The shit hits the fan now dude, in example 1 you force the sequence in
which the procedures are executed.
In example 2 you leave it to the whim of the compiler creator !!!! There is
NO garantee in execution order here.
------------------------------
Date: 13 Apr 1997 15:39:40 GMT
From: sinecto@[anti-spam coating, remove before use]clark.net
Subject: Re: Unix and ease of use (WAS: Who makes more ...)
Message-Id: <5iquns$dk9@clarknet.clark.net>
We have a somewhat related question about marketing new software
technology. We have developed a new type of client-server architecture,
which we call reciprocal client-server architecture, which allows conversion
of existing Windows or X11/Unix into network applications automatically
without recoding. The resulting applications can be "published" to intranets
or internet and will behave for all intents and purposes as Java or Active-X
applets. The technology allows one to do anything that a regular Windows or
X11/Unix apps can do, including information delivery, but is very secure
against unauthorized access or code pilfering, etc...
The technology combines the strengths of both UNIX and Windows.
The question is how to approach the marketing issues of this software
considering that Sun Microsystems and Microsoft have their marketing
machines all oiled up and going at 200mph in convincing the public and
corporate world that they actually want to spend billions of dollars to
recode all their software in Java or Active-X or some other new fashionable
toy of the day, or spend additional trillions in purchasing new hot Java
chips?
One may think that corporations would love to save money, but the managers
are usually advised by programmers who decided that it might be fun to
rewrite everything (and get paid a lot) instead of saving their company's
funds.
One choice is to beat on the doors of giants until one or two see the light,
the second choice is to simply start publishing application services
(which we will start doing in the 4th quarter of this year).
Any advice???
------------------------------
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 292
*************************************