[8889] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2506 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 5 16:18:02 1998

Date: Tue, 5 May 98 13:00:31 -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           Tue, 5 May 1998     Volume: 8 Number: 2506

Today's topics:
        A bug in CGI.pm?? <upsetter@shore.net>
    Re: Computing length of hash <jkry3025@comenius.ms.mff.cuni.cz>
    Re: cookies esxpiration <sowmaster@juicepigs.com>
    Re: CPAN & Module gripes (was Re: Ever Wonder...?) lvirden@cas.org
    Re: CPAN & Module gripes (was Re: Ever Wonder...?) (Clinton Pierce)
        database file where specific users can edit ONLY one re <tasburfoot@yahoo.com>
    Re: Grabbing a webpage with Perl (Sitaram Chamarty)
    Re: Grabbing a webpage with Perl (brian d foy)
        Having problems with Win32::AdminMisc package qvanegeren@frxsoft.com
    Re: help a novice in perl! (Hakan Hjelmstrom)
        help on perl5.004_04 installation lab318@osu.edu
    Re: HELP! how do I insert page breaks?! <sowmaster@juicepigs.com>
        HELP: PERL Tutorial... <vpedrosa@ccg.uc.pt>
    Re: HELP: PERL Tutorial... <brianm@kodak.com>
    Re: How to delete an element in an array? (Mark-Jason Dominus)
    Re: How to make a "Please wait" page during script proc (Dane Jackson)
    Re: I/O to serial device (Mark-Jason Dominus)
        implemented by XS functions really faster? <johnc@interactive.ibm.com>
    Re: Interactive Chem Test <rootbeer@teleport.com>
    Re: Is this a safe lock? (Earl Hood)
        Looking for Perl parser for 'C' language input files <jpayne@us.oracle.com>
    Re: need help with hashtable size/memory <hadley@globin.bio.warwick.ac.uk>
    Re: Personal Web Server <rootbeer@teleport.com>
        pod2texinfo? (John L. Daschbach)
    Re: problem reading DB_File on win32 platform (bgeer)
    Re: Question on sorting (Sitaram Chamarty)
    Re: Remove newline <aqumsieh@matrox.com>
    Re: Rounding a number <sowmaster@juicepigs.com>
    Re: Service Name with white space <aqumsieh@matrox.com>
        Split problem Form (Henry Lifton)
    Re: stat function (Mark-Jason Dominus)
        Torvalds.com -- New development. (Ed Jamison)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 5 May 1998 19:31:54 GMT
From: Art Cohen <upsetter@shore.net>
Subject: A bug in CGI.pm??
Message-Id: <6inpfa$5r5@fridge.shore.net>


Well, the irony of this is rather amusing, but I believe I've found a bug
in CGI.pm. I'm sure that if this is actually a "feature", there will be
plenty of folks willing to point that out to me politely.

At any rate, consider the following code:

	#!/usr/bin/perl -w

	use CGI ':cgi-lib';
	#require "cgi-lib.pl";
	use Time::Local;
	use Time::ParseDate;

	&ReadParse;
	print &PrintHeader;
	print "<P>Hello world!<P>\n";

	print "Date entered is $in{'date_entered'}<P>\n";

	$result             = parsedate ($in{'date_entered'});
	$in{'date_entered'} = $result;

	print "Result is $result<P>\n";
	print "Date entered is $in{'date_entered'}<P>\n";

Now, when called with a valid date, the output is what you would expect:

	Hello world!

	Date entered is 5/5/98

	Result is 894340800

	Date entered is 894340800


However, when called with an invalid date (any arbitrary string, for
example) something very *peculiar* happens:

	Hello world!

	Date entered is foobar

	Result is 

	Date entered is foobar
                        ^^^^^^

Huh? I explicitly set $in{'date_entered'} = $result, yet the new value
(undef in this case) isn't being stored.

If I switch the script around to use cgi-lib.pl instead of CGI.pm, it
works just fine.

WTF?

--Art

National Ska/Reggae Calendar: www.ziplink.net/~upsetter/ska/calendar.html
        Boston Ska Home Page: www.ziplink.net/~upsetter/ska/index.html



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

Date: Tue, 05 May 1998 21:46:08 -0700
From: Jan Krynicky <jkry3025@comenius.ms.mff.cuni.cz>
Subject: Re: Computing length of hash
Message-Id: <354FEB10.53EE@comenius.ms.mff.cuni.cz>

