[15963] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3375 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 15 18:05:55 2000

Date: Thu, 15 Jun 2000 15:05:37 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <961106737-v9-i3375@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 15 Jun 2000     Volume: 9 Number: 3375

Today's topics:
    Re: "Fuzzy" matching <rootbeer@redcat.com>
    Re: [ RexExp ] =>  /^[^(abc)]/ ? (Abigail)
    Re: [Q] Perl implemented in Java? (Bart Lateur)
    Re: [Q] Perl implemented in Java? <tcuffel@exactis.com>
    Re: A Computer Programmers Profile <russ_jones@rac.ray.com>
    Re: ActiveState Perl 613 backticks child error (Martin Vorlaender)
        Anybody doing Perl with WebLogic server? <sue@pennine.com>
    Re: Anybody doing Perl with WebLogic server? <makarand_kulkarni@My-Deja.com>
    Re: Bot for this group to auto-answer queries? (John Stanley)
    Re: Bot for this group to auto-answer queries? <henry@penninkilampi.net>
    Re: Bot for this group to auto-answer queries? <Jonathan.L.Ericson@jpl.nasa.gov>
    Re: build woes: perl5005_03 on AIX, DynaLoader <rootbeer@redcat.com>
    Re: build woes: perl5005_03 on AIX, DynaLoader <william.dowling@isinet.com>
    Re: Can Perl use SSL or HTTPS protocol? robb4444@my-deja.com
    Re: CGI textarea conversion code <rootbeer@redcat.com>
    Re: CGI textarea conversion code <helza@planet.nl>
        CGI.pm newbie question lucas8088@my-deja.com
    Re: CGI.pm newbie question <makarand_kulkarni@My-Deja.com>
    Re: CGI.pm newbie question newsposter@cthulhu.demon.nl
    Re: CGI.pm newbie question (Eric Bohlman)
        concerned about flock() <rlogsdon@io.com>
    Re: concerned about flock() (Clinton A. Pierce)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 15 Jun 2000 11:09:59 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: "Fuzzy" matching
Message-Id: <Pine.GSO.4.10.10006151109260.5301-100000@user2.teleport.com>

On Thu, 15 Jun 2000, Guy Fraser wrote:

> Does anyone know of an example on the web where I could get more info
> on doing Fuzzy matches (or even the name of a module that helps with
> this) as the only related references I've found so far all deal with
> Soundex, Metaphone and Approx modules.

Have you tried searching on Yahoo, Google, and other search engines?
Cheers!

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



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

Date: 15 Jun 2000 17:35:13 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: [ RexExp ] =>  /^[^(abc)]/ ?
Message-Id: <slrn8kik2q.jil.abigail@alexandra.delanet.com>

TheEx0rcist (TheEx0rcist@fanclub.org) wrote on MMCDLXXIX September
MCMXCIII in <URL:news:8i8j9u$qet$1@news5.isdnet.net>:
\\ I want to match "everything but the string beginning with 'abc'".
\\ Here is what I tried :
\\ 
\\ /^[^(abc)]/ and print "ok"
\\ 
\\ Unfortunately it matches anything that begins with a character other than a,
\\ b and c.
\\ 
\\ Any ideas from regexp experts (Larry Rosler?) would be greatly, greatly,
\\ appreciated!


You don't need a regex for matching a fixed string.


    print "ok" unless "abc" eq substr $_ => 0, 3;



Abigail
-- 
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi


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

Date: Thu, 15 Jun 2000 19:21:50 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: [Q] Perl implemented in Java?
Message-Id: <394a2c58.656628@news.skynet.be>

Randal L. Schwartz wrote:

>Randal> A Perl-to-JVM compiler has been frequently discussed, but not actually
>Randal> in progress, as far as I recall.
>
>Oh duh.  Searching for "java" at search.cpan.org didn't reveal
>what searching for "jvm" did... 

And yet, I think I may well have confused the two. I remember all the
talk about Perl compiling into Java bytecode. I also remember that Larry
Wall did paid work on some merger of Java and Perl. Crosslinking the two
probably is all my own work. Oops. Sorry.

-- 
	Bart.


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

Date: Thu, 15 Jun 2000 15:41:34 -0500
From: "Tim" <tcuffel@exactis.com>
Subject: Re: [Q] Perl implemented in Java?
Message-Id: <XOb25.2646$Ck1.265618@den-news1.rmi.net>

