[9831] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3424 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 12 05:07:15 1998

Date: Wed, 12 Aug 98 02:00:34 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 12 Aug 1998     Volume: 8 Number: 3424

Today's topics:
        Automated script execution <lee.davies@NOSPAMsaaconsultants.com>
    Re: Beginners problem? (Craig Berry)
        changing access (but not modify) timestamp <luis@physics.berkeley.edu>
    Re: chown -h (Sweth Chandramouli)
    Re: chown -h (Mark-Jason Dominus)
        Coinages [ arborescence... ] <larryp1@home.com>
    Re: Date Question... <sidi@angband.org>
    Re: dates in excess of 2037 (A Problem???) (Martin Vorlaender)
        Execute a program then return to perl? <qmwclka@emw.ericsson.se>
        formmail.cgi security <leegala@nospam.ican.net>
    Re: Help using CGI_lite <marius@ace.funcom.com>
        Help with script (If/Elsif/else) cka@jawa.org
    Re: Help with script (If/Elsif/else) (Sam Holden)
    Re: How to untaint a directory path? (Marc Haber)
        IE 4.01 and flush to STDOUT or nonparsed Headers <mskk@tdk.dk>
    Re: Is there a maximum recommended file size for Perl S <cjdpcssd@ims-1.com>
        Mailing List scrip . Help needed <fredjoua@club-internet.fr>
    Re: method=GET without CGI.pm ?? <qmwclka@emw.ericsson.se>
    Re: Need to Lock files (NFS) (Kenneth Herron)
    Re: Need to Lock files (NFS) (Andre Merzky)
    Re: Newbie Question About 'for' (root)
        passing variables <soetensi@se.bel.alcatel.be>
    Re: Pattern matching (text all uppercase) (Ronald J Kimball)
    Re: Pattern matching: Option "i" <jerryp.usenet@connected.demon.co.uk>
        Perl 5.005_02 install and DB_File (Martin Gleeson)
    Re: Perl Docs.. forget the original post (Bart Lateur)
        Perl on PWS on Win NT Ws <suh@jupiter.cs.wayne.edu>
    Re: perlfaq - frequently asked questions about Perl (pa (Bart Lateur)
    Re: re first language <mpersico@erols.com>
    Re: re first language (Bart Lateur)
        unlink files in directories with spaces (win95) sfe@iname.com
        Upload file running on NT <patricia@www.ccca.nctu.edu.tw>
    Re: use strict problem with indirect file variables ? (Ronald J Kimball)
        WILLING TO PAY FOR HTML GRABBING SCRIPT. GBremner@cnbceurope.com
    Re: X-file (?=...), case postponed. (Patrick Timmins)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Wed, 12 Aug 1998 08:54:55 GMT
From: "Lee Davies" <lee.davies@NOSPAMsaaconsultants.com>
Subject: Automated script execution
Message-Id: <zLcA1.1998$KR.134783@news-reader.bt.net>

I have a HTML page which needs to collect some server information (hostname
etc.) and display it in the page text.

I have a CGI script which collects this information and echoes it to stdout
and need to run this script automatically from the HTML.

I can do this via a server-side include, but this requires a rename to
index.shtml and a dummy index.html to act as a redirector.  Is there a way
of achieving this without resorting to server-side includes?




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

Date: 12 Aug 1998 04:36:43 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Beginners problem?
Message-Id: <6qr64r$3qu$1@marina.cinenet.net>

Heikki Luukkala (hluukkala@bigfoot.com) wrote:
: How can I make words beginning with http:// to work as links?
: 
: $text = "Some text http://www.domain.com/page.html some more text."
: 
: How can I change it to:
: "Some text <A
: HREF=http://www.domain.com/page.html>http://www.domain.com/page.html</A>
: some more text."

This has been discussed in various forms in clpm over and over again.
Basically, doing this in the completely general case (for arbitrary URLs
in arbitrary text) is impossible.  If you can impose some constraints on
what URLs and surrounding text will look like, then you can target a
solution to that subset.  For example, if all URLs will end in .html, and
none will have .html internally (e.g., not http://www.htmlstuff.com/...),
then this will work:

  s!(http://.*?\.html)!<a href="$1">$1</a>!g;

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Wed, 12 Aug 1998 01:19:50 -0700
From: Luis Bernardo <luis@physics.berkeley.edu>
Subject: changing access (but not modify) timestamp
Message-Id: <Pine.SUN.3.96.980812011149.7358A-100000@physics10.Berkeley.EDU>




Hello,
I've been looking at past postings and I didn't find what I'm looking for.
The same applies to FAQ and to my introductory perl book.
I know how to modify timestamps with utime($atime,$mtime,"file"). But what
I would like to do is to change the access timestamp without changing the
modify timestamp. There should be an easy way to do that. Is there?
Thanks,
Luis






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

Date: Wed, 12 Aug 1998 04:00:52 GMT
From: sweth-usenet@astaroth.nit.gwu.edu (Sweth Chandramouli)
Subject: Re: chown -h
Message-Id: <sweth-usenet-1208980001310001@alex-va-n013c081.moon.jic.com>

In article <m3hfzli5br.fsf@windlord.Stanford.EDU>, Russ Allbery
<rra@stanford.edu> wrote:

>Sweth Chandramouli <sweth-usenet@astaroth.nit.gwu.edu> writes:
>
>> is there some way to have the chown function in perl work like the chown
>> program itself does when invoked with the -h flag (i.e. affect a symlink
>> if that is its target, rather than the file to which that symlink
>> points)?  alternately, can chown be given device and inode info (as
>> obtained from lstat) to define its target, to get around the problem
>> entirely?
>
>I'm afraid the answer is currently no to both questions.  Perl really
>should get lchown() at some point, but it requires a lot of
>platform-specific tweaking and detecting to figure out how to get it.  In
>the meantime, you pretty much have to use system() to call chown -h.

   in which case, which would be more efficient for a script that chowns a
large number of files, only a few of which are symlinks--using a system
call to the chown (with -h) program for each file, or doing a test before
each chown to see if it is a symlink and the system call is needed, like
this:

foreach file (@filelist) {
   (@stats = stat $file) && (@lstats = lstat $file);
   if (($stats[0] != $lstats[0]) or ($stats[1] != $lstats[1])) {
      chown $newid, -1, $file
   } else {
      system ("/usr/local/bin/chown", "-h", "$file)
   };
};

   on a related topic: since the chown function can take multiple files to
modify, how much difference (if any) is there in efficiency between
running each of chown (functions) separately, versus doing a `push
@plainfilelist, $file' in the foreach loop, and then a `chown $newid, -1,
@plainfilelist' after the loop?  (i'd ask about doing the same for the
system call, pushing the array through xargs, but i'm sure the answer
would be "it depends on your machine".)

   tia,
   sweth.

-- 
Sweth Chandramouli
IS Coordinator, The George Washington University
<sweth@gwu.edu> / (202) 994 - 8521 (V) / (202) 994 - 0458 (F)
<a href="http://astaroth.nit.gwu.edu/~sweth/disc.html">*</a>


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

Date: 12 Aug 1998 02:47:56 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: chown -h
Message-Id: <6qrdqs$50h$1@monet.op.net>

In article <sweth-usenet-1208980001310001@alex-va-n013c081.moon.jic.com>,
Sweth Chandramouli <sweth-usenet@astaroth.nit.gwu.edu> wrote:
>foreach file (@filelist) {
>   (@stats = stat $file) && (@lstats = lstat $file);
>   if (($stats[0] != $lstats[0]) or ($stats[1] != $lstats[1])) {

It seems to me that

    if (! -l $file) { 


would be much simpler here.

>how much difference (if any) is there in efficiency between
>running each of chown (functions) separately, versus doing a `push
>@plainfilelist, $file' in the foreach loop, and then a `chown $newid, -1,
>@plainfilelist' after the loop? 

Probably not too much.  But the difference for the other branch of the
test, where a new process is spawned, is probably worth investigating.


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

Date: Wed, 12 Aug 1998 05:04:31 GMT
From: Larry Phillips <larryp1@home.com>
Subject: Coinages [ arborescence... ]
Message-Id: <35D122A7.191DB85@home.com>

Bob Newman wrote:
> 
> Mark-Jason Dominus wrote:
>>  English becomes rich and robust through the constant
>> assimilation of new coinages, and I deem `arborescence' to be
>> eminently worthy of such assimilation.
> 
> I deem it to be already standard English.

Some of my favourite words come from typos, misreadings, and mishearings
that suggest another word that should be in the language. I collected
two more today, one that I misread, and one, a typo by a friend.

arboriginal - n. native tree
caculation - n. math for sewage treatment plants.

-- 
------------------------------------------------------------
  Sixty billion gigabits can do much. It even does windows.
    -- Fred Pohl, Beyond the Blue Event Horizon, 1980

    http://cr347197-a.surrey1.bc.wave.home.com/larry/


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

Date: 12 Aug 1998 06:03:19 GMT
From: Chris Sidi <sidi@angband.org>
Subject: Re: Date Question...
Message-Id: <6qrb77$4fs$1@news-int.gatech.edu>

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

> OK, lets! The following should be bulletproof, in the sense that it
> prints "yesterdays's date" (as requested by the original poster) 
> together with the current local time (even if that was 23 or 25 hours ago).

It won't work on April 6, 1998 or April 5, 1999, I believe.
Running the code below I get:

  Pretending I started at Mon Apr  5 09:06:40 1999
  Sat Apr  3 09:06:40 1999


#!/usr/local/bin/perl -w
use strict;

# Test day after springing forward
 
#local $^T = 891867600; #Apr6 1998
local $^T = 923317600;  #Apr5 1998
print "Pretending I started at " . localtime($^T) . "\n";

#Larry's original code follows

my ($l_min, $l_hour, $l_year, $l_yday) = (localtime $^T)[1, 2, 5, 7];
my ($g_min, $g_hour, $g_year, $g_yday) = (   gmtime $^T)[1, 2, 5, 7];
my $tz_offset = 60 * ($l_min - $g_min) + 3600 * ($l_hour - $g_hour) +
       86400 * ($l_year <=> $g_year || $l_yday <=> $g_yday);
my $l_midnight = $^T - ($^T + $tz_offset) % 86400;
print substr(localtime($l_midnight - 86400), 0, 10),
       substr(localtime($^T), 10), "\n";
__END__

-Chris Sidi, wondering if this is a brickbat...


> It
> relies on the property that the date 24 hours before local midnight is 
> always the previous date, regardless of Daylight Savings Time transitions 
> (which never happen near midnight, to avoid this very confusion).  The 
> scalar localtime function still does the heavy work of figuring out what 
> year/month/day that date is.

> #!/usr/local/bin/perl -w
> use strict;

> my ($l_min, $l_hour, $l_year, $l_yday) = (localtime $^T)[1, 2, 5, 7];
> my ($g_min, $g_hour, $g_year, $g_yday) = (   gmtime $^T)[1, 2, 5, 7];
> my $tz_offset = 60 * ($l_min - $g_min) + 3600 * ($l_hour - $g_hour) +
>       86400 * ($l_year <=> $g_year || $l_yday <=> $g_yday);
> my $l_midnight = $^T - ($^T + $tz_offset) % 86400;
> print substr(localtime($l_midnight - 86400), 0, 10),
>       substr(localtime($^T), 10), "\n";
> __END__

> Kudos or brickbats gratefully ignored.


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

Date: Wed, 12 Aug 1998 06:28:58 +0200
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: dates in excess of 2037 (A Problem???)
Message-Id: <35d11a0a.524144494f47414741@radiogaga.harz.de>

Dan Nguyen (nguyend7@egr.msu.edu) wrote:
: Okay so the designers of UNIX weren't thinking.  Its nothing new look
: at the Y2K problem. But the solution for it is simple.  Newer
: computers will be using a 64-bit long int rather than a 32-bit long
: int.

Might I point out that VMS had a 64-bit time representation right from
v1.0 (though storing 100 nanosecond units since 17-NOV-1858, this will
be enough until year 30000+)? Now that's what I call foresight...

cu,
  Martin
--
                          | Martin Vorlaender | VMS & WNT programmer
 OpenVMS: Where do you    | work: mv@pdv-systeme.de
 want to BE today?        |       http://www.pdv-systeme.de/users/martinv/
                          | home: martin@radiogaga.harz.de


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

Date: Wed, 12 Aug 1998 10:21:20 +0200
From: Clas <qmwclka@emw.ericsson.se>
Subject: Execute a program then return to perl?
Message-Id: <35D1507F.D62F739F@emw.ericsson.se>

Hello!

I don't know how to execute a program then return back to perl.

I use the exec method, but this doesn't seem to be right .
Because after the exec command I come right to the shell... :-(

Any smart idea how I should do to solve this problem??

Thank you for any suggestion!

//Clas



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

Date: Wed, 12 Aug 1998 00:22:18 -0400
From: "Mr. mister" <leegala@nospam.ican.net>
Subject: formmail.cgi security
Message-Id: <35D1187A.2C531B6A@nospam.ican.net>

hello,
Can anyone help me re: formmail security.
I'm currently using Matt Wright's 'formmail.cgi' script to handle the
results of a form to be sent back to me via email. I would like to
secure this transaction. I can currently secure my web page however
securing the actual cgi form is another thing.

Currently I get the message back "server not responding or is down,
contact administrator"


--
********* please remove "spam" if replying ***********




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

Date: 12 Aug 1998 09:38:46 +0200
From: Marius Kjeldahl <marius@ace.funcom.com>
Subject: Re: Help using CGI_lite
Message-Id: <52hfzi6455.fsf@ace.funcom.com>

>>>>> "hstack" ==   <hstack@att.com> writes:

  hstack> I have a form that posts a hidden field that includes a text
  hstack> string like the following <INPUT TYPE="hidden"
  hstack> NAME="argument_string" value=-user foofoo -src_master
  hstack> -dst_design 187 ->

The value of your value attribute needs to be enclosed in ""s (since
it includes special characters and spaces).

Marius


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

Date: Wed, 12 Aug 1998 05:38:19 GMT
From: cka@jawa.org
Subject: Help with script (If/Elsif/else)
Message-Id: <35d1270a.7674360@news.megsinet.net>

I have two domains linked to my static ip address: jawa.org and
alumni.joliet.il.us.

I would like to be able to take a person to a different page,
depending on what domain they are using.

This is the script I wrote:  (Line numbers for reference)
1:  #!/usr/local/bin/perl
2:  $incominghost="/L$ENV{'HTTP_HOST'}/E";
3:   
4:  IF ($incominghost eq "www.jawa.org")  {
5:    print("Location: http://www.jawa.org/default.htm\n\n");
6:     }
7:  ELSIF ($incominghost eq "jawa.org")  {
8:      print("Location: http://www.jawa.org/default.htm\n\n");
9:     }
10:  ELSIF ($incominghost eq "alumni.joliet.il.us")  {
11:      print("Location: http://www.jawa.org/alumni/index.html\n\n");
12:     }
13:  ELSE  {
14:      print("Location: http://www.jawa.org/toc.htm/n/n");
15:     }

When I run with perl, I receive an error that states:
syntax error at test.cgi line 6 near "}"
Execution of test.cgi aborted due to compilation errors.

I have tried replacing eq with = and ==.

I've been digging through the books I have on Perl 5, the online FAQs,
and this newsgroup to no avail.  Any assistance in determining what
the error is would be appreciated.

Thank you,
Chris



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

Date: 12 Aug 1998 05:44:10 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Help with script (If/Elsif/else)
Message-Id: <slrn6t2ata.ri3.sholden@pgrad.cs.usyd.edu.au>

On Wed, 12 Aug 1998 05:38:19 GMT, cka@jawa.org <cka@jawa.org> wrote:
>I have two domains linked to my static ip address: jawa.org and
>alumni.joliet.il.us.
>
>I would like to be able to take a person to a different page,
>depending on what domain they are using.
>
>This is the script I wrote:  (Line numbers for reference)
>1:  #!/usr/local/bin/perl
>2:  $incominghost="/L$ENV{'HTTP_HOST'}/E";
>3:   
>4:  IF ($incominghost eq "www.jawa.org")  {
>5:    print("Location: http://www.jawa.org/default.htm\n\n");
>6:     }
>7:  ELSIF ($incominghost eq "jawa.org")  {
>8:      print("Location: http://www.jawa.org/default.htm\n\n");
>9:     }
>10:  ELSIF ($incominghost eq "alumni.joliet.il.us")  {
>11:      print("Location: http://www.jawa.org/alumni/index.html\n\n");
>12:     }
>13:  ELSE  {
>14:      print("Location: http://www.jawa.org/toc.htm/n/n");
>15:     }
>
>When I run with perl, I receive an error that states:
>syntax error at test.cgi line 6 near "}"
>Execution of test.cgi aborted due to compilation errors.
>
>I have tried replacing eq with = and ==.
>
>I've been digging through the books I have on Perl 5, the online FAQs,
>and this newsgroup to no avail.  Any assistance in determining what
>the error is would be appreciated.

perldoc perlsyn

mmm IF, ELSIF, and ELSE... can't see them anywhere...
if, elsif, and else... on the other hand they are everywhere....


Sam



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

Date: Wed, 12 Aug 1998 07:41:57 GMT
From: Marc.Haber-usenet@gmx.de (Marc Haber)
Subject: Re: How to untaint a directory path?
Message-Id: <6qrh1t$lpp$2@nz30-priv.rz.uni-karlsruhe.de>

mnc@diana.law.yale.edu (Miguel Cruz) wrote:
>Well, the obvious way would be:
>
>  $directory =~ /(.*)/;
>
>which would leave an untainted copy in $1.

I usually use $directory =~ /^(.*)$/;  Am I paranoid?

Greetings
Marc

-- 
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber          |   " Questions are the         | Mailadresse im Header
Karlsruhe, Germany  |     Beginning of Wisdom "     | Fon: *49 721 966 32 15
Nordisch by Nature  | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29


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

Date: Wed, 12 Aug 1998 10:27:07 +0200
From: "Michael Skjxtt Kjfr" <mskk@tdk.dk>
Subject: IE 4.01 and flush to STDOUT or nonparsed Headers
Message-Id: <6qrjks$r6a$1@gatekeeeper.teledanmark.dk>

Hello All,

I have a problem with a CGI script on a Unix webserver (Netscape server
2.0). We are trying to flush stdout to the browser (IE 4.01), but the
browser wait for the script to finish execute before writing anything in the
browser. In netscape it works fine. We have following test of what to do.
Filename nph-demo.pl (nonparsed headers)

#!/usr/tdb-com/global/bin/perl
print "$ENV{'SERVER_PROTOCOL'} 200 OK\n";
print "Server: $ENV{'SERVER_SOFTWARE'}\n";
print "Content-type: text/plain\n\n";
$proces = fork();
if ($proces == 0)
{
$|=1;
for ($loop = 10; $loop >= 0; $loop--)
  {
  print "$loop\n"; $|=1;
  sleep (5);
  }
print "Blast Off!\n";
exit (0);
}
else
{
exit (0);
}

Can anybody tell me why this doesn't work in IE 4.01 and why it works in
Netscape????

This is a rather urgent we need to get the script in production.

Regards

Michael Kjfr




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

Date: Tue, 11 Aug 1998 23:12:22 -0500
From: "Curtis Jewell / Dennis Whalen" <cjdpcssd@ims-1.com>
Subject: Re: Is there a maximum recommended file size for Perl Scripts
Message-Id: <6qr4nn$7fl@enews2.newsguy.com>

brian d foy wrote in message ...
>In article <35CFCDAF.5AD4FE26@purco.qc.ca>, Leon Stepanian
<info@purco.qc.ca> posted:
>
>>Hi;
>>
>>Just a small question. My perl script is now 192K and includes lots of
>>sub_routines,
>>internal html prints, several file logging, updating and retreiving
>>sub_routines, along with a access code tracing system to make sure all
>>generated pages and actions are not activated via pages which were
>>bookmarked.
>
>perhaps you want to abstract everything into a module which is
>Autosplit, then write tiny scripts to perform logically different
>tasks.  each script only autoloads the functions it needs.


What I do on my unmoduled 100K script is to use SelfLoader instead of
AutoLoader, and put my __DATA__ line pretty high up (like at the 15K mark).

NOTE: If you use sort with your own sorting routine, the routine needs to
be ABOVE __DATA__ or it won't be found.

May work better for you, Leon. YMMV.

--Curtis





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

Date: Wed, 12 Aug 1998 10:33:53 +0200
From: frederic <fredjoua@club-internet.fr>
Subject: Mailing List scrip . Help needed
Message-Id: <35D15371.98F3F48A@club-internet.fr>

Il s'agit d'un message multivolet au format MIME.
--------------82B206A73E23C532060E620E
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi,

Could you recommend me a good mailing list script for :
- a moderated list
- that makes possible for the administrator to group sevral messages
posted in only one message that will be dispatched to the members of the
list.

Thanks for help

Frederic
mailto:fjouanneau@tenderonline.com

--------------82B206A73E23C532060E620E
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Carte pour Fridiric  Jouanneau
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             Fridiric  Jouanneau
n:              Jouanneau;Fridiric 
email;internet: fredjoua@club-internet.fr
x-mozilla-cpt:  ;0
x-mozilla-html: FALSE
version:        2.1
end:            vcard


--------------82B206A73E23C532060E620E--



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

Date: Wed, 12 Aug 1998 10:02:14 +0200
From: Clas <qmwclka@emw.ericsson.se>
Subject: Re: method=GET without CGI.pm ??
Message-Id: <35D14C06.748F07EA@emw.ericsson.se>

If  I understood your quetion right, you can do like this
You can store the text after the question mark like this:
$query = ENV{'QUERY_STRING'};

Hope this works for you, it did for me.

//Clas

Mike wrote:

> On a web site I am working on, we are trying to submit data through links
> such as:
>    <A HREF="/cgi-bin/search?id=3411"> Search Link </A>
>
> The problem is that on the server, CGI.pm is not enabled, and the only
> other way I know to get data from forms is from ENV{'CONTENT_LENGTH'}.
> Submitting the data directly in the URL like this won't put it in the
> environment variable, though, so how else can I extract this information
> in my perl script?
>
> (Please don't tell me I am SOL.  ;)
>
> - mike -





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

Date: 12 Aug 1998 05:37:52 GMT
From: kherron@campus.mci.net (Kenneth Herron)
Subject: Re: Need to Lock files (NFS)
Message-Id: <6qr9ng$hnf$3@news.campus.mci.net>

In article <35D04830.FAE00EC1@betalasermike.com>,
Michael A. Jones <jonesma@betalasermike.com> wrote:
|My
|program watches for the creation of such files, waits until it's closed
|and then does stuff to it. I would like to prevent anyone from opening
|it during my (short) processing just in case. I think that means locking
|it.

That said, as others have mentioned, reliable locking over NFS is a
problem.  You have a couple of more fundamental problems though.

a)	Unix (I assume you're using unix?) doesn't give arbitrary
	processes a way to tell if a file is open or not.  There
	are ways to work around this, and maybe you've developed a
	method, but it's not clear from your post so I thought
	I'd mention it.

b)      More importantly, unix file locks are advisory only.  Other
	process can check for a lock and voluntarily refrain from
	accessing the file if it's coded to do so, but you can't
	force the issue via file locks.  This is true of all the
	file systems commonly used on unix.

Let me suggest you see if the people in comp.unix.programmer can't
be more help.  This isn't really a perl question anyway.
-- 
Kenneth Herron -- kherron@campus.mci.net
"When Microsoft first took control of the Funk & Wagnalls Encyclopedia
product, there was a flattering biography of Bill Gates.  But it said he
was known as a tough competitor.  Now it says that he's known for his
charitable contributions." -- Gary Reback, <http://www.ljx.com/reback/>


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

Date: 12 Aug 1998 08:53:48 GMT
From: am@am.westblaak.spirit.nl (Andre Merzky)
Subject: Re: Need to Lock files (NFS)
Message-Id: <6qrl6s$f8m$2@newnews.nl.uu.net>

In article <35D0A867.475E@min.net>, John Porter <jdporter@min.net> writes:
    Andre Merzky wrote:
    > You can make it atomic.
  
    Um, mind if I trouble you for a precise explanation of how
    you can make an arbitrary sequence of operations to behave
    an as atomic operation?

Oops.. - Errrr.. - of course you're right, it's NOT atomic....
What I actually mean: 

usually one tries to atomic lock operation to avoid race conditions.
Race conditions can lead to unsuccessfull locking, and to conncurrent
acces of data, right? So, if you can check for race conditions and
can think about a scheme to trap them, you actually do not need
to have atomic locking. 
 
    >  - filename = test.dbm
    >  - look if any file exists with name: 'test.dbm.lock.(\d+)'
    >  - if yes, wait, try again etc.
    >  - if not: creat one: 'test.dbm.lock.<ipnum(localhost).pid>
    >   not atomic til now...
    >  - check if only YOUR file exists! :-)
    >  - if not: remove your's, wait random time, start from very beginning
    >  - if yes: work
   
    Reminds me of the cartoon  "...And then a Miracle occurs..."
 
Hmm, *scratch*, *think think think*, what do you mean? :-) I don't know it...:-(
Do you see any problems with this? - I think it is really all right. Hmm, 
I know, sometimes I should clean my glases... so, give me a hint :-)

Andre


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

Date: 12 Aug 1998 08:40:55 GMT
From: root@am.westblaak.spirit.nl (root)
Subject: Re: Newbie Question About 'for'
Message-Id: <6qrken$f8m$1@newnews.nl.uu.net>

In article <r8u33kb14r.fsf@asc.sps.mot.com>, Martin Gregory <mgregory@asc.sps.mot.com> writes:
 lr@hpl.hp.com (Larry Rosler) writes:
 
<-------------------------------------------
 
  > In article <martimer-1008980812070001@pool-207-205-143-51.rvdl.grid.net> 
  > on 10 Aug 1998 13:09:25 GMT, Martin Gallo <martimer@mindspring.com> 
  > says...
  > > I just started with Perl over the weekend (I have been programming off and
  > > on since 1980), and cannot understand why the simple program:
  > > 
  > > for ($a=1,$a<7, ++$a) {
  > > print $a,"\n"
  > > }
  > 
  > Try using semicolons instead of commas.  What you have specified is a 
  > "foreach" loop ("for" and "foreach" are synonyms) consisting of the three 
  > items $a = 1, $a < 7, ++$a.  These are evaluated before the looping 
  > begins, so the value of $a is 2.  This is then printed three times, once 
  > for each element of the list.  No surprise, but not what you wanted, 
  > either.
  
  
  I read this and thought "Bah hah - that's funny, but now I get it!"
  
  Then I did this:
  
    perl -e 'for ($a=1, $a < 7, $a++){print;}'
  
  Then I was confused again.  
  
  Can you predict what this prints?
  
  If you didn't predict it correctly, can you now explain why it does
  what it does?
  
  If you can, I'd love to know!
  
  Thanks,
  
  Martin.
  
--------------------------------------->
 
looking at:

perl -e 'for ($a=1, $a < 7, $a++){print; print "<$a>";} print "\n";'
                                       ^
and

perl -e 'for ($a=1, $a < 7, $a++){print  print "<$a>";} print "\n";'

meight give you an idea... - or confuse you even more..:-)

Well, actually you do not print the loop counter, but $_.
$_ is 2 from the last init statement in the first run, and later on 1
from the print statements in the run before...
Why the loop rans for 3 times was already explained in this thread I think..

Hth, Andre.



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

Date: Wed, 12 Aug 1998 09:41:04 +0200
From: Inge Soetens <soetensi@se.bel.alcatel.be>
Subject: passing variables
Message-Id: <35D14710.223C182D@se.bel.alcatel.be>

Hi all,


can somebody tell me if it is possible to pass variables which are
assigned in a Javascript function, to a perl script.

A part of the code of the perl script is included in here : 


print "Content-TYPE: text/html\n\n";
print "<HTML><HEAD>\n";
print  "<SCRIPT LANGUAGE='JavaScript'> \n";
print  "<!--  \n\n";
print  " var dp ;  \n ";
print  "	function GetDp() {  \n\n\n";
print  "  	 	dp = parent.fraList.document.update.dp_name.value ;  \n";
print  " 		return dp ; \n ";
print  "	}\n";
print  "//--> \n";
print  "</script> \n";
print "</HEAD>\n";
print  "<BODY ONLOAD=\"GetDp()\">  \n";

print "</BODY></HTML>\n";
print "<BR>\n";
    
now, the next step in this perl script has to do with the parameter dp
from the javascript function .
How can i read it here  ?

Can somebody help me ?


Thanks in advance


Kind Regards 
Inge


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

Date: Wed, 12 Aug 1998 00:41:42 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Pattern matching (text all uppercase)
Message-Id: <1ddmh29.hnkvlhdbcqoN@bay1-532.quincy.ziplink.net>

Ian McGowan <ian@netcom.com> wrote:

> or, you could convert it to all caps (honoring locale) and compare?
> 
>    $cf=$body;
>    #Stolen from http://www.perl.com/CPAN-local/doc/FMTEYEWTK/regexps.html
>    $cf =~ s/(\w+)/\U$1/g;

I think this is a rather more efficient way to convert to uppercase:

$cf = uc $body;

-- 
 _ / '  _      /         - 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: Wed, 12 Aug 1998 07:34:36 +0100
From: Jerry Pank <jerryp.usenet@connected.demon.co.uk>
Subject: Re: Pattern matching: Option "i"
Message-Id: <bFzdVQA8dT01Ewer@connected.demon.co.uk>

In <comp.lang.perl.misc> 
David Gallone <dgl@offis.lu>, writes:
>Is it possible that the option "i" can slow down search in the pattern
>matching on great data (2 MB)?
<snip>

I've no idea, but I know a lib that does...

use Benchmark;                                   # stopwatch
my $t0 = new Benchmark;                          # start the stopwatch
[...]                                            # your code here
my $t1 = new Benchmark;                          # stop stopwatch
my $secs = timestr(timediff($t1, $t0));          # calc total time

HTH
-- Jerry Pank                    mailto:jerryp.usenet@netconnected.com

How do Crays and Alphas handle the POSIX problem?
-- Larry Wall in <199709050042.RAA29379@wall.org>


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

Date: Wed, 12 Aug 1998 16:26:02 +1000
From: gleeson@unimelb.edu.au (Martin Gleeson)
Subject: Perl 5.005_02 install and DB_File
Message-Id: <gleeson-ya02408000R1208981626020001@news.unimelb.edu.au>

Hi Folks,
     I had a problem a while ago with errors when trying to extract info
from tie'd Berkeley DB's. It seems that the only option is to upgrade to
v2.x of Berkeley DB and the associated DB_File module. (I tried upgrading
to the 'BerkeleyDB' module with 5.004, but it just core dumped.)
     So, I'm trying to install 5.005_02 and the DB_File module. The problem
is that it's on a machine where I'm not the sysadmin, and db v1.85 is
installed in /usr/lib and /usr/shlib. I can add the include and library
paths at the start of every list of options where it is relevant, but the
tests inside Configure are crafted in such a way that they always look in
the system directories for either the library or the header file (or both)
before they'll look inside the directories where I've installed db 2.4.12,
so they fail and won't build DB_File.
     Any ideas?

Cheers,
Marty.
--
Martin Gleeson
** Personal opinion only **
Imagine, if you will, a world without hypothetical situations...


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

Date: Wed, 12 Aug 1998 08:52:48 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Perl Docs.. forget the original post
Message-Id: <35d652a0.4553392@news.tornado.be>

Jaime Metcher wrote:

>I've seen people on this ng get annoyed when people ask a
>question about something that is already explained in (for example):
>
>1. The camel book (fair enough).
>2. Not in the camel book, but in perlre (still fair enough).
>3. Not in either the camel or perlre (where they thought it would be)
>but in perlop (yeah, OK, they should have grepped).

The first doc I always look at is perlfunc. You seem to have forgotten
about that one.

perlre is for regular expressions, perlop is for operators, perlfunc is
for functions. Not every problem in Perl is a regular expression
problem!

>4. In neither the camel, perlre or perlop, but somewhere in one the the
>many parts of the FAQ list (ditto, but I'd be giving points for trying).
>5. In none of the above, but answered on this ng and therefore in
>DejaNews (fatigue allowance here, especially for newcomers).

	Bart.


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

Date: Wed, 12 Aug 1998 03:10:24 -0400
From: Sudheer Havaligi <suh@jupiter.cs.wayne.edu>
Subject: Perl on PWS on Win NT Ws
Message-Id: <Pine.SUN.3.91.980812030927.622A-100000@jupiter.cs.wayne.edu>

Hi all,

        I want to run perl 5.00x on Personal Web Server (PWS) on Windows NT
workstation. I installed PWS then perl 5.00x and now what. I even went to
FAQ of perl web site. I saw the same question posted there and made the
respective registry changes that r needed to be made. But in vain.

Please someone help me.

Thanks in advance.
-Sudheer.


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

SUDHEER HAVALIGI
Home# (313) 833 7555
Off # (313) 993 7739

E-Mail :- 1. suh@cs.wayne.edu
          2. sudheer.havaligi@wayne.edu

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@



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

Date: Wed, 12 Aug 1998 08:52:50 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: perlfaq - frequently asked questions about Perl (part 0 of 9)
Message-Id: <35d75403.4908372@news.tornado.be>

Ilya Zakharevich wrote:

>(is it correct that Win* has no format for
>online books?!).

 .HLP files would qualify, IMO.

But Bill has decided to droip it in favour of HTML. MS-flavoured HTML,
that is.

	Bart.


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

Date: Wed, 12 Aug 1998 00:08:47 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: re first language
Message-Id: <35D1154F.21F7E717@erols.com>

REAL programmers toggle the machine code in on the front panel, one byte
at a time.

Next?

Steve Linberg wrote:
> 
> In article <01bdc1f7$ad850220$47eb1bcc@XSTA71.pcr.com>, "Matt Heusser"
> <matt@pcr7.pcr.com> wrote:
> 
> > Forget that.  When I was in college, I took a course
> > in VAX assembler, and we had to take our assembler
> > code and turn it into Hex or Octal.  REAL programmers
> > code in Octal.    ;-)  <Sarcasm clearly implied>
> 
> REAL Real Programmers punch their own cards.  :)
> _____________________________________________________________________
> Steve Linberg                       National Center on Adult Literacy
> Systems Programmer &c.                     University of Pennsylvania
> linberg@literacy.upenn.edu              http://www.literacyonline.org

-- 
#!/usr/bin/perl -- Matthew O. Persico
print "Just Another Perl Neophyte\n";
## Simplicity is a blessing when you're 
## supporting the program at 2AM


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

Date: Wed, 12 Aug 1998 08:52:52 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: re first language
Message-Id: <35d85492.5051617@news.tornado.be>

Matthew O. Persico wrote:

>REAL programmers toggle the machine code in on the front panel, one byte
>at a time.
>
>Next?

   Real programmers program by whistling down the MIC IN port of a ZX80.
						       -- Adrian Millett


	Bart.


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

Date: Wed, 12 Aug 1998 08:40:11 GMT
From: sfe@iname.com
Subject: unlink files in directories with spaces (win95)
Message-Id: <6qrkda$5ev$1@nnrp1.dejanews.com>

Hi there

I've a problem to unlink files in directories with spaces (Win95)

ex:
         unlink <c:\tmp\hello world\*.*>


Can anybody help ??

Regards
Sandro

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 12 Aug 1998 07:50:46 GMT
From: Patricia Kuo <patricia@www.ccca.nctu.edu.tw>
Subject: Upload file running on NT
Message-Id: <6qrhgm$398$1@news2.nctu.edu.tw>


        I am trying to use perl upload script running
        on NT+IIS (with ActivePerl Installed)
        text file works fine but the binary file is differ when
        it's doing the write (print <FILEHANDLE>) action

        Afer comparing the original file and the transfered file,   
        found that probably there is an addition character (\x0D) added
        when it meet \n (I'm not so sure what' happen to the binary file
        but I'm sure it does happen to text file)

        is this a problem of windows platform when writing a file or
        any function to write the file without changing the content
        on NT ? (the script works fine on Unix platform)

        any help will be greatly appreciated :)          



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

Date: Wed, 12 Aug 1998 00:41:43 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: use strict problem with indirect file variables ?
Message-Id: <1ddmhny.m3qwni1pt3gw9N@bay1-532.quincy.ziplink.net>

Phil Taylor <phil@ackltd.demon.co.uk> wrote:

> I bet you don't fully understand how your car works, but you still use
> it.

Let's consider the difference between driving a car and building a car.

Now let's consider the difference between using a Perl program and
writing a Perl program...

-- 
 _ / '  _      /         - 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: Wed, 12 Aug 1998 06:38:47 GMT
From: GBremner@cnbceurope.com
Subject: WILLING TO PAY FOR HTML GRABBING SCRIPT.
Message-Id: <6qrd9n$skv$1@nnrp1.dejanews.com>

I wish to grab text from an HTML page that changes periodicaly (yes we have
permision). We need to only grab selected info from that page ie news
headlines, its URL,a short paragraph relating to the story and possiblly
graphics link. This information is then created in a simple text document to
a predefined format in a directory on our servers. I know that this would be
a fairly simple scripting procedure, but I am looking for someone with a good
experiance of cgi to create the above and to offer good support if it doesnt
work and to provide tech documentation. I am willing to pay some money for
this simple script. So please contact me if you have any samples or wish to
discuss this further or even if you can think of a better way to do this.

Grant Bremner
__________________________________

CNBC Europe
Interactive Producer
Email : GBremner@cnbceurope.com

__________________________________

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Wed, 12 Aug 1998 04:38:54 GMT
From: ptimmins@netserv.unmc.edu (Patrick Timmins)
Subject: Re: X-file (?=...), case postponed.
Message-Id: <6qr68u$jts$1@nnrp1.dejanews.com>

In article <6qqc6p$d0c$2@client3.news.psi.net>,
  abigail@fnx.com wrote:
> Patrick Timmins (ptimmins@netserv.unmc.edu) wrote on MDCCCVI September
> MCMXCIII in <URL: news:6qprfb$hoj$1@nnrp1.dejanews.com>:
> ++
> ++ Do I finally get it?
>
> No. Not really. And yes, it's documented:
[snip]

Actually, I think I get it, but I'm now just trying to figure out the
rational as to why it was designed to work the way it works.

I know it's apples and oranges, but

    sqrt(4*(1+3))
vs
   split/(?=(.*))/

'print sqrt(4*(1+3));' works its' way from the inner to the outer to print
'4'. I guess, to me if the sqrt function used the same sort of rational as
split, sqrt(4*(1+3)) would print out '8' (the sqrt of 4 * (1+3)), which is
silly. I think the way split funtions with parenthetical matches is silly.

I now know *how* split/(?=(.*))/ works, I'm just wondering *why* it was
designed so that:

split/(?=(.*))/s, "Just another Sig\n";
gives elements of: ('J', 'ust another Sig\n', 'u', 'st another Sig\n', etc)

instead of the less silly and more sensible elements of:
('Just another Sig\n', 'J', 'ust another Sig\n', 'u', etc).

So I'm not saying I don't understand why it gives the elements it does.
I'm saying I don't understand why it doesn't work the way you (read 'I')
would guess it works, since there is nothing in the fine documentation to
otherwise "tip you off" to this silliness. :)

Abigail also wrote:
> Abigail
> --
> perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")\n-> define
("foldoc", "perl")) [0] -> print'
>

Please stop hurting me.

Patrick Timmins
U. Nebraska Medical Center

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 12 Jul 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 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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