Mark-Jason Dominus wrote:
> 
> In article <354EB877.8354265@ubs.com>,
> Ian Maloney  <ian.maloney@ubs.com> wrote:
> >In the Camel book (p.183) the recommended way to get the length of a
> >hash is with:
> >
> >scalar keys %hash;
> >
> > and is there an alternative?
> 
> No.

Oh yes, there is. (TIMTOWDI :-)

Ordinary %hash in scalar context returns "the number of items/the number
of buckets".
That is something like "10/31".

	$len = %hash + 0;
does exactly what you want.

I have tried it with SDBM_File and it returns correct numbers as well.

I even tried it with Interpolation (mostly to find out how is
it implemented - what methods of that class are called) and I got 
reasonable result (0), but no method was called at all.
(I even added a debug print into FETCH!)

So how does perl know the answer????

Jenda

PS: The watched methods : FETCH, STORE, DELETE, CLEAR, EXISTS, FIRSTKEY,
NEXTKEY
none of them was trigered when I evaluated  
	$scalar = %tied_hash+0;
Is there something else?


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

Date: Tue, 05 May 1998 13:50:08 -0400
From: Bob Trieger <sowmaster@juicepigs.com>
Subject: Re: cookies esxpiration
Message-Id: <354F5150.78B@juicepigs.com>

mdlbikes@walrus.com wrote:
> 
> I trying to set a cookie to expire an hour from the time the cgi script runs.
> I am using the syntax "Set-Cookie: Day, mon-day-year 00:00:00 GMT". What
> happens is that Netscape shows me the alert window with a different expiration
> time an date. Is there a specific syntax for the date on the Set-Cookie
> command?

perl doesn't have a Set-Cookie command.

I believe the newsgroup you are looking for is:
	news:comp.infosystems.www.authoring.cgi 
and your question is probably answered in their FAQ.

good luck
-- 
Bob Trieger               |  Titanic: big boat, bigger
sowmaster@juicepigs.com   |           iceberg, big deal


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

Date: 5 May 1998 17:58:20 GMT
From: lvirden@cas.org
Subject: Re: CPAN & Module gripes (was Re: Ever Wonder...?)
Message-Id: <6injvs$6vr$1@srv38s4u.cas.org>


According to Stuart McDow <smcdow@arlut.utexas.edu>:
:It sounds like you don't know how the CPAN and PAUSE works. If my
:understanding is correct, authors are registered by name. There has to
:be *somewhere* they upload files to.

Not only that, but often i find that if one particular module is useful,
when I go to the author's directory I discover other useful modules that
I wouldn't have thought to search for.
-- 
<URL:mailto:lvirden@cas.org> Quote: In heaven, there is no panic,
<*> O- <URL:http://www.teraform.com/%7Elvirden/> only planning.
Unless explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.


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

Date: 5 May 1998 18:48:35 GMT
From: cpierce1@cp500.fsic.ford.com (Clinton Pierce)
Subject: Re: CPAN & Module gripes (was Re: Ever Wonder...?)
Message-Id: <6inmu3$fbq7@eccws1.dearborn.ford.com>

In article <6inhn2$lgb$1@ns1.arlut.utexas.edu>,
	smcdow@arlut.utexas.edu (Stuart McDow) writes:
	(Re-arranged slightly to put like points together)
>cpierce1@ford.com writes:
>>
>> Mostly because I could almost never find the module they were
>> talking about on CPAN, or get it installed without a lot of
>> problems--so I re-invented a LOT of Perl's wheels.  Not a really
>> good use of my time.
>
>I can't understand why we (you and I) have such different experiences
>with CPAN. I've been using perl for a long time, but I didn't start
>playing around with CPAN.pm until about six months ago. From day one,
>I was able to download, build, and install modules (and bundles)
>without *any* problems. Then I kicked myself for putting off using it
>for so long. I'm just not understanding what is so difficult about
>CPAN.pm.
> ...
>What's wrong with
>% perl -MCPAN -eshell
>cpan> i /something/
>      [ ... stuff about modules and bundles is returned ... ]
>cpan> readme module

The problem is that I'm behind _VERY_ thick firewalls here.  I'm going
through HTTP proxies, FTP bastion-hosts and internal newsfeeds to hear
anything about Perl.  

The "automagic" approach makes a lot of assumptions about your current
networking environment, which aren't necessarily true.  And between 
having no CPAN and automagic CPAN, there's a lot of crap.