Alun Moon wrote in message <3948B8AF.B2C2CA40@ncl.ac.uk>...
>Bart Lateur wrote:
>> No as is, for the reasons Tom Phoenix has given. But I think Larry Wall
>> is being paid (by O'Reilly?) to write a Perl-to-Java-bytecode compiler,
>> so you could RUN your Perl scripts on a Jave only machine.
>
>Just what I need.
>Especially to get the power of Perl's pattern matching into Java.
>(also spilt, and array slices)
>
>Any news of its progress?


http://javaregex.com/

This is a Java package that claims to implement most of
Perl 5's regex.  I have played with it a little, but cannot
attest to its quality or efficiency.

It does have a really cool regex game, though.

http://javaregex.com/cgi-bin/pat/agame.asp

-T




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

Date: Thu, 15 Jun 2000 16:31:36 -0500
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: A Computer Programmers Profile
Message-Id: <39494B38.2D9C812C@rac.ray.com>

Ferk Da Jerk wrote:

> If your looking for a great worker I can do it and I need much money.  At
> least $15 per hour.
> 

Jeez you little wiener! Why don't you just pay THEM to work! I
couldn't even keep myself in Maalox on $15 per hour!

And you should see what my spell checker wanted to do with "Ferk."

-- 
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747

When cryptography is outlawed, only outlaws will
A2bgg c4dc8 aji0i knS4E 7eFj8 22Rl1
ZdGg3 gu8i6 lu12N s6NoG gn3g3 q835n


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

Date: Thu, 15 Jun 2000 18:54:06 +0200
From: martin@radiogaga.harz.de (Martin Vorlaender)
Subject: Re: ActiveState Perl 613 backticks child error
Message-Id: <39490a2e.524144494f47414741@radiogaga.harz.de>

David Christensen (dchrist@dnai.com) wrote:
: I am running AP613 on Win98se.  Check this out:
:
:     C:\DAVID>type foo
:     # this should work
:     print `dir /b foo`, "\n";
:     print "\$? = $?   \$! = $!\n";
:
:     # this should generate an error
:     print `foo dir /b`, "\n";
:     print "\$? = $?   \$! = $!\n";
:
:     C:\DAVID>perl foo
:     foo
:
:     $? = -1   $! = No such file or directory
:     Bad command or file name
:
:     $? = -1   $! = No such file or directory
:
:     C:\DAVID>
:
: I expected $? to be zero (undef?) the first time and non-zero the second
: time.  $! is there just for giggles.  I think it used to be that way on
: AP519 (?).

"dir" isn't an executable, it's a shell builtin. Replace by

  print `command.com /c dir /b foo`, "\n";

cu,
  Martin

BTW: Any reason why you're not using File::Find or opendir/readdir/closedir?
--
                       |  Martin Vorlaender  |  VMS & WNT programmer
  OpenVMS: When you    |  work: mv@pdv-systeme.de
  KNOW where you want  |        http://www.pdv-systeme.de/users/martinv/
  to go today.         |  home: martin@radiogaga.harz.de


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

Date: 15 Jun 2000 11:57:59 -0700
From: Sue Spence <sue@pennine.com>
Subject: Anybody doing Perl with WebLogic server?
Message-Id: <8ib8vn$1b95@drn.newsguy.com>


I know that this question is not strictly on topic but I am hoping to get in
touch with anyone who has managed to do Perl CGI with a web server running
WebLogic 4.5 server s/w.  I have not had to deal with this problem before, and I
don't feel like being forced to write Java servlets for fairly simple jobs that
can be implemented (and run) much faster in Perl.  It feels like being forced to
use a sledgehammer to crack a nut.  I have a hard time understanding why anyone
would market a web server product which doesn't handle anything other than Java
out of the box.  It's like deciding that digital TV is the future and only
making TVs which decode digital signals and nothing else, regardless of what
sort of signal the majority of the market are currently able to receive.



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

Date: Thu, 15 Jun 2000 14:45:44 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: Anybody doing Perl with WebLogic server?
Message-Id: <39494E88.F325808B@My-Deja.com>

> I know that this question is not strictly on topic but I am hoping to get in
> touch with anyone who has managed to do Perl CGI with a web server running
> WebLogic 4.5 server s/w.  I have not had to deal with this problem before, and I
> don't feel like being forced to write Java servlets for fairly simple jobs that
> can be implemented (and run) much faster in Perl.  It feels like being forced to
> use a sledgehammer to crack a nut.  I have a hard time understanding why anyone
> would market a web server product which doesn't handle anything other than Java
> out of the box.  It's like deciding that digital TV is the future and only
> making TVs which decode digital signals and nothing else, regardless of what
> sort of signal the majority of the market are currently able to receive.

version 5.1 can do perl/cgi. A servlet named CGIServlet handles all CGI apps.
Looking at the docs for ver 4.5 gives me  the expression that it was not
supported.
--




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

Date: 15 Jun 2000 18:07:51 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Bot for this group to auto-answer queries?
Message-Id: <8ib61n$6lv$1@news.NERO.NET>

In article <961089425.29523@itz.pp.sci.fi>,
Ilmari Karonen  <usenet11123@itz.pp.sci.fi> wrote:
>>No. Getting crap from a robot must be opt-in, not opt-out. 
>
>This is a delicate issue.  

No, it is a simple issue. Getting automatic email in response to a
posting is not supposed to happen; the only exceptions are test and
moderated newsgroups.

>My personal opinion is that anything less
>obtrusive than the comp.infosystems.www.authoring.cgi moderator bot

This is not comp.infosystems.yada... If the group is moderated, it falls
under a different set of rules. This group is not moderated.

>would probably be acceptable.  Adding opt-in to the above requirements
>would unfortunately pretty much stop the bot from doing anything.

Too bad. That would be a hint that people do not want it.

>issue I would express an opinion about at this stage.  But if there is
>to be bot, it should *only* reply to newbies who delurk with a FAQ.

And only if they ask it to.



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

Date: Fri, 16 Jun 2000 04:31:36 +0930
From: Henry <henry@penninkilampi.net>
Subject: Re: Bot for this group to auto-answer queries?
Message-Id: <henry-94ED4A.04313616062000@news.metropolis.net.au>

In article <961084867.22980@itz.pp.sci.fi>, Ilmari Karonen 
<usenet11123@itz.pp.sci.fi> wrote:

>> Such systems already exist in other channels.  The whole point of a
>> Bot was to deal with the situation in _this_ channel.  A surplus of 
>> hamburgers in America does not help the starving millions in Africa.
> 
> The problem is that the appropriate way to deal with the situation in
> this channel is to move as much of it as possible somewhere else.
> 
> The questions are not analogous to hamburgers, but to hungry people.
> Why would you want to bring more hungry people to Africa?

Wisdom manifests in unexpected ways.  Thank you.


>> Your disapproval is noted.
> 
> That is all I ask for, and that if you do proceed, you do so with
> caution.

There is too much to lose in this group.  The bot will be deployed 
elsewhere, if at all.

Henry.


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

Date: Thu, 15 Jun 2000 12:07:09 -0700
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: Re: Bot for this group to auto-answer queries?
Message-Id: <3949295D.CEEAEB67@jpl.nasa.gov>

Henry wrote:
> This bot is programmed to continuously scan a given newsgroup, looking
> for messages with the word "help" in the subject line.

I think you might convince people of the usefulness of auto-responses if
you start out very small.  For instance, have the bot comment on poor
subject lines.  Tom Phoenix regularly posts:

  Please check out this helpful information on choosing good subject
  lines. It will be a big help to you in making it more likely that your
  requests will be answered.

    http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post

The algorithm for the bot could be:

1) Consider only original posts for response
2) Don't respond to posts that have been answered by humans and wait an
appropriate amount of time for humans to respond (1 day? (longer on
weekends?))
3) If the subject of the post contains one or more 'negative flash
words|effects' respond
4) Responses accurately quote the subject line and give the above advice

