[9332] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 2927 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jun 21 15:07:48 1998

Date: Sun, 21 Jun 98 12:00:29 -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, 21 Jun 1998     Volume: 8 Number: 2927

Today's topics:
        [Q] Globbing in CGI (listing content of dir), why full  <schan_ca@rocketmail.com>
    Re: [Q] On WAKING a sleeping process... (Ronald J Kimball)
    Re: Command line substitution thru subdirectories (Josh Kortbein)
    Re: Dave Roth's AdminMisc <rootbeer@teleport.com>
    Re: Doing the work (was Re: Foreach Efficiency) (Josh Kortbein)
    Re: first language (Jason E. Steele)
    Re: first language <pfaffben@pilot.msu.edu>
    Re: first language (Ronald J Kimball)
    Re: first language <sunil@raos.demon.co.uk>
    Re: first language <tchrist@mox.perl.com>
    Re: first language <gfenwick@BYESPAMprimex.co.uk>
    Re: Flames.... (Chip Salzenberg)
    Re: Flames.... <mike.schleif@aquila.com>
    Re: Flames.... <rootbeer@teleport.com>
    Re: Perl and Earth 2025 <rootbeer@teleport.com>
    Re: Perl and Earth 2025 (Andy Lester)
    Re: Perl and Earth 2025 (Josh Kortbein)
    Re: Pod::Text -- Unix only? <ravn@imada.ou.dk>
    Re: Problem with space in front of each line of text. (Ronald J Kimball)
        problems with flock <pozuelo@email.enst.fr>
    Re: problems with flock (Larry Rosler)
    Re: Provider Database on the Web <rootbeer@teleport.com>
    Re: traveling portable <bowlin@sirius.com>
    Re: Unneeded floppy access <jdf@pobox.com>
        Will Perl to C conversion accelarate my cgi script ? <raszuk@cisco.com>
    Re: Working With Hash <jdf@pobox.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sun, 21 Jun 1998 18:51:28 GMT
From: "Stephen_Chan" <schan_ca@rocketmail.com>
Subject: [Q] Globbing in CGI (listing content of dir), why full path?
Message-Id: <01bd9d45$4f996880$1ef5aecc@direct.ca.direct.ca>

Hello:

I want my CGI to list the content of a server directory.
When I glob, I have to list full path:

           @listing = </home/someuser/public_html/cgi-bin/directory/*>;

this won't work:
 
           @listing = <directory/*>;

this won't work:

           chdir("directory");
           @listing = <*>;

Why is this? How do I get around having to use the full path?

Thanks in advance.
Stephen
          







------------------------------

Date: Sun, 21 Jun 1998 13:41:19 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: [Q] On WAKING a sleeping process...
Message-Id: <1daz5s9.v25inswetkw0N@bay2-133.quincy.ziplink.net>

Mark-Jason Dominus <mjd@op.net> wrote:

>         my $rc = select (1<<fileno(F)), undef, undef, $nap_time;

That is the single-argument select, followed by three expressions in
void context.

my $rc = select 1<<fileno(F), undef, undef, $nap_time;

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


------------------------------

Date: 21 Jun 1998 18:49:45 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: Command line substitution thru subdirectories
Message-Id: <6mjkk9$rme$3@news.iastate.edu>

Lloyd Zusman (ljz@asfast.com) wrote:
: for help.  In other words, I believe that the main reason that so many
: such users come here is because you folks have done a much better job
: of creating something useful and usable than the C++, shell, and
: Fortran creators did.
  ^^^^^^^

That's an understatement.


Josh

_________________________________________________________
I do not trust your bitch.
	- Frederich Nietzche, in _Also Sprach Zarathustra_



------------------------------

Date: Sun, 21 Jun 1998 17:42:15 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Dave Roth's AdminMisc
Message-Id: <Pine.GSO.3.96.980621103856.8650D-100000@user2.teleport.com>

On Sun, 21 Jun 1998, Steve Sulman wrote:

> If this is not the correct forum (apologies!), are there any more
> suitable groups or mailing lists that I can try?

In this case, I'd recommend contacting the program's author. Good luck!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

Date: 21 Jun 1998 18:30:19 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: Doing the work (was Re: Foreach Efficiency)
Message-Id: <6mjjfr$rme$2@news.iastate.edu>

Ronald J Kimball (rjk@coos.dartmouth.edu) wrote:
: Josh Kortbein <kortbein@iastate.edu> wrote:

: > Ronald J Kimball (rjk@coos.dartmouth.edu) wrote:
: >
: > : In other words, you're foisting off all the work onto us.  Thank you so
: > : much.
: > 
: > It's only work foisted if you bite the hook. If your time was that
: > important, would you even be replying to questions at all? Or discussing
: > your replies to them?

: I thought this thread had died.  Oh well.  :-)

Well, sorry. I'm a little slow about reading this group. Too many posts
saying "fuck you, read the manual" to sort through.

: No, it's only work if I try to write the poster's program for him.  If I
: just point out that he is asking us to do the work for him, that's not
: actually doing any work on my part.

I'm referring to work in the more fundamental sense - that of a physicist
or a manager. :) Why not just ignore requests like that, and do the minimum
amount of work, that of hitting your newsreader's delete key?


Josh


_________________________________________________________
I do not trust your bitch.
	- Frederich Nietzche, in _Also Sprach Zarathustra_



------------------------------

Date: 21 Jun 1998 12:19:38 -0500
From: jesteel@compugen.net (Jason E. Steele)
Subject: Re: first language
Message-Id: <paxvhpuhdud.fsf@scotty.i-did-not-set--mail-host-address--so-shoot-me>

beppu@rigel.oac.uci.edu (John Beppu) writes:
[SNIP]
>     I am of the opinion that the best way to become familiar with
>     pointers is to learn an assembly language of the architecture
>     you use most often.  I knew x86 assembly before I knew C, but
>     moving to C from assembly was not a problem.  A lot of times,
>     I found myself thinking, "this is kinda like assembly" while
>     learning C.

I'll second that.  I learned 6809 assembly before I learned C and
once I connected pointers in C with analagous concepts in assembly, I
had very little trouble with them.

Of course, that works with other things as well.  I was a physics
(i.e. math) major before I was a computer science major.  I remember 
the first time I saw recursion, I said, "Hey, this looks sort of like
proof by induction."

-- 
Jason E. Steele
jesteel@compugen.net


------------------------------

Date: 21 Jun 1998 13:23:40 -0400
From: Ben Pfaff <pfaffben@pilot.msu.edu>
Subject: Re: first language
Message-Id: <87btrmpt2b.fsf@dial1.msu.edu>

   Of course, that works with other things as well.  I was a physics
   (i.e. math) major before I was a computer science major.  I remember 
   the first time I saw recursion, I said, "Hey, this looks sort of like
   proof by induction."

That's funny: I was a programmer long before I learned serious math.
The first time I saw proof by induction, I said, ``Hey, this looks
sort of like recursion.''


------------------------------

Date: Sun, 21 Jun 1998 13:41:21 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: first language
Message-Id: <1daz64b.1xyq4trko5v7bN@bay2-133.quincy.ziplink.net>

Larry Rosler <lr@hpl.hp.com> wrote:

> Sample of one, unfortunately.  My kids started with Basic, which (as 
> Dijkstra says) is a terminal disease.  They are *not* professional 
> programmers. :-)

I started with BASIC, and I *am* a professional programmer.  :-P

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


------------------------------

Date: Sun, 21 Jun 1998 18:38:30 +0100
From: Sunil Rao <sunil@raos.demon.co.uk>
Subject: Re: first language
Message-Id: <UZ1YluBWUUj1Ew2s@raos.demon.co.uk>

Ben Pfaff <pfaffben@pilot.msu.edu> wrote, and I reply...
>   Of course, that works with other things as well.  I was a physics
>   (i.e. math) major before I was a computer science major.  I remember 
>   the first time I saw recursion, I said, "Hey, this looks sort of like
>   proof by induction."
>
>That's funny: I was a programmer long before I learned serious math.
>The first time I saw proof by induction, I said, ``Hey, this looks
>sort of like recursion.''

funny... to me they always seemed to be quite separate and different.
until one day it all clicked together. i was using both Proof by
Induction and Recursion for months before the connection clicked...

but the first thing that came to mind when i saw recursion was
Recurrence Relations... the conenction with Induction was not
immediately apparent to me... :(

-- 
"I see you have books under your arm, brother. It is indeed a rare pleasure 
these days to come across somebody that still reads, brother."

        - Anthony Burgess


------------------------------

Date: 21 Jun 1998 17:55:23 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: first language
Message-Id: <6mjheb$shg$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    rjk@coos.dartmouth.edu (Ronald J Kimball) writes:
:I started with BASIC, and I *am* a professional programmer.  :-P

So did Larry.  So did Randal.  So did I.

I first learned BASIC (BASIC-PLUS under RSTS/E), followed by Fortran,
Pascal (UCSD Pascal), and both PDP-11 and Z-80 assemblers before I even
started on C, which was in turn then followed by sh, csh, awk, REXX, lisp,
and so many others that I long ago lost count.  I don't know whether C
would have made as much sense without that prior BASIC/Pascal/assembler
background.  I don't know whether Perl would have made as much sense
without the prior C/sh/awk background.

Of course, I have never understood why anyone thinks they need anything
but K&R to learn C, either.  :-)

--tom
-- 
    If you want to program in C, program in C.  It's a nice language.  I
    use it occasionally...   :-)
            --Larry Wall in <7577@jpl-devvax.JPL.NASA.GOV>


------------------------------

Date: Sun, 21 Jun 1998 18:56:52 +0100
From: "Graeme Fenwick" <gfenwick@BYESPAMprimex.co.uk>
Subject: Re: first language
Message-Id: <358d4b9b.0@scooby.nildram.co.uk>

sylvainp@mypc.microtec.net wrote in message
<358d0d34.3153899@news.microtec.net>...
> [assembly] introduced a hurdle when I tried
>to learn C the first time, to the point where I abandoned it for a
>couple of year. I was too thinking physical memory too much and it
>made pointer arithmetic hard to grasp. I had a very hard time
>understanding why adding 1 to a pointer would not just increment it by
>one byte.


I can kind of sympathise- knowing how the machine works and being aware of
the dual high/low level nature of C means you start to think about things
too deeply at an early stage (if you can still find my recent post "A few C
questions"- probably gone by now- you'll see the way I approach the
language), and worrying about things that probably don't matter at that
stage. Quite often now, although I initially saw C as more high level, I
tend to automatically assume things are done at a much lower level, and then
I think "Oh, I don't have to worry about that, the compiler will
automatically promote it", and so on....
When I was learning BASIC I just didn't think that way. I just played around
with it- the downside with that was I never learned a lot of important
things, and I caught the terrible "8-bit-BASIC-with-no-procedures" bug of
using GOTO and writing code at the machine, only having a semi-formed idea
of the specification of the game (or whatever), let alone the algorithm, let
alone the pseudo-code, let alone the code!!!!!
When I first got Turbo Basic for my Atari XL (which added procedures to the
previously GOTO/GOSUB only Atari BASIC), I sat down and wrote an algorithm
for my program, and I was gobsmacked how easy it was to debug.
Did I learn from that? Did I ****!!!
I wish, when I had first been taught about pseudocode etc, that they had
pointed out that, although it was a bit boring if you were used to writing
code straight off, the pay-off in terms of debugging and ability to improve
your program (and general lack of what-the-***-am-I-looking-at type
spaghetti code)
easily justified the time spent working out algorithms, charts, proper specs
etc.
In fact, I've noticed (now that I'm getting back into programming) that most
of the problems in my code are evident at the algorithm stage, and a hell of
a lot easier to correct when they're still in plain English.

All that having been said (more than enough...!),  I don't think that a good
structured BASIC is *that* bad a language to start off with. If anyone out
there can successfully teach C to programming novices, they have my respect,
because I reckon it needs a bit too much understanding of a number of
computer concepts, and I'm not sure about Pascal. Just make it clear *why*
they should be using good programming practice, and that they are following
it, and I don't believe there is such a thing as a totally bad language.

Enough enough waffle. If I'd planned all that out completely I could have
said what I'd wanted to in half the space ;-)

>C is mother, C is father.

??!

-Graeme Fenwick




------------------------------

Date: Sun, 21 Jun 1998 17:00:00 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Flames....
Message-Id: <6mje9c$62f$1@cyprus.atlantic.net>

According to ames0009@tc.umn.edu:
>Your response also displays the "I'm so smart--you're so stupid"
>attitude ...

Why should a demand that petitioners exert some effort be interpreted
as a put-down?

Why should it be too much to expect that a person wanting to learn
about a *programming*language* know how to grep?!
-- 
Chip Salzenberg                - a.k.a. -               <chip@pobox.com>
"I brought the atom bomb.  I think it's a good time to use it."  //MST3K
           ->  Ask me about Perl training and consulting  <-
     Like Perl?  Want to help out?  The Perl Institute: www.perl.org


------------------------------

Date: Sun, 21 Jun 1998 18:02:19 GMT
From: "Michael D. Schleif" <mike.schleif@aquila.com>
Subject: Re: Flames....
Message-Id: <358D49FA.41263B84@aquila.com>

NEEDLE vs. NEEDLES IN THE HAYSTACK ==>

'grep' is a fine tool; but, if it was the be-all, end-all that many perl
illuminati profess, why do we need Perl?  To process only that which
we've grepped?

Let's assume, for a moment, that 'grep' is the perfect solution.  Also,
you are all right, many who post herein are NOT familiar with grep, and
do NOT know how to use it.  Whence shall they learn?  Where is the grep
FAQ?  tutorial?  Build their own in Perl, Tom?  And this to those who
cannot get beyond "hello, world?"

If 'grep' is the perfect answer, I fail to see why Yahoo, Infoseek and
others even bother.  Let's trash WWW, go back to gopher and daily send
out millions of grep queries to every Internet address in hopes of
grepping that which we want to know.  Want to buy something over the
Internet?  Why not wade through millions of possible IP addresses and
grep for your best price?

Let's face it, electronic media is NOT soon to replace the printed
word.  When I have a Perl question, my first resources are the
following: Camel, Owl, Panther and EPP.  Then I try to wade through MB's
of electronic, textual documentation.  Why paper first?  I am not
certain; but, I suspect that I am not alone.  Hey, guys, how do I grep
the Camel?  Nevertheless, the index therein is rather weak; but, once I
find something there, I am back to my keyboard trying various
permutations until, either I solve that challenge or I seek another
alternative.

As much as some of you may want to believe that all of this grepping
falls under "Prerequisites to using your computer..." -- I have news for
you: computers are all pervasive, and people are using computers,
computers are adding value to peoples' lives, and only < 0.1% of
computer users are likely to ever know what is 'grep!'  Do you think
that you, illuminati, are the only ones who know "how to use a
computer?"

Let's just take an example from my recent sinner's past:
	92 occurrences of 'numeric' in *.pod
	408 occurrences of 'number' in *.pod

Is it enough to know that my needle is IN the haystack?  Is it
interesting that there are also several other needles IN that same
haystack?  Does it matter that the ratio of straw to needle(s) is still
very large?  All I care about is finding my needle.  Yes, I must do some
work on my own -- grep will NOT write my program.

I am NOT criticizing the available documentation, which is far more
extensive and illustrative than any other IT medium of which I am
aware.  ALL OF YOU MUST BE COMMENDED FOR DOCUMENTING all that you have. 
That is a GOOD thing.  But, you illuminati know what is there, because
you put it there.  Others have found it and assume that, once found, it
must be easy for everyone to find it.  Some read the documentation and
buzz right past that place containing their answer, because they do NOT
recognize their answer for what it is . . .

To the point: When reading "stupid" newsgroup postings, either post a
truly constructive reply, or remain mute.

I firmly believe that if NOBODY responds to a posting, the poster will
soon go away -- if that is what you want, don't stir them up, prompting
them to continue in your newsgroup by posting further, in defense of
their spat upon honor -- they will only stick around longer and irritate
you further.  Surely, you do not get paid enough for that . . .

Maybe it would be "nice" if more people became Perl proficient?

Tom Christiansen wrote:
> 
> grep and ye shall find.
> 
> --tom
> --
> "A momentary lapse of stupidity" -- Dean Roehrich

-- 

Best Regards,

mds
mds resource
888.250.3987

"Dare to fix things before they break . . . "

"Our capacity for understanding is inversely proportional to how much we
think we know.  The more I know, the more I know I don't know . . . "


------------------------------

Date: Sun, 21 Jun 1998 18:02:45 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Flames....
Message-Id: <Pine.GSO.3.96.980621104639.8650F-100000@user2.teleport.com>

On 21 Jun 1998, Michael J Gebis wrote:

> Tom Phoenix <rootbeer@teleport.com> writes [about finding answers in
> the available docs] :

> }A _few_ things may be hard to find, but the vast majority are 
> }easy to grep within a few seconds.
> 
> Not so fast, bub.  This is wrong.  

After reading your message, I considered my statement a second time. No, I
stand by my statement. Although I'd make an exception for someone who
merely can't think of the proper keyword or synonym, if you're clever
enough to program in Perl, you're clever enough to use your computer to
search the docs for keywords.

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

Date: Sun, 21 Jun 1998 17:43:57 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Perl and Earth 2025
Message-Id: <Pine.GSO.3.96.980621104319.8650E-100000@user2.teleport.com>

On 21 Jun 1998, Poucarda wrote:

> I want to write a game like the webgame Earth 2025 
> (http://www.solarianet.com/earth/) in Perl.
> However im not sure it's possible in Perl...
> could one of you guys take a look at this game
> and tell me if it is possible?

The FAQ gives some guidelines on how to tell whether Perl is the right
tool for a given task. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

Date: 21 Jun 1998 18:28:27 GMT
From: petdance@maxx.mc.net (Andy Lester)
Subject: Re: Perl and Earth 2025
Message-Id: <6mjjcb$5k2$1@supernews.com>

: # I want to write a game like the webgame Earth 2025 
: # (http://www.solarianet.com/earth/) in Perl.
: # However im not sure it's possible in Perl...
: # could one of you guys take a look at this game
: # and tell me if it is possible?

: No.

It's not possible using U.S. Standard Perl, but I think if you buy the
Online Game Add-On Pack (OGAOP), it should be OK.  

Let us know.

xoxo,
Andy


--
-- 
Andy Lester:        <andy@petdance.com>       http://tezcat.com/~andy/
Chicago Shows List: <shows@ChicagoMusic.com>  http://ChicagoMusic.com/



------------------------------

Date: 21 Jun 1998 18:26:35 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: Perl and Earth 2025
Message-Id: <6mjj8r$rme$1@news.iastate.edu>

Poucarda (poucarda@concepts.nl) wrote:
: Hello all. 

: I want to write a game like the webgame Earth 2025 
: (http://www.solarianet.com/earth/) in Perl.
: However im not sure it's possible in Perl...
: could one of you guys take a look at this game
: and tell me if it is possible?

It looks like it, but only if you use Java.
And sockets. Yeah, sockets.



Josh

--

_________________________________________________________
I do not trust your bitch.
	- Frederich Nietzche, in _Also Sprach Zarathustra_



------------------------------

Date: Sun, 21 Jun 1998 19:27:51 +0200
From: Thorbjoern Ravn Andersen <ravn@imada.ou.dk>
Subject: Re: Pod::Text -- Unix only?
Message-Id: <358D4297.1CFB@imada.ou.dk>

lvirden@cas.org wrote:
> 
> According to  <pehanna@my-dejanews.com>:
> :Is there any particular reason why Pod::Text uses "stty -a 2>/dev/null" as a
> :one of its means of determining the screen width?  Is there a portable
> :alternative?
> 
> This is a common problem on Unix / X window system environment.  For instance,
> stty -a isn't of much use when I telnet from my workstation into
> someone else's, unless I specifically have hand set stty to reflect my
> rows and columns.  The same goes for expecting to find environment
> variables of ROWS and COLUMNS.
> 
> Wouldn't it be nice if xterm/rxvt/dtterm and so forth had an escape
> sequence to report it's size....

I think the resize command (as in "eval `resize`") not use a stock VT100
escape sequence to read the screen size.

Perhaps it would be easy to look in the source code from XFree86
perhaps?
--
  Thorbjxrn Ravn Andersen               "...and...Tubular Bells!"
  http://www.mip.ou.dk/~ravn/
  <<Replies get spamfiltered.  See URL for fast reply-address>>


------------------------------

Date: Sun, 21 Jun 1998 13:41:22 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Problem with space in front of each line of text.
Message-Id: <1daz6tp.1vb1gv510k3eqoN@bay2-133.quincy.ziplink.net>

[posted and mailed]

Leon Stepanian <info@purco.qc.ca> wrote:

> print "<TEXTAREA COLS=70 ROWS=20
> name=\"c_text\">@holdfile</TEXTAREA>\n";

Look up $" in the perlvar documentation, and then change this line to:

print '<TEXTAREA COLS=70 ROWS=20 name="c_text">',
       @holdfile, "</TEXTAREA>\n";


-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


------------------------------

Date: Sun, 21 Jun 1998 20:12:14 +0200
From: Jaime Pozuelo-Monfort <pozuelo@email.enst.fr>
Subject: problems with flock
Message-Id: <358D4CFE.E69F2435@email.enst.fr>

  Hello everybody!

    This is the first time I write to this discussion group...

    I have a problem with the function flock that belongs to the Fcnl
package. I hope any of you guys can help me.

    I've got a couple files that are accessed by many people. Every user

calls a script that opens both of them, then writes some data, then
closes them, and finally does an html redirection, so that a web page is

refreshed with the new data.

    In order to allow multiple access I thought it would be fine to use
the function flock. This is pretty much what my script looks like:
________________________________
#!/usr/local/bin/perl -w
use Fcntl; #imports
use CGI(:standard); #for the redirection

open (FILE1, ">file_1");
flock (FILE1, 2);
open (FILE2, ">file_2");
flock (FILE2, 2);

#now I overwrite the new data on both files
 ...

#now I do the redirection
print redirect(-url => "http://www.enst.fr/~pozuelo/... ");

#I unlock and close the files
flock(FILE1, 8);
close(FILE1);
flock(FILE2,8);
close(FILE2);
_________________________________

    Well, the script is quite simple, but it doesn't work. I've read
somewhere that flock(FILEHANDLE, 2) is the same as flock(FILEHANDLE,
LOCK_EX), as well as flock(FILEHANDLE,8) works like flock(FILEHANDLE,
LOCK_NB). I use the numeric values rather than the string variables cos
the latter don't work on my system (Solaris).

    By the way, when I say it doesn't work I mean the following: say
User1 and User2 execute the script at almost the same time. What
actually happens is that after both of them have opened the files,
changed the data and done the redirection, both of them see the same
information, what implies that the files have not been well-locked by
the flock function. It might be a problem of the redirect function, I
ain't know...

    I know flock is the right function to use, but I'm still doing
something wrong to lock and afterwards unlock the files.

    Do you have the answer to this dilemma? if so please let me know...

    Jaime





------------------------------

Date: Sun, 21 Jun 1998 11:49:47 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: problems with flock
Message-Id: <MPG.ff6f5a1725b251f9896dc@nntp.hpl.hp.com>

In article <358D4CFE.E69F2435@email.enst.fr>, Jaime Pozuelo-Monfort 
<pozuelo@email.enst.fr> says...
 ...
> #I unlock and close the files
> flock(FILE1, 8);
> close(FILE1);
> flock(FILE2,8);
> close(FILE2);

I don't know how the redirection affects your problem.  But I do know 
that you should *not* unlock the files.  Just close them, which flushes 
the buffers and then releases the locks.  The way you have it, another 
script can intervene between the unlock and the close, and mess things 
up.

-- 
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Sun, 21 Jun 1998 18:09:54 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Provider Database on the Web
Message-Id: <Pine.GSO.3.96.980621110642.8650H-100000@user2.teleport.com>

On Sun, 21 Jun 1998, Gerhard Poul wrote:

> Can you please tell me which is the best way to bring a provider
> database to the web??

Define "best". What's best for me may not be best for you, and there's no
point in any of us wasting our time until you can say just what you want.

You may need to choose among fastest, most memory efficient, easiest to
program, fewest lines of code, most robust, most portable, easiest to
debug, easiest to maintain, most like your other favorite programming
languages, or perhaps you mean some other criterion. (Of course, one
solution may fall into more than one of these categories.) 

Of course, if you don't _require_ your solution to be in Perl, perhaps you
should ask in a web-related or database-related newsgroup. 

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

Date: Sun, 21 Jun 1998 09:48:05 -0700
From: Jim Bowlin <bowlin@sirius.com>
Subject: Re: traveling portable
Message-Id: <358D3945.19234297@sirius.com>

Scott wrote:
> 
> I travel around the country with my laptop, and I was wondering if there was
> some way in perl that I could make the changes to windows 95:
> 
> [ a list of things]

I would suggest looking in the registry for values that contain
the data you want to change.  It is pretty easy to write a Perl
program to grep the registry (one was posted here a couple of weeks
ago).  Once you find what you are looking for, you just need to
write a little program to change those registry values.

I can read the registry with the standard Perl distribution, but
I have had no luck writing to it.  I have been able to do both
with the ActiveState distribution.  The interface to the registry
functions differs between the two distributions.

HTH -- Jim Bowlin

> drop the 'anchor' if you wish to reply by e-mail, but I monitor the
> newsgroup fairly often

If you drop the anchor, I will cc next time. :)


------------------------------

Date: 21 Jun 1998 12:07:08 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: Jean Bausch <Jean_Bausch@csi.com>
Subject: Re: Unneeded floppy access
Message-Id: <67hu3cqr.fsf@mailhost.panix.com>

Jean Bausch <Jean_Bausch@csi.com> writes:

> The PERL program
> 
>     print `dir /w c:`;
> 
> accesses my floppy drive (which is NOT c:), then gives me the correct
> output. The same happens for other command functions.

There was just a thread about this in this very newsgroup.  It's not
related to Perl, though: it most likely has to do with your antivirus
software.  HTH.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf/


------------------------------

Date: Sun, 21 Jun 1998 11:43:54 -0700
From: Robert Raszuk <raszuk@cisco.com>
Subject: Will Perl to C conversion accelarate my cgi script ?
Message-Id: <358D546A.C53EBF58@cisco.com>

I have a few cgi scripts which parses 1 text file and send back the
filtered output to the browser. How can I make the opening and closing
as well as parsing a little bit faster. (Currently it takes 15 sec.)

Also how can I quickly send a pre-prepared html file to the browser with
a perl cgi script ? (Currently when using open and while it takes 8
sec).

If Perl to C is the answer what tool can I use to quickly do the
conversion ?

Thanks,
Robert

--
_____________________________________________________________________

     |          |         Robert Raszuk, CCIE #3690
    :|:        :|:        NSA, Network Consulting Engineer
   :|||:      :|||:       170 W. Tasman Dr. San Jose, CA 95134 C2
 .:|||||||:..:|||||||:.    Phone: 408-525-7588     Pager: 800-365-4578
C I S C O S Y S T E M S   Email: raszuk@cisco.com http://poland
_____________________________________________________________________




------------------------------

Date: 21 Jun 1998 12:00:04 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: luckys@geocities.com
Subject: Re: Working With Hash
Message-Id: <af763d2j.fsf@mailhost.panix.com>

Luckys <luckys@geocities.com> writes:

> I'm working with hash 
      ^^^^^^^ ^^^^
We used to call it "smoking" back in college, but whatever.

> in reference with a DBM file and have been able to successfuly read
> and write associative arrays to it.
            ^^^^^^^^^^^ ^^^^^^
We used to call them associative arrays back in SNOBOL, but whatever.

> I can't, however, edit already
> existing arrays within it (edit the value portion of it).

   #!//c/perl/bin/perl -w
   use SDBM_File;
   use Fcntl;

   my $sdbm_file = 'test.dbmx';
   my $key = 'A12345';

   tie %h, 'SDBM_File', $sdbm_file, O_CREAT|O_RDWR, 0640;
   $h{$key} = 'foo';
   untie %h;

   tie %h, 'SDBM_File', $sdbm_file, O_RDONLY, 0640;
   while (my($k,$v) = each %h) { print "$k => $v\n" }
   untie %h;

   tie %h, 'SDBM_File', $sdbm_file, O_CREAT|O_RDWR, 0640;
   $h{$key} = 'bar';
   untie %h;

   tie %h, 'SDBM_File', $sdbm_file, O_RDONLY, 0640;
   while (my($k,$v) = each %h) { print "$k => $v\n" }
   untie %h;

That should give you this result:

   A12345 => foo
   A12345 => bar

Does this at all address the problem you're seeing?

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf/


------------------------------

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 2927
**************************************

home help back first fref pref prev next nref lref last post