>> But since the re-invention of that module is strongly discouraged by
>> the Perl Cabal, the author has no incentive to keep his descriptions
>> up-to-date, dependencies low, and user-interface easy to use.  Thank
>> the gods that CPAN has no competition.
>
>Perl is a general-purpose language. One can work at any level of
>abstraction one chooses to. There is nothing to stop people from
>reinventing the wheel if they want to. A lot of us have already
>reinvented the wheel bazillions of times during the reign of perl4. I
>can't speak for everyone, but I've done it enough times to never, ever
>want to do it again (except for those cases where a particular wheel
>didn't already exist, but then that wouldn't be reinvention. It'd be
>just invention). For that, I'm extremely grateful for modules
>available from the CPAN. If were to post on clpm, asking how to do
>something, I'd be *very* annoyed if someone explained to me how to
>reinvent the wheel and I later found that the wheel was available from
>the CPAN. Very annoyed indeed.

I'm grateful for CPAN, in any shape.  Yes, people going about Hard Tasks
by using stone knives and bearskins really need to be told to about CPAN.
Their Questions should be answered as well.  Right now, if a "module newbie"
asked me about the MIME stuff I used as an example earlier, I'd have to
answer: "You might want to try the MIME::Parser module on CPAN.  it might 
be part of libwww, or it might be in mime-tools.  I dunno.  It's not
really that well documented.  But if you get too frustrated, and this 
is a throwaway piece of code, take a look at RFC...."


-- 
+------------------------------------------------------------------------+
|  Clinton A. Pierce    |   "If you rush a Miracle Man,   | http://www.  |
|  cpierce1@ford.com    |     you get rotten miracles"    | dcicorp.com/ |
| fubar@ameritech.net   |--Miracle Max, The Princess Bride| ~clintp      |
+------------------------------------------------------------------------+
GCSd-s+:+a-C++UALIS++++P+++L++E---t++X+b+++DI++++G++e+>++h----r+++y+++>y*



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

Date: Tue, 05 May 1998 18:11:46 GMT
From: "Joe Raymundo" <tasburfoot@yahoo.com>
Subject: database file where specific users can edit ONLY one record each
Message-Id: <CDI31.12$oC2.64848@news.san.rr.com>

I need to create a ascii database where certain users of the system can edit
only one record. Basically their own.  Any thoughts as to the best way to
set this up?




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

Date: 5 May 98 17:26:17 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: Grabbing a webpage with Perl
Message-Id: <slrn6krve0.er.sitaram@ltusitaram.unidata.com>

On Mon, 27 Apr 1998 11:06:21 -0400, John Chambers <jc@ral1.zko.dec.com> wrote:
>Chris wrote:
>> Does anyone know how to have a Perl program get a web page?  I just need
>> for it to grab a url I give it.  Thanks.
>
>If you check with the CPAN archives, the CGI module has a little program
>called GET that does this.  This does require having a relatively recent perl,

[snipped]

Chris: if garbbing a simple web page is all you need, you could
try either
    lynx -source http://blah.blah.com > file
or, for more advanced use, download and try GNU wget.

Please dont flame me for suggesting a non-Perl solution.  Perl is
great because you can do anything in Perl, but that doesn't mean
everything *must* be done in Perl, when more specific tools are
available.


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

Date: Tue, 05 May 1998 15:57:24 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Grabbing a webpage with Perl
Message-Id: <comdog-ya02408000R0505981557240001@news.panix.com>
Keywords: from just another new york perl hacker

In article <slrn6krve0.er.sitaram@ltusitaram.unidata.com>, sitaram@diac.com (Sitaram Chamarty) posted:


>Chris: if garbbing a simple web page is all you need, you could
>try either
>    lynx -source http://blah.blah.com > file
>or, for more advanced use, download and try GNU wget.
>
>Please dont flame me for suggesting a non-Perl solution.  Perl is
>great because you can do anything in Perl, but that doesn't mean
>everything *must* be done in Perl, when more specific tools are
>available.

especially when they depend on a certain platform and makes it more
difficult to play with the fetched data programagically

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
i hate portability as much as the next guy


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

Date: Tue, 05 May 1998 12:56:59 -0600
From: qvanegeren@frxsoft.com
Subject: Having problems with Win32::AdminMisc package
Message-Id: <6injta$up4$1@nnrp1.dejanews.com>

I downloaded the AdminMisc module from CPAN and installed
it on my NT 4.0 machine.  When I attempt to use the test.pl
program that comes with the distribution I get an error
that says "cannot locate GetProccesso.al in @INC".  There
are no .al files included in the distribution, and being
relatively new to PERL, I don't know exactly what these
files are for.  I am using AdminMisc::GetFileInfo to figure
out the version of various files.  Any help/suggestions
would be greatly appreciated.  Thanks...