If this bot flys, start adding other automated advice.  It could comment
on jeopardy quoting of entire posts, the use of the word PERL, and
reposts.  

The goal of the bot should be to reduce the amount of noise in c.l.p.m. 
People shouldn't have to spend a lot of time correcting the bot's
mistakes.  There should be a way to play with the bot outside of the
context of Usenet.  The bot algorithm and database should be completely
public.  

Jon
-- 
Knowledge is that which remains when what is
learned is forgotten. - Mr. King


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

Date: Thu, 15 Jun 2000 11:06:43 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: build woes: perl5005_03 on AIX, DynaLoader
Message-Id: <Pine.GSO.4.10.10006151103550.5301-100000@user2.teleport.com>

On Wed, 14 Jun 2000, William F. Dowling wrote:

> Running 'make test' after building perl5005.03 from source on AIX 4.2.1
> gives these errors (and no others):
> op/readdir.........FAILED at test 3
> lib/dosglob........FAILED at test 3
> lib/filefind.......FAILED at test 1
> lib/findbin........FAILED at test 1
> 
> Hoping this wasn't too serious, I did 'make install'; 

Probably not the right thing to do, I'm afraid.

> and although there were some odd permissions problems (install seemed
> to make some directories 444, which I manually changed to 555)

If there's a bug in the installer, you should report it with perlbug.
Including a patch would be even better. :-)

