[11335] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4935 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 18 22:07:25 1999

Date: Thu, 18 Feb 99 19:00:25 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 18 Feb 1999     Volume: 8 Number: 4935

Today's topics:
    Re: (blush) Stupid question about Perl in Win/DOS (shud (Larry Rosler)
    Re: (blush) Stupid question about Perl in Win/DOS (shud ran@netgate.net
    Re: -T warning explanation (David Efflandt)
    Re: Anybody get .pl scripts to run on Win32 Perl and Ap (Rod MacBain)
        Database performance <employment@owlscreech.com>
        DEMO: finding directory size <tchrist@mox.perl.com>
    Re: efficient , -> TAB substitution? (Larry Rosler)
    Re: Encrypting then Decrypting a Password? (Clay Irving)
        FAQ 5.30: Why can't I use "C:\temp\foo" in DOS paths?   <perlfaq-suggestions@perl.com>
        FAQ 5.31: Why doesn't glob("*.*") get all the files?   <perlfaq-suggestions@perl.com>
        FAQ 5.32: Why does Perl let me delete read-only files?  <perlfaq-suggestions@perl.com>
        FAQ 5.33: How do I select a random line from a file?   <perlfaq-suggestions@perl.com>
    Re: flock not working properly! HELP! dave_matsumoto@my-dejanews.com
        My address is khowe@performance-net.com      Re: making <khowe@performance-net.com>
    Re: PERL for Personal Web Server (Jason Eriksen)
        Perl interpreter for Win95? <REMOVErobbh@home.com>
        Problem: Accessing File With Perl (Bruce)
    Re: Problem: Accessing File With Perl (Alastair)
    Re: Problem: Accessing File With Perl (Bruce)
    Re: Problem: Accessing File With Perl (Alastair)
    Re: regex poll <uri@ibnets.com>
    Re: Speed Up Perl <jeromeo@atrieva.com>
    Re: Speed Up Perl (Clay Irving)
    Re: speed (Rachel J King)
        tcl.so linking error? <jkucab@acm.org>
        Variable help!!! <poohba@io.com>
        Win32::GUI vs TK <khowe@performance-net.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Thu, 18 Feb 1999 16:05:35 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: (blush) Stupid question about Perl in Win/DOS (shudder)
Message-Id: <MPG.11364aac18f15bf5989a5e@nntp.hpl.hp.com>

In article <36CC7853.AE554FB2@NOSPAM4ME.uiuc.edu> on Thu, 18 Feb 1999 
14:30:11 -0600, Erik Draeger <draeger@NOSPAM4ME.uiuc.edu> says...
 ...
>     echo "line1\nline2\nline3\n" | C program
> 
> (The actual command will be @output = `echo "line1\nline2\nline3\n" |
> program`; but it has become clear that DOS doesn't quite grasp the idea
> of \n, in that simply typing "echo \n\n\n" at the prompt just returns
> exactly that -- \n\n\n, and not three blank lines.)
> 
> So the real question is whether or not there is a Windows/DOS equivalent
> of \n.  Or some syntax (quotes, extra backslash, etc.) that will make it
> recognize it as a linefeed.  All the DOS/Win faqs and books I've ever
> looked at just tell you how to edit autoexec.bat and how to run disk
> defrag.  Sad, really.
> 
> I'd greatly appreciate any advice, etc. on how to do simple tasks on
> this infernal operating system.  :)

Advice with regard to the 'echo' built into the so-called command 
interpreter:

Forget about doing anything useful with it.  It was designed to make DOS 
batch files speak to the console.  'echo on' and 'echo off' treat 'on' 
and 'off' as commands to set a state for 'echo', not as data to be 
echoed.  As for any other strings, WYSIWYG, including any quotes around 
arguments.  New-lines terminate the arguments, with or without quotes.  
No escape sequences, no interpretation, nothing.

I had to rename my POSIX-compliant 'echo.exe' from the MKS Toolkit to 
get down to this ultra-primitive primitive.  Never again!

ObPerl content:  Use Perl!!!

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 19 Feb 1999 01:42:11 GMT
From: ran@netgate.net
Subject: Re: (blush) Stupid question about Perl in Win/DOS (shudder)
Message-Id: <7aifhj$4rn$1@remarQ.com>

In <36CC7853.AE554FB2@NOSPAM4ME.uiuc.edu>, Erik Draeger <draeger@NOSPAM4ME.uiuc.edu> writes:

>I'd greatly appreciate any advice, etc. on how to do simple tasks on
>this infernal operating system.  :)

Since 95 is still 16-bit DOS under the hood,  there are definite 
limitations on how far you can go.  But,  there are free ports of 
various shells available for it,  as well as a lot of the common 
text and file utilities.