Quenten Van Egeren
FRx Software Corporation




-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Tue, 05 May 1998 18:23:40 GMT
From: hawk@algonet.se (Hakan Hjelmstrom)
Subject: Re: help a novice in perl!
Message-Id: <354f5614.13481625@news.algonet.se>

On Tue, 5 May 1998 17:04:07 +0200, "sg" <info@atig.fr> wrote:
> I would wanted to do a perl script which can
> put in a table, *.html files founded in a directory.
> but (even if i've made some researches on
> FAQ, and try to found an information on perl
> book) i didn't found a function which can return
> (or repertoriate) the *.html files in a directory.
> thanks you very much to help me!

Take a look at the readdir function. 
The docs even have an example that will work for you.

Hekan Hjelmstrvm
hawk@algonet.se


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

Date: Tue, 5 May 1998 15:15:36 -500
From: lab318@osu.edu
Subject: help on perl5.004_04 installation
Message-Id: <lab318.33.00309B80@osu.edu>

Hi All.

We have a SUN OS (5.5.1), and it is the first time we try to install 
Perl5.004_04 on it.  After "configure" and "make", it failed 28 out of 153 
tests (under "make test") and failed 3 out of 101 tests (under "make 
minitest").  The typical error message is:

lib/socket........Can't load module Socket, dynamic loading not available in thi
s perl.
  (You may need to build a new perl executable which either supports
  dynamic loading or has the Socket module statically linked into it.)
 at ./lib/socket.t line 14
BEGIN failed--compilation aborted at ./lib/socket.t line 14.
panic: corrupt saved stack index.
panic: corrupt saved stack index.
panic: corrupt saved stack index.
panic: corrupt saved stack index.
panic: corrupt saved stack index.
panic: corrupt saved stack index.
panic: corrupt saved stack index.
FAILED at test 0

Any suggestions on how to fix them?  Thanks.


--YY 



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

Date: Tue, 05 May 1998 14:08:50 -0400
From: Bob Trieger <sowmaster@juicepigs.com>
To: Andrew Sisson <asisson@onramp.net>
Subject: Re: HELP! how do I insert page breaks?!
Message-Id: <354F55B2.167E@juicepigs.com>

Andrew Sisson wrote:
> 
> Is there a special character for page breaks in PERL? I've tried "\f" -
> form feed, and this doesn't work. Thanks.

This isn't a perl question. It depends on what control characters that
your operating system and output device recognize.

-- 
Bob Trieger               |  Titanic: big boat, bigger
sowmaster@juicepigs.com   |           iceberg, big deal


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

Date: Tue, 05 May 1998 18:37:12 +0100
From: Vitor Varalonga <vpedrosa@ccg.uc.pt>
Subject: HELP: PERL Tutorial...
Message-Id: <354F4E48.A2CCB4CF@ccg.uc.pt>


--------------66AEF720DF6B5B6E497CFEC1
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

    Greetings!!!


    I'm new into this PERL stuff and
I would like to know if anyone can give
me a hand. Does anyone knows of the
existence of any Tutorials, FAQs and other
stuff on the Web concerning PERL that might
interest.

                    Thanx in advance,

                     Vitor Varalonga

--------------66AEF720DF6B5B6E497CFEC1
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<HTML>
<TT>&nbsp;&nbsp;&nbsp; Greetings!!!</TT>
<BR><TT></TT>&nbsp;<TT></TT>

<P><TT>&nbsp;&nbsp;&nbsp; I'm new into this PERL stuff and</TT>
<BR><TT>I would like to know if anyone can give</TT>
<BR><TT>me a hand. Does anyone knows of the</TT>
<BR><TT>existence of any Tutorials, FAQs and other</TT>
<BR><TT>stuff on the Web concerning PERL that might</TT>
<BR><TT>interest.</TT><TT></TT>

<P><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Thanx in advance,</TT><TT></TT>

<P><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Vitor Varalonga</TT></HTML>

--------------66AEF720DF6B5B6E497CFEC1--



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

Date: Tue, 05 May 1998 14:09:42 -0400
From: Brian Mathis <brianm@kodak.com>
To: vpedrosa@ccg.uc.pt
Subject: Re: HELP: PERL Tutorial...
Message-Id: <354F55E6.C45B7E80@kodak.com>

Vitor Varalonga wrote:
> 
>     Greetings!!!
> 
> 
>     I'm new into this PERL stuff and
> I would like to know if anyone can give
> me a hand. Does anyone knows of the
> existence of any Tutorials, FAQs and other
> stuff on the Web concerning PERL that might
> interest.
> 
>                     Thanx in advance,
> 
>                      Vitor Varalonga

[emailed and posted]

Yes.  You should start at www.perl.com.  There is loads of information,
FAQs, etc.  If you have already installed perl, you also have much of
this information on your local machine.  You can use 'perldoc perl' to
find a starting point (on UNIX).

Brian Mathis


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

Date: 5 May 1998 14:01:30 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: How to delete an element in an array?
Message-Id: <6ink5q$k5u$1@monet.op.net>
Keywords: euphoric Klux ripen upper

In article <354F3CD1.18FC648@cbmi.upmc.edu>,
Rich Tsui  <tsui@cbmi.upmc.edu> wrote:
>For example, I have an array @foo=('Jan', 'Feb', 'Dec', 'Bar', 'Mar') and I
>would
>like to delete item 'Bar' in array @foo without knowing the index of the item
>'Bar'.
>
>Any suggestion?

You should be using a hash instead.  

	%foo = map {($_ => 1)}  @foo;

	# Now forget about @foo, and never use it again.
	undef @foo;

	$foo{new_item} = 1;   # Insert new item into list
	delete $foo{Bar};     # Delete item from list

	foreach $item (keys %foo) {
	  # Do something for each item in the list
	}



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

Date: 5 May 1998 18:07:55 GMT
From: dpj@ddt.occ.uc.edu (Dane Jackson)
Subject: Re: How to make a "Please wait" page during script processing?
Message-Id: <6inkhr$ma0$1@malgudi.oar.net>

	I think I know what you want, www.highway61.com does
something similair while you're waiting for your searches. i.e.
writes out amusing quotes.  I believe you have to use nph (non parsed
headers).  This is basically when you tell the your webserver not to 
do anything for you, letting you handle everything.  I never got around
to seriously researching this but it but I do remember it was moderately
painful/hazardous.

and of course the obligatory

 "This is not a perl question this is a CGI question"

	I hope this was enough info to set you on the right track.

Joshua Lippiner (jlippiner@iname.com) wrote:
: I just wrote some perl scripts which take a bit of time to process after
: they read in form data.  I would like my URL to either change to say "Please
: wait, Processing..." and then bring up the finished URL after processing or
: have some kind of JavaScript window pop up that says the same, maybe with
: some moving dots.  What is the best way to do this?  Thanks.

-- 
Dane Jackson - zuvembi@mindless.com
Murphy's Laws of Computing #7
"He who laughs last probably made a back-up"


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

Date: 5 May 1998 14:16:04 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: I/O to serial device
Message-Id: <6inl14$kbk$1@monet.op.net>
Keywords: granular handmaiden hurty Suzuki


In article <354E33CB.867E5BD2@crrel.usace.army.mil>,
Gary Trachier  <trachier@crrel.usace.army.mil> wrote:
> open (MODEM, "<+ $modem") || die ("Can't open $modem."); 

Try it this way:

  open (MODEM, "<+ $modem") 
    || die ("Can't open $modem: $!; aborting"); 

That $! is magical.



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

Date: Tue, 05 May 1998 14:42:02 +0000
From: John Call <johnc@interactive.ibm.com>
Subject: implemented by XS functions really faster?
Message-Id: <354F2531.80A0FF00@interactive.ibm.com>

I was browsing through a readme file and it said that this particular
code "is implemented by XS functions.  This makes it about 20 times
faster than the old implementation as pure Perl."

Is this an accurate statement? If so why is it so much faster and why
isn't more code written that uses the XS implementation?

Just curious.

--

John Call




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

Date: Tue, 05 May 1998 19:48:50 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: MICHAEL KOGAN <michealj@bellsouth.net>
Subject: Re: Interactive Chem Test
Message-Id: <Pine.GSO.3.96.980505124802.13101I-100000@user2.teleport.com>

On Mon, 4 May 1998, MICHAEL KOGAN wrote:

> I'm look for a template that I can enter questions into and have
> students practice their chemistry homework.

Look in comp.lang.perl.modules for a recent discussion of a module under
development for doing Question-and-Answer stuff. Hope this helps!

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



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

Date: 5 May 1998 16:56:24 GMT
From: ehood@medusa.acs.uci.edu (Earl Hood)
Subject: Re: Is this a safe lock?
Message-Id: <6ingbo$dmc@news.service.uci.edu>

	[mail & posted]
In article <354E848B.ED3F30ED@comcore.com>,
Keith Vertrees  <keith@comcore.com> wrote:

>It creates a file called LOCK, with only owner
>write permission set, that locks my entire database.  Until someone else
>can create the file (i.e. I've deleted it) they will be blocked. 
>Everyone must call this same glock routine to create the LOCK file
>(unless they cheat).

>sub glock {
>  my ($lockfile,$oldumask);
>  local *LOCK;
>  $lockfile = $ENV{LOCK_PATH} . "/LOCK";
>  if (-o $lockfile) {
>    unlink($lockfile);

Why are you deleting the file?  Sort of defeats the purpose of a lock
if another process with same euid is writing to the database.

>  }
>  $oldumask = umask;
>  umask(022);
>  sleep(3) while (!open(LOCK,"> " . $lockfile));
>  print LOCK `date`;
>  umask($oldumask);
>  close (LOCK);

Will not work.

>}

Did you bother testing your code?  Testing is much better than
taking someone's word.

BTW, the umask thing will not work.  You will need a umask of 0777.
However, this will not work on non-Unix platforms.

If you want a locking mechanism that does not use flock, use a
directory as your lock file.  No umask to worry about, since you cannot
overwrite an existing directory, regardless of your uid.  It will work
on all(?) operating systems.

Note, the problem with open() is not that it is not atomic, the problem
is you cannot tell Perl to not create a file if it already exists, like
the C open(2) system call.  You can use sysopen() to get the
functionality of the open(2) system call.  Note, sysopen() may not have
all the same possible modes on all systems (system dependent).  Under
Unix, you can use O_EXCL and O_CREAT.  Unsure how sysopen() will work
under non-Unix systems.

	--ewh
-- 
             Earl Hood              | University of California: Irvine
      ehood@medusa.acs.uci.edu      |      Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME


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

Date: Tue, 05 May 1998 14:56:58 -0400
From: "James O. Payne, Jr." <jpayne@us.oracle.com>
Subject: Looking for Perl parser for 'C' language input files
Message-Id: <354F60FA.6F7F@us.oracle.com>

Hello.

I have a requirement to write a utility to do some not-so-simple
search, modify, and replace type work on a large base of 'C' code.
This work is to change some 'C' code written by third-party programmers
into a format consistent with my company's proprietary 'C' standards.

I wish to avoid lex and yacc due to the additional complexities that
writing this utility in 'C' will add to my task.  I know that I can
call 'C' routines from Perl but I am looking at that as an unattractive
scenario also.

Does anyone know of a 'C'-language parser for Perl?  Has anyone
done anything like this before?  I would appreciate any suggestions,
advice, or pointers to resources that anyone may have to offer.

Thanks in advance...

James Payne
jpayne@us.oracle.com
Oracle Process Manufacturing


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

Date: Tue, 05 May 1998 19:04:50 +0100
From: Caroline Hadley <hadley@globin.bio.warwick.ac.uk>
Subject: Re: need help with hashtable size/memory
Message-Id: <354F54C2.34F4E276@globin.bio.warwick.ac.uk>

Mark-Jason Dominus wrote:

> >I'm trying to incorporate the Tie::SubstrHash module, but so far
> >haven't managed to get it to work.
> 
> That will probably make the problem worse, not better.

why????


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

Date: Tue, 05 May 1998 19:57:25 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Bob Trieger <sowmaster@juicepigs.com>
Subject: Re: Personal Web Server
Message-Id: <Pine.GSO.3.96.980505125327.13101J-100000@user2.teleport.com>

On Mon, 4 May 1998, Bob Trieger wrote:

>  Use CGI.pm and you won't have this problem.
> 
> Or if you must use that ancient crap, try putting it in your cgi-bin
> directory.

You can try that, but it's not guaranteed to help. The CGI spec (as I
understand it) doesn't guarantee that the current directory will be the
cgi-bin directory, so a script which relies upon that is unreliable. In
general, you should put your modules and libraries in a fully-qualified
directory which is either listed in @INC or in a 'use lib' declaration.
Hope this helps!

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



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

Date: 05 May 1998 11:42:21 -0700
From: d3h486@emsl.pnl.gov (John L. Daschbach)
Subject: pod2texinfo?
Message-Id: <m3ra28r242.fsf@wd19518.emsl.pnl.gov>


I've searched a few of the pages AltaVista returns when I search on
'pod2texinfo' but when I search these pages I don't find a mention of
such a beast.  Does anybody know of one?  Also, or alternatively is
there an elisp pod viewer?

Thanks.

-John


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

Date: 5 May 1998 13:13:22 -0600
From: bgeer@xmission.xmission.com (bgeer)
Subject: Re: problem reading DB_File on win32 platform
Message-Id: <6inoci$dvu$1@xmission.xmission.com>

A couple of corrections:

jtaylor@ala.net (Jason Taylor) writes:

 >I'm not a 100% sure on this, but Unix starts newlines with the newline
 >(/n) character ...

Actually, Unix editors I've used END lines with a newline character,
aka:
	linefeed
	"\n"  (in character strings)
	0x0a  (hexadecimal)
	10    (decimal)
	012   (octal)

Of course, a trivial line may contain only a newline, leading one to
think it is actually the start o' the next line rather then end o' the
previous line.

I became pedantic about this because back in the olden days the last
line of print would disappear if the config'd delimiter (newline only
if auto-CR was set or CR plus newline).  Some printers wouldn't force
the last line to print when a formfeed was sent.

 >... and NT uses the linefeed-carriage return pair. This may
 >be the source of your problem.