>         Can't locate auto/DynaLoader/dl_findfile.al in @INC 

> 1) Do I need to back up and solve the failures in 'make test' before I
> go on?

I'd have to say yes. It looks as if you don't have a working DynaLoader.

> 2) If so, is this an AIX-specific configuration issue?

Well, it may be your-site-specific. But I think others have gotten
DynaLoader to work on AIX. 

> 3) Or, am I really just looking at a (presumably less serious) problem
> with install, where it is not copying something it should?

I don't think so, since the tests failed.

Good luck with it!

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



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

Date: Thu, 15 Jun 2000 20:09:06 GMT
From: "William F. Dowling" <william.dowling@isinet.com>
Subject: Re: build woes: perl5005_03 on AIX, DynaLoader
Message-Id: <394937DF.BEE3D5A9@isinet.com>

Thank you for your response.  I have got the build and install to work
(no errors) on a different AIX box, using the same compiler and
config.sh.  I guess "your-site-specific" hit the nail headwise.

Both
	perldoc DynaLoader | grep -i aix
	cd <build-dir>; find t -name '*Dyn*'
come up empty, which raises two questions:

Has anyone seen DynaLoader work with perl5.005_03 in AIX 4.2.1?

Can someone suggest a very simple test that I can run, to see if my
installation of DynaLoader, working against the rest of my environment,
is working? I have a not-simple test, generated by SWIG, that is not
working, giving messages like:
Undefined subroutine &main::cfact called at ./test.pl line 20 (#1)
    
    (F) The subroutine indicated hasn't been defined, or if it was, it
    has since been undefined.

I'd like to rule out general perl/DynaLoader/AIX issues before I dig
into the SWIG output.

Thanks again,

Will

Tom Phoenix wrote:
> 
> On Wed, 14 Jun 2000, William F. Dowling wrote:
> 
> > Running 'make test' after building perl5005.03 from source on AIX 4.2.1
> > gives these errors (and no others):
> > op/readdir.........FAILED at test 3
> > lib/dosglob........FAILED at test 3
> > lib/filefind.......FAILED at test 1
> > lib/findbin........FAILED at test 1
> >
> > Hoping this wasn't too serious, I did 'make install';
> 
> Probably not the right thing to do, I'm afraid.
> 
> > and although there were some odd permissions problems (install seemed
> > to make some directories 444, which I manually changed to 555)
> 
> If there's a bug in the installer, you should report it with perlbug.
> Including a patch would be even better. :-)
> 
> >         Can't locate auto/DynaLoader/dl_findfile.al in @INC
> 
> > 1) Do I need to back up and solve the failures in 'make test' before I
> > go on?
> 
> I'd have to say yes. It looks as if you don't have a working DynaLoader.
> 
> > 2) If so, is this an AIX-specific configuration issue?
> 
> Well, it may be your-site-specific. But I think others have gotten
> DynaLoader to work on AIX.
> 
> > 3) Or, am I really just looking at a (presumably less serious) problem
> > with install, where it is not copying something it should?
> 
> I don't think so, since the tests failed.
> 
> Good luck with it!
> 
> --
> Tom Phoenix       Perl Training and Hacking       Esperanto
> Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/

-- 
William F. Dowling
Institute for Scientific Information
215-386-0100 x-1156


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