I can't make any specific recommendations,  because I was able to get 
away with installing OS/2 at work in the days when everyone else was 
saddled with 3.1 and 95.  I know the Cygnus package worked quite nicely 
under NT,  but may not be available for 95.  I've also heard positive 
comments about RSX,  which is supposed to be analogous to the EMX 
package used to eliminate most of the work of porting *nix tools to
OS/2.

Ran




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

Date: 19 Feb 1999 00:44:59 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: -T warning explanation
Message-Id: <slrn7cpcui.h7.efflandt@efflandt.xnet.com>

On Thu, 18 Feb 1999 10:41:06 -0800, Sanjay Malunjkar <smalunjk@cisco.com>
wrote:

>I am getting following error message at the open (MAIL....) statement:
>
>Insecure $ENV{PATH} while running with -T switch at
>/home/cmrs/mosaic/cgi-bin//c
>po/lib/Email.pm line 30, <> chunk 1.
>
>Since I am specifying explicit path I dont understand why I get this
>error message.
>
>Can you please explain?

I don't see $ENV{PATH} defined here.  You may be defining a path to the
program, but perl does not know what lies beyond that or if the called
program might call another program using your insecure path.

>thanks in advance,
>
>sanjay malunjkar
>
>here's the code:
>
>sub send_email($$$$)
>{
>  my ($sender,$reciepent, $subject, $message)=@_;
>
>  #untaint the variable that goes on command line.
>  $sender =~ s/[\?\[\]\;\<\>\*\|\'\&\$\!\#\(\)\{\}\:\`\"\%\/\\\s]//g;
>
>  #Redirect the stdout to trash as it clobbers up the HTML page
>  #and cuases server error.
>  open (MAIL, "|/usr/lib/sendmail -t -oi -f '$sender' >/dev/null")||
>             die "Can't open sendmail";
>
>  print MAIL "Subject: $subject\n";
>  print MAIL "From: $sender\n";
>  print MAIL "To: $reciepent\n\n";
>  print MAIL "$message\n\n";
>  close (MAIL);
>
>  return 1;
>}
>


-- 
David Efflandt    efflandt@xnet.com
http://www.xnet.com/~efflandt/


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

Date: Fri, 19 Feb 1999 00:19:45 GMT
From: darcys@.nbnet.nb.ca (Rod MacBain)
Subject: Re: Anybody get .pl scripts to run on Win32 Perl and Apache 1.3.3.  &#$%*Damn MS Windoze file associations.
Message-Id: <36cdaae9.23897708@allnews.nbnet.nb.ca>

Cameron Dorey <camerond@mail.uca.edu> spake thusly:

>Rod MacBain wrote:
>> [snip]
>>... the %* that active state tells you to use just don't work! There is
>> nothing about the " " syntax in their doc's either. DOH! I've got
>> apache running and script aliased and all of that stuff now; no small
>> thanks to your help.
>
>Close, but no see-gar. If I read your original post correctly, then the
>script did run, and correctly. If the file association is done correctly
>(and what ActiveState told you to do *IS* correct), then double-clicking
>on the script name will make it run, but immediately upon finishing, the
>DOS box closes. Due to the slow retinal pigments we were supplied with
>as original equipment, the result disappeared before you "saw" it. In

Actually what I was getting was a "can't find file c:\program.."
error, and it did close the window immediatly. It took about 35 tries
before I could see enough of it to make this out. Once I changed the
association line, (and put in a $dummmy = <stdin> at the end line to
slow things down) I was able to run no problem.

>quotes and put the %* back in, or you might have trouble down the road
>with more complicated scripts.

The stuff i'm running now is fairly complex. Things like processing
multipart forms through apache, doing dblookups of large (1000 record)
flat files, and producing dynamic HTML output from templates, and they
seen to be working ok.   Nothing would run with %1%*, but it will with
"%1". I'm starting to wonder what I've done - what is this %* thingy?
I assume the %1 means run Perl with the filename whatever.pl as the
arguement.  Am I doing something very wrong here? Will I live to
regret this?

>> Now if I could only get flock() working properly.
>
>Not on Win95, never:
>

I know, poor attempt at humour. I shoulda included the <:-)

>Cameron




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

Date: Thu, 18 Feb 1999 16:48:36 -0700
From: "Owl Screech, Inc." <employment@owlscreech.com>
Subject: Database performance
Message-Id: <7ai8sa$179s@enews2.newsguy.com>

Hi,

    For a database containing approximately 700,000 records,
    of the following which would be give the best performance
    using x86 Linux and a Perl interface?

    Informix
    Sybase
    mySql
    mSql

    We're currenly using mSql and it starts getting a bit slow when dealing
with over 20,000 records.

            Thank you,

                    John




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

Date: 18 Feb 1999 18:14:40 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: DEMO: finding directory size
Message-Id: <36ccbb00@csnews>

Well, there's this:

    -s $directory