Actually, every ascii text file (not a WordPerfect, Word, etc. file)
I've done in MSDOG/Windoze ends lines with carriage return then
linefeed characters, aka:

	return	newline
	"\r"	"\n"  (in character strings)
	0x0d	0x0a  (hexadecimal)
	13	10    (decimal)
	015	012   (octal)

-- 
<> Robert Geer & Donna Tomky /              *             <>
<>    bgeer@xmission.com    |    _o      *   o *      o   <>
<>   Salt Lake City, Utah   |   -\<,      * <\      </L   <>
<>          U S A           |   O/ O     __ /__,    />    <>


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

Date: 5 May 98 17:26:33 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: Question on sorting
Message-Id: <slrn6ks301.eq.sitaram@ltusitaram.unidata.com>

On Mon, 27 Apr 1998 10:28:35 -0400, Brad Baxter <bmb@ginger.libs.uga.edu> wrote:

[snip]

>+5  print "$one::$two::$tre\n";

[snip]

>The answer is to change line five to:
>
>print $one, '::', $two, '::', $tre, "\n";

  print "$one\::$two\::$tre\n";

is prolly easier, at least to fix.


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

Date: Tue, 05 May 1998 15:08:52 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Remove newline
Message-Id: <354F63C4.DA989D18@matrox.com>