Date: Thu, 15 Jun 2000 18:31:25 GMT
From: robb4444@my-deja.com
Subject: Re: Can Perl use SSL or HTTPS protocol?
Message-Id: <8ib7dt$854$1@nnrp1.deja.com>

Tom,
Thanks for the advice. By the way, do you have any good tutorials/books
for RFC's and checking system calls?

Robb Samuell

>  Tom Phoenix <rootbeer@redcat.com> wrote:
> On Thu, 15 Jun 2000 robb4444@my-deja.com wrote:
>
> > **Here's my goal**
> > Retrieve a webpage through the HTTPS protocol.
> >
> > I also don't want to use a package like OpenSSL.
> > I'd like to write it myself. Any good references or tips?
>
> Start with the RFCs, and always check the return value from system
calls.
> Cheers!
>
> --
> Tom Phoenix       Perl Training and Hacking       Esperanto
> Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/
>
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 15 Jun 2000 11:13:52 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: CGI textarea conversion code
Message-Id: <Pine.GSO.4.10.10006151110110.5301-100000@user2.teleport.com>

On Thu, 15 Jun 2000, Derek Fountain wrote:

> I'm sure I've seen the code which translates all the possible control
> sequences into \n, \r or whatever they would normally be represented
> as in Perl. Only I can't find it. :-(

I don't know about "all" the possible control sequences. Quite a few are
possible! But you may want something like this:

    $text =~ s/(?:\n\r|\r\n?)/\n/g;

Good luck with it!

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



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

Date: Thu, 15 Jun 2000 22:38:39 +0200
From: "Helza" <helza@planet.nl>
Subject: Re: CGI textarea conversion code
Message-Id: <8ibese$69qn7$1@reader4.wxs.nl>

Hi,

I think you mean:
---

read(STDIN,$my_input,$ENV{'CONTENT_LENGTH'});
@fv_pairs = split(/&/,$my_input);

foreach $pair (@fv_pairs) {
   if($pair=~m/([^=]+)=(.*)/) {
      $field = $1;
      $value = $2;
      $value =~ s/\+/ /g;
      $value =~ s/%([\dA-Fa-f]{2})/pack("C", hex($1))/eg;
      $INPUT{$field}=$value;
   }
}
----------

if not just ignore this post :) hehe

Greetings Helza



Derek Fountain <nomail@hursley.ibm.com> wrote in message
news:3948F030.48022C16@hursley.ibm.com...
> I have a CGI script which receives the data from a textarea
> in an HTML form. The lines from that textarea are delimited
> with escaped control sequences like %0D%0A. I'm sure I've
> seen the code which translates all the possible control
> sequences into \n, \r or whatever they would normally be
> represented as in Perl. Only I can't find it. :-(
>
> Can someone either post it if it's a simple cut and paste
> from an existing script, or tell me where I can can find it?




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

Date: Thu, 15 Jun 2000 21:01:56 GMT
From: lucas8088@my-deja.com
Subject: CGI.pm newbie question
Message-Id: <8ibg7o$f6k$1@nnrp1.deja.com>

Hi,

I'm just learning to use CGI.pm and I'm a little confused. I've seen
the following several times:

if($q->param()) {
    # do something
}