For the directory file itself, or there's this, which is the actually
recursive cumulative sizes:

    #!/usr/bin/perl
    use File::Find;
    @ARGV = ('.') unless @ARGV;
    my $sum = 0;
    find sub { $sum += -s }, @ARGV;
    print "@ARGV contains $sum bytes\n";

--tom
-- 
Besides, it's good to force C programmers to use the toolbox occasionally.  :-)
        --Larry Wall in <1991May31.181659.28817@jpl-devvax.jpl.nasa.gov>


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

Date: Thu, 18 Feb 1999 16:31:13 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: efficient , -> TAB substitution?
Message-Id: <MPG.113650a9b7f5c54d989a5f@nntp.hpl.hp.com>

In article <7ai52f$7q1@courier.xilinx.com> on 18 Feb 1999 22:43:27 GMT, 
Jeff Stampes <stampes@xilinx.com> says...
> Robert D Trent <trent@mail.utexas.edu> wrote:
> : I've got these ~90MB files that contain comma-separated
> : values each surrounded by double quotes. For example:
> 
> :   "VAL1","VAL2","VAL3","VAL4","VAL5"
> :   "VAL6","VAL7","VAL8","VAL9","VAL0"
> :   ...
> 
> : I need the values to be TAB-separated instead.  I have
> : written the following C-shell script to do the substitution
> : but it takes almost 90 minutes to complete.
> 
> : #!/bin/csh
> : sed -n -e 's/","/"      "/g' -e 'p' $argv[1] > $argv[2]

> 
> perl -pi.bak -e 's/,/\t/go' filename

  perl -pi.bak -e 's/","/"\t"/g' filename

is probably closer to the requirements, because any commas within the 
quoted values shouldn't be touched.  (In your simple case, 'tr/,/\t/' 
would be much faster, in any event.)

The /o modifier is unnecessary, as there are no interpolated variables 
in the regex, so it is compiled once only.

It would be informative to tell us how this performs compared to the 
'sed' script.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 18 Feb 1999 21:36:45 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Encrypting then Decrypting a Password?
Message-Id: <7aiint$m8e$1@panix.com>

In <36CC833A.FADEAB10@atrieva.com> Jerome O'Neil <jeromeo@atrieva.com> writes:
>Mike Skimin wrote:

>>     I kind of understand the crypt function but can't figure out how to
>> go from a crypt password back to normal.
>> 
>>     Any and all help is appreciated.

>You can't go back.  crypt() uses a one-way hash.  Pick up a copy of
>Bruce Schneier's Applied Cryptography for all the exciting detail of one
>way hash algorithms, and other cryptographic toppics, including secure
>logon.  

>Sadly, there is no perl source, only C.

Whoa, big fella. What about Crypt.pm? From the pod:

   =head1 NAME
   
   B<Crypt> - software implementation of the C<crypt> function.
   
   =head1 SYNOPSIS
   
   C<use Crypt;>
   C<$hashed = crypt($plaintext,$salt);>
   
   =head1 DESCRIPTION
   
   See the description of the C<crypt> function.
   
Get it at:

   http://www.pdv-systeme.de/users/martinv/Crypt.pm