What about chop()???

Craig Berry wrote:

> Robert C. Rogers (agator@imaxx.net) wrote:
> : I am trying to replace "|\n" with just "|", effectively removing
> : the newline for those lines that end with a "|".  The code that
> : I am attempting to use is as follows:
> :
> : #!/usr/bin/perl
>
> No -w ?  Almost always a good idea to use it.
>
> : while (<STDIN>){
> :    $tmp = <STDIN>;
>
> Do you realize you're ignoring all the even-numbered lines (0, 2, 4,
> etc.)?  The <STDIN> in the while conditional reads a line into $_; the
> first line in the block then immediately reads the following line into
> $tmp.  Almost certainly not what you want to do.
>
> :    $tmp =~ s/\|\n/\|/g;
>
> No need to escape | on the replacement side, and the 'g' option is
> meaningless given that reading line-by-line will cause at most one of
> your search pattern to exist.
>
> :    print $tmp;
> : }
> :
> : 'taint working.  What gives?  Thanks in advance.
>
> Here's how I'd do it, if the file were very large:
>
>   while (<STDIN>) {
>     s/\|\n/|/;
>     print;
>   }
>
> ...and if the file were fairly small:
>
>   undef $/;
>   $file = <STDIN>;
>   $file =~ s/\|\n/|/g;
>   print $file;
>
> HTH!
>
> ---------------------------------------------------------------------
>    |   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."