I am confused as to what exactly the "if" statement is testing. What I
need is a way to be able to test whether *all* form fields have been
filled out (then I'll validate). It would be nice to be able to do this
in a brief statement like that. But I tried this and it fails because
when I test it by submitting a form in which nothing was filled out,
the if test still works out to "true" for some reason...??


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 15 Jun 2000 14:23:38 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: CGI.pm newbie question
Message-Id: <3949495A.8348F638@My-Deja.com>

> if($q->param()) {
>     # do something
> }

checks if the array returned by param () has any elements;
ie. number of elements in the returned array > 1

> But I tried this and it fails because
> when I test it by submitting a form in which nothing was filled out,
> the if test still works out to "true" for some reason...??

It is better to do form input validation on the browser/client
side itself using Javascript and allow the form to be submitted
iff the form input is meaningful and ready to be sent to the
server side cgi script.
--



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

Date: 15 Jun 2000 21:30:05 GMT
From: newsposter@cthulhu.demon.nl
Subject: Re: CGI.pm newbie question
Message-Id: <8ibhst$9e3$1@internal-news.uu.net>

lucas8088@my-deja.com wrote:
> Hi,

> I'm just learning to use CGI.pm and I'm a little confused. I've seen
> the following several times:

> if($q->param()) {
>     # do something
> }

> I am confused as to what exactly the "if" statement is testing.

Check the documentation for the CGI module. Especially the
'FETCHING THE NAMES OF ALL THE PARAMETERS PASSED TO YOUR SCRIPT:'
section.

  In a scalar context param() returns the size of the list. So the
if tests whether the script was invoked with a parameter list or
without any parameters.

Erik







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

Date: 15 Jun 2000 21:53:09 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: CGI.pm newbie question
Message-Id: <8ibj85$720$4@slb6.atl.mindspring.net>

Makarand Kulkarni (makarand_kulkarni@My-Deja.com) wrote:
: It is better to do form input validation on the browser/client
: side itself using Javascript and allow the form to be submitted
: iff the form input is meaningful and ready to be sent to the
: server side cgi script.

While it's a good idea to *implement* client-side validation, it's a 
*bad* idea to *rely* on it.  What happens on the client side is *not* 
under your control (someone could, for example, alter your client-side 
code) and therefore you can't trust its results.  So you need to validate 
on the server side in any case, even though most of the time the 
client-side validation will catch problems before they make it to your 
server.



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

Date: Thu, 15 Jun 2000 14:11:08 -0500
From: Reuben Logsdon <rlogsdon@io.com>
Subject: concerned about flock()
Message-Id: <Pine.LNX.4.10.10006151351001.2158-100000@fnord.io.com>

Hi,

The docs warn that flock() will produce a fatal error on machines that
don't support the underlying flock-like filesystem functions.

The docs also warn that shared locking and networked-file locking will
work differently based on machine and the 5.x minor version.  Finally,
the docs suggest that custom file-locking functions will fail due to race 
conditions.

(ref http://www.perl.com/pub/doc/manual/html/pod/perlfunc/flock.html and
http://www.perl.com/pub/doc/manual/html/pod/perlfaq5.html)

I need to lock files within a shareware CGI script that will run on
thousands of client systems, spanning a diverse set of operating systems
and 5.x minor versions.  I want to avoid limiting market share by
requiring, say, 5.6 or a specific OS.

Question: does anyone have experience with using flock on many different
platforms?  Do the fatal errors come up on a common class of webserver
machines, or is this only a theoretic possibility?  Does anyone know how
long flock will block before returning failure?

Thanks,
Reuben Logsdon

http://www.io.com/~rlogsdon/




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

Date: Thu, 15 Jun 2000 21:11:46 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: concerned about flock()
Message-Id: <mEb25.1455$fR2.20481@news1.rdc1.mi.home.com>

[Posted and mailed]

In article <Pine.LNX.4.10.10006151351001.2158-100000@fnord.io.com>,
	Reuben Logsdon <rlogsdon@io.com> writes:
> [lots of doc refs]
> I need to lock files within a shareware CGI script that will run on
> thousands of client systems, spanning a diverse set of operating systems
> and 5.x minor versions.  I want to avoid limiting market share by
> requiring, say, 5.6 or a specific OS.
> 
> Question: does anyone have experience with using flock on many different
> platforms?  

What exactly do you mean by that?  Do you have several platforms all
trying to lock a single resource, say, a file over a network file 
system?  If that's the case don't use flock().  It won't work.  Try
using a locking daemon and a network connection to it to obtain locks
or something else.

I've used flock() on a variety of Unix and Windows systems.  Where 
it works (Unix with local filesystems, NT with local filesystems) it
works OK.  Where it's not supported (Win9x) it's not needed.  Where it 
doesn't work (Unix/NT with network filesystems) see the first paragraph.

flock() is a blocking call by default, and will block indefinately.  If
use use LOCK_NB and the call fails, it's very quick because it's your
kernel and your local filesystem.  If you use LOCK_NB on a network 
filesystem, then you're using flock() when I told you not to.  See
the first paragraph.

-- 
    Clinton A. Pierce              Teach Yourself Perl in 24 Hours! 
  clintp@geeksalad.org         for details see http://www.geeksalad.org
"If you rush a Miracle Man, 
	you get rotten Miracles." --Miracle Max, The Princess Bride


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 3375
**************************************


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