(In the `security' section of Perl Reference, BTW :)


-- 
Clay Irving
clay@panix.com


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

Date: 18 Feb 1999 17:27:36 -0700
From: Tom Christiansen <perlfaq-suggestions@perl.com>
Subject: FAQ 5.30: Why can't I use "C:\temp\foo" in DOS paths?  What doesn't `C:\temp\foo.exe` work?  
Message-Id: <36ccaff8@csnews>

(This excerpt from perlfaq5 - Files and Formats 
    ($Revision: 1.34 $, $Date: 1999/01/08 05:46:13 $)
part of the standard set of documentation included with every 
valid Perl distribution, like the one on your system.
See also http://language.perl.com/newdocs/pod/perlfaq5.html
if your negligent system adminstrator has been remiss in his duties.)

  Why can't I use "C:\temp\foo" in DOS paths?  What doesn't `C:\temp\foo.exe` work?

    Whoops! You just put a tab and a formfeed into that filename! Remember
    that within double quoted strings ("like\this"), the backslash is an
    escape character. The full list of these is in the section on "Quote and
    Quote-like Operators" in the perlop manpage. Unsurprisingly, you don't
    have a file called "c:(tab)emp(formfeed)oo" or
    "c:(tab)emp(formfeed)oo.exe" on your legacy DOS filesystem.

    Either single-quote your strings, or (preferably) use forward slashes.
    Since all DOS and Windows versions since something like MS-DOS 2.0 or so
    have treated `/' and `\' the same in a path, you might as well use the
    one that doesn't clash with Perl -- or the POSIX shell, ANSI C and C++,
    awk, Tcl, Java, or Python, just to mention a few. POSIX paths are more
    portable, too.

-- 
    "The usability of a computer language is inversely proportional to the
    number of theoretical axes the language designer tries to grind."
    	--Larry Wall


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

Date: 18 Feb 1999 17:54:24 -0700
From: Tom Christiansen <perlfaq-suggestions@perl.com>
Subject: FAQ 5.31: Why doesn't glob("*.*") get all the files?  
Message-Id: <36ccb640@csnews>

(This excerpt from perlfaq5 - Files and Formats 
    ($Revision: 1.34 $, $Date: 1999/01/08 05:46:13 $)
part of the standard set of documentation included with every 
valid Perl distribution, like the one on your system.
See also http://language.perl.com/newdocs/pod/perlfaq5.html
if your negligent system adminstrator has been remiss in his duties.)

  Why doesn't glob("*.*") get all the files?

    Because even on non-Unix ports, Perl's glob function follows standard
    Unix globbing semantics. You'll need `glob("*")' to get all (non-hidden)
    files. This makes glob() portable even to legacy systems. Your port may
    include proprietary globbing functions as well. Check its documentation
    for details.

-- 
    [End of diatribe.  We now return you to your regularly scheduled
    programming...]
        --Larry Wall in Configure from the perl distribution


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

Date: 18 Feb 1999 18:06:04 -0700
From: Tom Christiansen <perlfaq-suggestions@perl.com>
Subject: FAQ 5.32: Why does Perl let me delete read-only files?  Why does C<-i> clobber protected files?  Isn't this a bug in Perl?  
Message-Id: <36ccb8fc@csnews>

(This excerpt from perlfaq5 - Files and Formats 
    ($Revision: 1.34 $, $Date: 1999/01/08 05:46:13 $)
part of the standard set of documentation included with every 
valid Perl distribution, like the one on your system.
See also http://language.perl.com/newdocs/pod/perlfaq5.html
if your negligent system adminstrator has been remiss in his duties.)

  Why does Perl let me delete read-only files?  Why does `-i' clobber protected files?  Isn't this a bug in Perl?

    This is elaborately and painstakingly described in the "Far More Than
    You Ever Wanted To Know" in http://www.perl.com/CPAN/doc/FMTEYEWTK/file-
    dir-perms .

    The executive summary: learn how your filesystem works. The permissions
    on a file say what can happen to the data in that file. The permissions
    on a directory say what can happen to the list of files in that
    directory. If you delete a file, you're removing its name from the
    directory (so the operation depends on the permissions of the directory,
    not of the file). If you try to write to the file, the permissions of
    the file govern whether you're allowed to.

-- 
    last|perl -pe '$_ x=/(..:..)...(.*)/&&"'$1'"ge$1&&"'$1'"lt$2'
    That's gonna be tough for Randal to beat...  :-)
            --Larry Wall in  <1991Apr29.072206.5621@jpl-devvax.jpl.nasa.gov>


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

Date: 18 Feb 1999 19:06:07 -0700
From: Tom Christiansen <perlfaq-suggestions@perl.com>
Subject: FAQ 5.33: How do I select a random line from a file?  
Message-Id: <36ccc70f@csnews>

(This excerpt from perlfaq5 - Files and Formats 
    ($Revision: 1.34 $, $Date: 1999/01/08 05:46:13 $)
part of the standard set of documentation included with every 
valid Perl distribution, like the one on your system.
See also http://language.perl.com/newdocs/pod/perlfaq5.html
if your negligent system adminstrator has been remiss in his duties.)

  How do I select a random line from a file?

    Here's an algorithm from the Camel Book:

        srand;
        rand($.) < 1 && ($line = $_) while <>;

    This has a significant advantage in space over reading the whole file
    in. A simple proof by induction is available upon request if you doubt
    its correctness.

-- 
 Unix is supported by IBM, like a hanging man is supported by rope
		 - _Life With Unix_  Don Libes & Sandy Ressler


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

Date: Fri, 19 Feb 1999 02:04:33 GMT
From: dave_matsumoto@my-dejanews.com
Subject: Re: flock not working properly! HELP!
Message-Id: <7aigrc$gf7$1@nnrp1.dejanews.com>

Hi all,

I'm having trouble getting flock() to work properly under Redhat Linux 5.2.  I
have two scripts, flocktest.pl and flocktest2.pl.

*************************************
flocktest.pl looks like this:

#!/usr/bin/perl

open FILE, ">>flocktest.txt" || die "couldn't open file";
!(flock(FILE, 2)) || die "couldn't open file"; # obtain exclusive lock

for($i=0; $i<100000; $i++);
{
  print FILE "this is from flocktest.pl\n";
}

close FILE; # closing the file also frees the lock

*************************************
flocktest2.pl looks like this:

#!/usr/bin/perl

open FILE, ">>flocktest.txt" || die "couldn't open file";
!(flock(FILE, 2)) || die "couldn't open file"; # obtain exclusive lock

for($i=0; $i<100000; $i++);
{
  print FILE "this is from flocktest2.pl\n";
}

close FILE; # closing the file also frees the lock



So what I planned to do was run both scripts simultaneously to see if the
file locking works.  However, my script always fails at the flock() since it
returns 1 each time.  I have the proper permissions set on the file as well. 
Does anyone know what else I can try?

Thanks,
Dave

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Thu, 18 Feb 1999 20:05:45 -0400
From: "Kevin Howe" <khowe@performance-net.com>
Subject: My address is khowe@performance-net.com      Re: making a perl parser, help!
Message-Id: <ZV1z2.7411$134.63121@tor-nn1.netcom.ca>


k wrote in message <_J1z2.7407$134.63040@tor-nn1.netcom.ca>...
>Hi, I am in the process of writing a script which that allows for embedding
>perl into a webpage using a template.
>
>I have run into a problem with the s// and m// functions that I can't
figure
>out. The process is like this:
>
>1. Read/Open the template file
>2. Join it into one big string
>3. Locate the embedded <fmEVAL> tags.
>(In the template, you embed the perl like so:
> <fmEVAL> $title </fmEVAL>)
> The plan is to find these tags, and eval() the value between the tags.)
>
>4. Evaluate the value.
>
>SO FAR, EVERYTHING IS OK UP TO HERE.
>The problem occurs when I attempt to replace the embedded tags with the
>eval()'ed values.
>ex: $value =~ s/$tag/$tagvalue/
>($tag being the embedded tag, and $tagvalue being the eval() value.)
>
>It just doesn't want to find the pattern. Even if I do: $value = $tag
>It will tell me that $value IS EQUAL TO $tag, but $value DOES NOT CONTAIN
>the pattern $tag!
>
>i.e. $value=~m/$tag/ doesn't find the value of $tag, despite the face that
>$value = $tag.
>
>Can anybody help me?
>(I've attached the template and script, I hope that is not inappropriate
>behavior for this newsgroup)
>
>I'd appreciate it if you could reply to me via email,
>
>Much thanks,
>Sincerely,
>Kevin Howe
>
>
>




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

Date: Fri, 19 Feb 1999 00:28:17 GMT
From: jer@enteract.com (Jason Eriksen)
Subject: Re: PERL for Personal Web Server
Message-Id: <36ccac23.1706186@news.enteract.com>

Joe and Michael,

I was trying for a couple of days to get Microsoft Personal Web Server
4 to properly mesh with PERL under Windows 98, and it was driving me
mad. Microsoft clearly has its agenda set for Microsoft products only;
I simply could not get Perl to properly execute under their server.
In contrast, setting up Apache to work with perl was a breeze. Thanks
for the information!

Little wonder that Apache's growth in 1999 is fast outpacing Microsoft
in the server market (see www.apache.org ; you may download the Win32
port of Apache here as well).

Jason Eriksen
A member of the GNUcommunity. 

On Mon, 15 Feb 1999 11:11:31 -0500, "Joe Chambers"
<duronagroup@earthlink.net> wrote:

>Michael Taylor wrote in message <7a5e68$4nu@bgtnsc03.worldnet.att.net>...
>>Wow...I really can't help you with the Microsoft Personal Web server, but
>>since I think it sucks I'll throw you a curve.  There currently is a port
>of
>>Apache that runs on WIN32 machines.  I have successfully installed it on
>>both NT4.0+ and WIN95/98 boxes.  With Apache, you can edit the .conf files
>>to specify that it understands certain file extensions, like .cgi.
>> ...
>
>Michael, I realize that you probably already know this, but I just thought
>I'd add my voice to yours.
>
>I spent two days trying to get MS IIS and PWS to work with PERL.  At the end
>of day two I went to a bookstore, because it was obviously something that
>hadn't been documented, but might be in a book.  There I saw a book about
>running Apache on Windows NT.  I latched on to that idea.  When I got home I
>downloaded Apache and Perl to my personal machine.  Including download time,
>it was only twenty minutes until I was working on CGI in a real HTTP server
>environment.  The rest of the configuration was fairly easy.
>
>
>Joseph Chambers
>joec@duronagroup.com
>
>



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

Date: Fri, 19 Feb 1999 01:17:56 GMT
From: "Robb" <REMOVErobbh@home.com>
Subject: Perl interpreter for Win95?
Message-Id: <8Z2z2.14785$lp5.2436@news.rdc1.tn.home.com>

I'm wanting to test some cgi scripts on a Win95 machine with MS Personal
Webserver installed.  I know I need a Perl interpreter for this.  I
looked at SoftSeek and downloaded Perlv5.0.  But the files in the zip
say nothing about it being an interpreter, just that it was Perlv5.0.
Plus, the instructions for install in the readme.txt file were not
clear, mentioning several subdirectory variations that would have to be
manually created depending on different factors.

Is there a Perl interpreter for Win95 that would serve my purposes, and
also has an install utility that would make installation easier?

Thanks for any info.

Robb
http://members.home.net/robbh
Please post any responses to this newsgroup.  To email me, delete
"REMOVE" from the email address embedded in this posting...thank you.




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

Date: Fri, 19 Feb 1999 00:26:53 GMT
From: "Shao-Ju Chao (Bruce)" <schao1@nycap.rr.com>
Subject: Problem: Accessing File With Perl
Message-Id: <36CCB0FE.4B87454D@nycap.rr.com>

Hi,

I developed a web based survey form in CGI/Perl.
The front end is just a plain HTML form and the back end is a perl
program that
parse the input and write the results to a text file (data file) at the
server side. Every time
people submit the form, the data file gets updated.

My question, if at the same time there are a lot of people submitting
the form,
what will happen to the data file? What happens if another update
request comes in while
the data file is being updated by another request? A few weeks ago we
experienced
a strange situation that, the data file was "mysteriously reset" (to an
empty file) during the
"peak hour" of submmiting the survey form. We suspect that this is
becasue too many requests
want to access the same file so for some reason they find this file
"unavailable" therefore
create a new file.

Please let me know if you have any similar experience, thankS!




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

Date: Fri, 19 Feb 1999 00:47:44 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: Problem: Accessing File With Perl
Message-Id: <slrn7cpd84.5a.alastair@calliope.demon.co.uk>

Shao-Ju Chao (Bruce) <schao1@nycap.rr.com> wrote:
>Hi,
>
>I developed a web based survey form in CGI/Perl.
>The front end is just a plain HTML form and the back end is a perl
>program that
>parse the input and write the results to a text file (data file) at the
>server side. Every time
>people submit the form, the data file gets updated.

Sounds like you should try locking the file for updates. Check out ;

perldoc -f flock

HTH.

-- 

Alastair
work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk


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

Date: Fri, 19 Feb 1999 02:24:12 GMT
From: "Shao-Ju Chao (Bruce)" <schao1@nycap.rr.com>
Subject: Re: Problem: Accessing File With Perl
Message-Id: <36CCCC83.64168C1C@nycap.rr.com>

Thanks, Alastair,

I searched web and get some good information about lock and unlock
file. My other question is, if the file is locked by process 1 for
appending,
what happens if process 2 come in and want to append to the same file?
Wait until the file is unlocked? How long?

Thanks for your great help!!!!!


Alastair wrote:

> Shao-Ju Chao (Bruce) <schao1@nycap.rr.com> wrote:
> >Hi,
> >
> >I developed a web based survey form in CGI/Perl.
> >The front end is just a plain HTML form and the back end is a perl
> >program that
> >parse the input and write the results to a text file (data file) at the
> >server side. Every time
> >people submit the form, the data file gets updated.
>
> Sounds like you should try locking the file for updates. Check out ;
>
> perldoc -f flock
>
> HTH.
>
> --
>
> Alastair
> work  : alastair@psoft.co.uk
> home  : alastair@calliope.demon.co.uk



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

Date: Fri, 19 Feb 1999 02:45:07 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: Problem: Accessing File With Perl
Message-Id: <slrn7cpk45.5a.alastair@calliope.demon.co.uk>

Shao-Ju Chao (Bruce) <schao1@nycap.rr.com> wrote:
>Thanks, Alastair,
>
>I searched web and get some good information about lock and unlock
>file. My other question is, if the file is locked by process 1 for
>appending,
>what happens if process 2 come in and want to append to the same file?
>Wait until the file is unlocked? How long?
>
>Thanks for your great help!!!!!

Locks tend to be advisory - that is, 2 processes trying to access the same file
should both use locking or you'll get problems.



This was posted by Tom C today (or yesterday) in this group with the subject of
'DOC: perlopentut.pod for 5.005_55'. It is a snippet of the full doc.

From: Tom Christiansen <tchrist@mox.perl.com>
Newsgroups: comp.lang.perl.misc
Subject: DOC: perlopentut.pod for 5.005_55
Date: 17 Feb 1999 07:04:10 -0700
Message-ID: <36cacc5a@csnews> ;

I hope it helps.



=head2 File Locking

In a multitasking environment, you may need to be careful not to collide
with other processes who want to do I/O on the same files as others
are working on.  You'll often need shared or exclusive locks
on files for reading and writing respectively.  You might just
pretend that only exclusive locks exist.

Never use the existence of a file C<-e $file> as a locking indication,
because there is a race condition between the test for the existence of
the file and its creation.  Atomicity is critical.

Perl's most portable locking interface is via the C<flock> function,
whose simplicity is emulated on systems that don't directly support it,
such as SysV or WindowsNT.  The underlying semantics may affect how
it all works, so you should learn how C<flock> is implemented on your
system's port of Perl.

File locking I<does not> lock out another process that would like to
do I/O.  A file lock only locks out others trying to get a lock, not
processes trying to do I/O.  Because locks are advisory, if one process
uses locking and another doesn't, all bets are off.

By default, the C<flock> call will block until a lock is granted.
A request for a shared lock will be granted as soon as there is no
exclusive locker.  A request for a exclusive lock will be granted as
soon as there is no locker of any kind.  Locks are on file descriptors,
not file names.  You can't lock a file until you open it, and you can't
hold on to a lock once the file has been closed.

Here's how to get a blocking shared lock on a file, typically used
for reading:

    use 5.004;
    use Fcntl qw(:DEFAULT :flock);
    open(FH, "< filename")  or die "can't open filename: $!";
    flock(FH, LOCK_SH) 	    or die "can't lock filename: $!";
    # now read from FH

You can get a non-blocking lock by using C<LOCK_NB>.

    flock(FH, LOCK_SH | LOCK_NB)
        or die "can't lock filename: $!";

This can be useful for producing more user-friendly behaviour by warning
if you're going to be blocking:

    use 5.004;
    use Fcntl qw(:DEFAULT :flock);
    open(FH, "< filename")  or die "can't open filename: $!";
    unless (flock(FH, LOCK_SH | LOCK_NB)) {
	$| = 1;
	print "Waiting for lock...";
	flock(FH, LOCK_SH)  or die "can't lock filename: $!";
	print "got it.\n"
    } 
    # now read from FH

To get an exclusive lock, typically used for writing, you have to be
careful.  We C<sysopen> the file so it can be locked before it gets
emptied.  You can get a nonblocking version using C<LOCK_EX | LOCK_NB>.

    use 5.004;
    use Fcntl qw(:DEFAULT :flock);
    sysopen(FH, "filename", O_WRONLY | O_CREAT)
        or die "can't open filename: $!";
    flock(FH, LOCK_EX)
        or die "can't lock filename: $!";
    truncate(FH, 0)
        or die "can't truncate filename: $!";
    # now write to FH

Finally, due to the uncounted millions who cannot be dissuaded from
wasting cycles on useless vanity devices called hit counters, here's
how to increment a number in a file safely:

    use Fcntl qw(:DEFAULT :flock);

    sysopen(FH, "numfile", O_RDWR | O_CREAT)
        or die "can't open numfile: $!";
    # autoflush FH
    $ofh = select(FH); $| = 1; select ($ofh);
    flock(FH, LOCK_EX)
        or die "can't write-lock numfile: $!";

    $num = <FH> || 0;
    seek(FH, 0, 0)
        or die "can't rewind numfile : $!";
    print FH $num+1, "\n"
        or die "can't write numfile: $!";

    truncate(FH, tell(FH))
        or die "can't truncate numfile: $!";
    close(FH)
        or die "can't close numfile: $!";


-- 

Alastair
work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk


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

Date: 17 Feb 1999 18:57:41 -0500
From: Uri Guttman <uri@ibnets.com>
Subject: Re: regex poll
Message-Id: <39n22cvb0q.fsf@ibnets.com>

>>>>> "IZ" == Ilya Zakharevich <ilya@math.ohio-state.edu> writes:

  IZ> <pudge@pobox.com>],
  IZ> who wrote in article <pudge-1702991449450001@192.168.0.77>:
  >> Why am I doing this?  Uri contends this poll and its results have their
  >> merits.  I contend they are meritless.

  IZ> This would not make them so.  Say, if there are people who use (?{})
  IZ> already, I may want to contact them to discuss their uses so that I
  IZ> may improve/optimize it more.  

but since you plonked me, you won't be able to read the results when i
post them!

:-)

uri

-- 
Uri Guttman                             Hacking Perl for Ironbridge Networks
uri@sysarch.com				uri@ironbridgenetworks.com	


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

Date: Thu, 18 Feb 1999 16:18:07 -0800
From: Jerome O'Neil <jeromeo@atrieva.com>
Subject: Re: Speed Up Perl
Message-Id: <36CCADBF.7F728B0@atrieva.com>

Thats nothing.  Use it with Babe::Gweneth and see what happens.


I R A Aggie wrote:
> 
> On Thu, 18 Feb 1999 12:56:49 -0800, Jerome O'Neil <jeromeo@atrieva.com> wrote:
> 
> + If you guys would use Debug::Psychic you could prognosticate with a much
> + higher degree of acuracy.
> 
> I just downloaded and installed that module! Thanks! Boy, you sure did
> have a disgusting thought there...ow! another one! Stop that!
> 
> James

-- 
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947 
The Atrieva Service: Safe and Easy Online Backup  http://www.atrieva.com


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

Date: 18 Feb 1999 21:53:55 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Speed Up Perl
Message-Id: <7aijo3$nur$1@panix.com>

In <36CC7E91.17C4FD45@atrieva.com> Jerome O'Neil <jeromeo@atrieva.com> writes:

>If you guys would use Debug::Psychic you could prognosticate with a much
>higher degree of acuracy.

I had a vision where to find the Debug::Psychic module, but when I looked
it wasn't there...

-- 
Clay Irving
clay@panix.com


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

Date: 19 Feb 1999 01:47:37 GMT
From: rjking@red.seas.upenn.edu (Rachel J King)
Subject: Re: speed
Message-Id: <7aifrp$dld$2@netnews.upenn.edu>

ghost (haiti@stc.com) wrote:
: Hi all,

: Would Perl be a feesible language to use if I wanted to interface with a
: MSQL database built to handle large amounts of traffic ie. database quering
: and such, on the web?

I think so.  Perl5 has modules to do exactly that.  I'm currently writing
a CGI application which queries a MySql database for my Senior Design
project.  So far, it's working really well.  The module is easy to use and
I was able to teach it to myself with the minimal documentation provided. 

-Rachel



--
Rachel J. King
University of Pennsylvania, B.S.E. Computer Science & Engineering '99
Society of Women Engineers   *   Hexagon Senior Society   *   Ayalah
http://www.seas.upenn.edu/~rjking


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

Date: Thu, 18 Feb 1999 18:05:11 -0800
From: Jamie Kucab <jkucab@acm.org>
Subject: tcl.so linking error?
Message-Id: <36CCC6D7.397C8562@acm.org>

Hi

I'm trying to run something with 'use tk' in it.  I get the following
error at that line:
[jkucab]$ xword.pl
Can't load '/usr/lib/perl5/site_perl/i386-linux/auto/Tcl/Tcl.so' for
module Tcl: /usr/lib/libtcl.so: undefined symbol: stat at
/usr/lib/perl5/i386-linux/5.00404/DynaLoader.pm line 168.

 at /usr/lib/perl5/site_perl/Tcl/Tk.pm line 3
BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/Tcl/Tk.pm
line 3.
BEGIN failed--compilation aborted at ./xword.pl line 3.

Help?

Thanks,
Jamie


Other info:

I had to compile with -I/usr/lib/perl5/site_perl/Tcl to get perl to find
Tk.pm.

[jkucab]$ ls -l /usr/lib/perl5/site_perl/i386-linux/auto/Tcl/Tcl.so
-r-xr-xr-x   1 root     root        24974 Oct 27 20:44
/usr/lib/perl5/site_perl/i386-linux/auto/Tcl/Tcl.so

I'm running RH 5.2

The first few lines of code:
#!/usr/bin/perl -w -I/usr/lib/perl5/site_perl/Tcl

use Tk;
require LWP::UserAgent;
use HTML::Parse;

%html_action =
  (
   "</TITLE>", \&end_title,
   "<H1>", \&start_heading,
 ...

[jkucab]$ perl -V
Summary of my perl5 (5.0 patchlevel 4 subversion 4) configuration:
  Platform:
    osname=linux, osvers=2.0.34, archname=i386-linux
    uname='linux porky.redhat.com 2.0.34 #1 thu may 7 10:17:44 edt 1998
i686 unknown '
    hint=recommended, useposix=true, d_sigaction=define
    bincompat3=y useperlio=undef d_sfio=undef
  Compiler:
    cc='cc', optimize='-O2', gccversion=2.7.2.3
    cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include'
    ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/include'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=undef, doublesize=undef
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt
    libc=, so=so
    useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl): 
  Locally applied patches:
        MAINT_TRIAL_4 - 5.004_05 maintenance trial 4
  Built under linux
  Compiled at Sep 10 1998 02:16:22
  @INC:
    /usr/lib/perl5/i386-linux/5.00404
    /usr/lib/perl5
    /usr/lib/perl5/site_perl/i386-linux
    /usr/lib/perl5/site_perl
    .


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

Date: Thu, 18 Feb 1999 19:08:22 -0500
From: Poohba <poohba@io.com>
Subject: Variable help!!!
Message-Id: <Pine.BSF.4.05.9902181844270.689-100000@dillinger-2.io.com>

I have a variable that is called host and the variable looks like this:
hostname.mycompany.com
The problem is that sometimes the space isn't arent the same length and I
want to extract the hostname and use it but the hostname might be 4 char.
or 8 chars. or 10.  How do I extract it?  This is what I have:

$host = substr($person,62);

Now as I said b4 $host could be long or short with 3 dots in the host
variable or 2.

	      *		Web Page Designs	  *
	     / poohba@io.com  |  www.io.com/~poohba\
	     ---------------------------------------
	     \ For info about me send message with /
	      *      subject "send file help"     * 
		



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

Date: Thu, 18 Feb 1999 22:11:40 -0400
From: "Kevin Howe" <khowe@performance-net.com>
Subject: Win32::GUI vs TK
Message-Id: <_L3z2.7433$134.63650@tor-nn1.netcom.ca>

Can somebody tell what the advantage of Win32::GUI is over TK.
Doesn't TK do everything you'd need to do?





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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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