--
Ala Qumsieh             | "How much wood would a woodchuck
ASIC Design Engineer    |  chuck if a woodchuck could
Matrox Graphics Inc.    |  chuck wood?"
Montreal, Quebec        |             - Trivial ... 5!





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

Date: Tue, 05 May 1998 13:57:38 -0400
From: Bob Trieger <sowmaster@juicepigs.com>
To: michael@datahost.com
Subject: Re: Rounding a number
Message-Id: <354F5312.45C@juicepigs.com>

[mailed & posted]

Michael Stearns wrote:
> 
> I looked in the perlfunc man page and did not see a function for
> rounding a number. Is there such a beast or could someone tell me a good
> way to round a number with Perl?

This has been discussed quite a few times on c.l.p.m go to
http://www.dejanews.com and search for:

	~g comp.lang.perl.misc and rounding

It's also in the FAQs: "Does perl have a rounding function?"

HTH
-- 
Bob Trieger               |  Titanic: big boat, bigger
sowmaster@juicepigs.com   |           iceberg, big deal


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

Date: Tue, 05 May 1998 15:04:46 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Service Name with white space
Message-Id: <354F62CD.81D3243A@matrox.com>

Amit Shah wrote:

> When I try to refer to a service having white space(s) in the name of the
> service
> perl ( version 5.003_07 ) script fails to execute with this message.
>
>         No such file or directory at Q:\USERS\ASHAH\service_mode.plx line ##.
>

Sounds like your script can not find a specific file!

> Here is my code, the first part of which is just a copy from example from
> help,
> the second part is where I added my code and having problem with.
>
> I can NOT change the name of service, so if you have anything else for me
> to try,
> I will really appreciate that.
>
> Thanks much,
>
> -Amit
> ashah@videoserver.com
>
> ################# code
>
> ## Working part follows
>   use Win32::Service;
>         print "\tStatus of DHCP client service\n";
>         Win32::Service::GetStatus("", "DHCP", \%status) || die $!;
>         foreach $key (keys %status)
>         {
>             print $key, '=', $status{$key}, "\n";
>         }
>
> ## NOT working part follows
>
>         print "\tStatus of Conference Controller service\n";
>         Win32::Service::GetStatus("", "Conference Controller",\%status) ||
> die $!;

Aha ... there it is. Your GetStatus fails and the die is executed. Check the
syntax for GetStatus().

>         foreach $key (keys %status)
>         {
>             print $key, '=', $status{$key}, "\n";
>         }



--
Ala Qumsieh             | "How much wood would a woodchuck
ASIC Design Engineer    |  chuck if a woodchuck could
Matrox Graphics Inc.    |  chuck wood?"
Montreal, Quebec        |             - Trivial ... 5!





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

Date: Tue, 05 May 1998 18:33:03 GMT
From: henlif@elsfl.com (Henry Lifton)
Subject: Split problem Form
Message-Id: <6im1e8$rqe$1@supernews.com>



I have a form that has a select multiple statement in it that is used in a 
search engine to select a city or cities.  The variable is $scity.  I split it 
on the ' '

This is fine EXCEPT that a number of the cities are made up of 2 words or 
more.  

Some of the cities are:

Deerfield Beach
Pompano Beach
Highland Beach

Ft. Lauderdale
N. Lauderdale
Lauderdale Lakes

So the code is this 


{       $ciok=1; $_=$scity;
                if(length($scity) && (!/any/)) {
                        $ciok=0; $_=$bcity;
                        foreach $wantcity (split(' ',$scity)) {
                                 if(/$wantcity/){ $ciok=1;}
                        }
                }


When you search for only one of the cities that have 2 words, you get all of 
the cities that share the word.

It seems to be spliting them on each space instead of the space between the 
each form entry

Has anyone a solution to this?

Thanks

Henry Lifton
henlif@elsfl.com


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

Date: 5 May 1998 14:05:27 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: stat function
Message-Id: <6inkd7$k6n$1@monet.op.net>
Keywords: Dostoevsky Reinhold technician terrible


In article <354efd29.0@tmsserv4.tmsnet.co.uk>,
Mark Austin <mark@tmsnet.co.uk> wrote:
>however, it only works on particular files.


What happens on the files it `doesn't work' for?
Does your computer explode?


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

Date: Tue, 05 May 1998 19:30:41 GMT
From: edwardj@torvalds.keepthespamthanks.com (Ed Jamison)
Subject: Torvalds.com -- New development.
Message-Id: <MPG.fb9247d346415719896d9@news.ais.net>

Actually, I've changed my mind about this Torvalds.com thing.  I have 
decided not to sell it.  I've decided to put together a composite 
resource site for just about anything.  I've currently got 10 megs to 
work with, and I haven't bothered to put anything together for it, as the 
project I initially set it up for kind of sunk.  I am looking at setting 
it up as a script archive, programming tutorial, linux support, movie 
review, music instruction, literature review, and Monty Python joke 
archive.  If anyone has anything that they would like to see added to or 
done with this 10 megs, let me know.  I'm not going to set up anon access 
or anything, everything has to go through me, and be approved by me, but 
I'd be happy to put just about anything up there, as it's paid for and 
not being used.  Send your ideas and your stuff.

Thanks,
Ed Jamison


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

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


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 2506
**************************************

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