[15982] in Perl-Users-Digest
Perl-Users Digest, Issue: 3394 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 16 18:05:38 2000
Date: Fri, 16 Jun 2000 15:05:24 -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: <961193123-v9-i3394@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 16 Jun 2000 Volume: 9 Number: 3394
Today's topics:
Re: A Computer Programmers Profile <russ_jones@rac.ray.com>
Re: Bot for this group to auto-answer queries? lvirden@cas.org
Re: bug with arrays? <lr@hpl.hp.com>
Re: bug with arrays? (Bart Lateur)
Re: bug with arrays? <iltzu@sci.invalid>
Re: can't get CGI.pm to autoEscape ? (Neil Kandalgaonkar)
Re: can't get CGI.pm to autoEscape ? <flavell@mail.cern.ch>
Re: concerned about flock() (Bart Lateur)
Re: concerned about flock() (Clinton A. Pierce)
Convert::UU::uuencode gives short file error <tlung@greedo.partnersweb.com>
Re: Crazy enough that it might just work... (David H. Adler)
Re: creating and opening a file <aakbari@crosskeys.com>
Re: creating and opening a file <tina@streetmail.com>
Re: creating and opening a file (Jerome O'Neil)
Re: creating and opening a file <tina@streetmail.com>
Re: curious databse of webhosting like geocities <antonio_gonzalez@wap3.net>
Re: dbm's and associative arrays <rootbeer@redcat.com>
do i need flock()? <kevinllim@usa.net>
Re: do i need flock()? <kevinllim@usa.net>
embedding Java and Java script in Perl <michalak@hwr.arizona.edu>
Re: End delimiter line (Tad McClellan)
Re: filled in fields <lr@hpl.hp.com>
Re: First day with Perl (Bart Lateur)
Re: flock() and blocking lock? <rootbeer@redcat.com>
Re: Getting an absolute path from a (potentially) relat <Wayne.Plummer@isltd.insignia.com>
help: how to let it go <yluo@ececs.uc.edu>
Re: help: how to let it go <care227@attglobal.net>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 16 Jun 2000 14:20:02 -0500
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: A Computer Programmers Profile
Message-Id: <394A7DE2.4D6B9D90@rac.ray.com>
Larry Rosler wrote:
>
> Drew Simonis wrote:
> > Ferk Da Jerk wrote:
> > > children are more stronger than the adults.
> > ^^^^^^^^^^^^^
> > And oh the grammer!
>
> Is that Kelsey Grammer or English grammar?
>
Poor grammar is one thing up with which we must not put.
- Winston Churchill
--
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: 16 Jun 2000 19:14:54 GMT
From: lvirden@cas.org
Subject: Re: Bot for this group to auto-answer queries?
Message-Id: <8idube$995$1@srv38.cas.org>
According to Henry <henry@penninkilampi.net>:
:They work on IRC, and they work with data mining. Agents (call them
:bots, spiders, or whatever you want) are the easiest way to get the
:information you want. People use them.
Can you point to some truly useful agents and bots? I regret to say
that in my limited experience on internet (about 60 hrs a week for 10-12 yrs)
I don't recall encountering any of these - or if I did encounter one,
it was so cleverly written that I mistook it for a human.
I have encountered a lot of non-useful agents and bots - ones which tell
me to try things that I reported in my original msg I had already tried,
etc.
--
<URL: https://secure.paypal.com/refer/pal=lvirden%40yahoo.com>
<URL: mailto:lvirden@cas.org> <URL: http://www.purl.org/NET/lvirden/>
Unless explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.
------------------------------
Date: Fri, 16 Jun 2000 11:01:37 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: bug with arrays?
Message-Id: <MPG.13b40b59c1619a5798ab8d@nntp.hpl.hp.com>
In article <8idn9k$38n$1@engnews3.Eng.Sun.COM> on 16 Jun 2000 17:14:28
GMT, Joe Petolino <petolino@Eng.Sun.COM> says...
> petolino@Eng.Sun.COM (Joe Petolino) said:
...
> Luckily in Perl TMTOWTDI, and the most natural way to do name translations
> is with a hash. Here's a solution that should make us all happy:
>
> @month_name{1..12} = qw(jan feb mar apr may jun jul aug sep oct nov dec);
It won't make me happy!
#!/usr/bin/perl -w
use strict;
my %month_name;
@month_name{1..12} =
qw(jan feb mar apr may jun jul aug sep oct nov dec);
my $today = '2000-06-16'; # ISO-8601 standard form
print 'This month is ', $month_name{substr $today, 5, 2}, "\n";
__END__
Output:
This month is Use of uninitialized value in print at ...
Oops. Better add 0 to that substr.
Clue: Hash keys are strings, not numbers, no matter how you write them.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 16 Jun 2000 19:50:04 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: bug with arrays?
Message-Id: <394b803b.1140462@news.skynet.be>
Aaron wrote:
>This one has got me stumped. The 10th index of an array is returning
>'0' zero instead of the value in it. here is my code:
>my @month=('',jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec);
...
Now this is dangerous. You're using barewords. This will only work if
Perl won't confuse the word with existing functions.
>When uncommented the line that prints the variables prints something
>like: 10, 8, 1999: 0
>whenever $m == 10. It works for every other month but 'oct'.
But, er,... "oct" IS a function.
Tip: use qw, like:
my @month=qw(* jan feb mar apr may jun jul aug sep oct nov dec);
--
Bart.
------------------------------
Date: 16 Jun 2000 20:17:53 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: bug with arrays?
Message-Id: <961185958.28733@itz.pp.sci.fi>
In article <MPG.13b40b59c1619a5798ab8d@nntp.hpl.hp.com>, Larry Rosler wrote:
>In article <8idn9k$38n$1@engnews3.Eng.Sun.COM> on 16 Jun 2000 17:14:28
>GMT, Joe Petolino <petolino@Eng.Sun.COM> says...
>>
>> @month_name{1..12} = qw(jan feb mar apr may jun jul aug sep oct nov dec);
>
[sample code referencing $month_name{'06'} snipped]
>
>Oops. Better add 0 to that substr.
..at which point you might as well subtract 1 from it instead. Catch-22.
In my opinion the fundamental misdesign causing all these problems
is thousands of years old. If our ancestors had been less bound by
tradition, or their ancestors more logically consistent, we'd all be
counting ordinals from zero and there'd be no problem..
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla and its pseudonyms - do not feed the troll.
------------------------------
Date: 16 Jun 2000 21:08:41 GMT
From: nj_kanda@alcor.concordia.ca (Neil Kandalgaonkar)
Subject: Re: can't get CGI.pm to autoEscape ?
Message-Id: <8ie50p$m1d$1@newsflash.concordia.ca>
In article <Pine.GHP.4.21.0006161155090.8722-100000@hpplus03.cern.ch>,
Alan J. Flavell <flavell@mail.cern.ch> wrote:
>>
>> ?a=1&b=2
>
>In the HREF? That's exactly what it _should_ be.
D'oh. After I posted the article I started wondering why HREFs should
be specially immune to escaping after all. I should have checked
the RFC's first.
I've encountered that problem of a browser recognizing an entity in
an URL before, e.g.
search.cgi?item=foo§=news
^^^^^
but since it was only IE that did it I had assumed it was
incorrect behaviour. :)
Suitably chastised,
--
Neil Kandalgaonkar
neil@brevity.org
------------------------------
Date: Fri, 16 Jun 2000 23:45:04 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: can't get CGI.pm to autoEscape ?
Message-Id: <Pine.GHP.4.21.0006162322520.24540-100000@hpplus03.cern.ch>
[apologies for the off-topic pontificating, but now the issue has
come up, I beg the group's indulgence to finish it off...]
On 16 Jun 2000, Neil Kandalgaonkar wrote:
> >> ?a=1&b=2
> >
> >In the HREF? That's exactly what it _should_ be.
>
> D'oh. After I posted the article I started wondering why HREFs should
> be specially immune to escaping after all. I should have checked
> the RFC's first.
It's a very widespread misunderstanding...
But ever since HTML2.0, there's been a recommendation to accept an
alternative delimiter (semicolon) in addition to the ampersand, in
order to side-step this oddity when simulating a form submission by
a hand-crafted URL. The recommendation is still there, in HTML4.0:
http://www.w3.org/TR/REC-html40/appendix/notes.html#h-B.2.2
and CGI.pm supports this convention too, although it used not
to generate that kind of URL by default (see the -newstyle_urls
Pragma).
-newstyle_urls became the default in a fairly recent version. I had
some email discussion with L.Stein about this a while back, as I had
the impression that the CGI.pm documentation and example for
self-referencing URLs was misleading. However, he pointed out (I'm
quoting loosely from memory) that the documentation had become OK as a
result of the adoption of -newstyle_urls (which in a practical sense
was true). Anyone who insisted on reverting to -oldstyle_urls would
have to look after themselves, however.
> I've encountered that problem of a browser recognizing an entity in
> an URL before, e.g.
>
> search.cgi?item=foo§=news
> ^^^^^
That indeed is the kind of risk I was discussing...
all the best
------------------------------
Date: Fri, 16 Jun 2000 19:50:02 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: concerned about flock()
Message-Id: <394a7f6c.932846@news.skynet.be>
Larry Rosler wrote:
>> Win9x is a single-user multi-tasking OS - the lack of flock on Win9x is
>> unfortunate, as it is needed where multiple tasks might conflict.
>
>But on Win9x one task cannot open a file that is already opened by
>another task, so there can be no conflict, so no need for file locking.
>In essence, the operating system imposes mandatory locking.
With one snag: if the file is locked (open by another program), the
"open" will fail. Programs are usually not designed to try again later,
if things like opening a file, fail.
--
Bart.
------------------------------
Date: Fri, 16 Jun 2000 20:29:28 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: concerned about flock()
Message-Id: <I6w25.2492$fR2.30571@news1.rdc1.mi.home.com>
[Posted and mailed]
In article <394a7f6c.932846@news.skynet.be>,
bart.lateur@skynet.be (Bart Lateur) writes:
> Larry Rosler wrote:
>>> Win9x is a single-user multi-tasking OS - the lack of flock on Win9x is
>>> unfortunate, as it is needed where multiple tasks might conflict.
>>
>>But on Win9x one task cannot open a file that is already opened by
>>another task, so there can be no conflict, so no need for file locking.
>>In essence, the operating system imposes mandatory locking.
>
> With one snag: if the file is locked (open by another program), the
> "open" will fail. Programs are usually not designed to try again later,
> if things like opening a file, fail.
Yes but the error message (You did print $!, didn't you?) will indicate
that the file is in use. This is a common Win9x error message and presumably
the user of this sad excuse for an operating system expects these, and knows
how to deal with them
--
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: Fri, 16 Jun 2000 20:42:01 GMT
From: tlung <tlung@greedo.partnersweb.com>
Subject: Convert::UU::uuencode gives short file error
Message-Id: <tiw25.47439$MK4.115979@quark.idirect.com>
When I use Convert::UU::uuencode to uuencode a file, the resulting file
appears to be not uuencoded properly. When I use the UNIX command line to
uudecode it, it gives a short file error.
I notice that when I use the UNIX command line uuencode to uuencode the
file, the output differs (diff) from that of Convert::UU::uuencode.
My source code is just copied from the Convert::UU perldoc. I have used
binmode, too. Does anybody have any tips? Thanks.
------------------------------
Date: 16 Jun 2000 19:06:06 GMT
From: dha@panix.com (David H. Adler)
Subject: Re: Crazy enough that it might just work...
Message-Id: <slrn8kkuku.s5k.dha@panix6.panix.com>
On Fri, 16 Jun 2000 09:56:49 +0930, Henry <henry@penninkilampi.net> wrote:
>In article <8ibp7k$dgt$1@news.NERO.NET>, stanley@skyking.OCE.ORST.EDU
>(John Stanley) wrote:
>
>>> We could, for example, reject the first post attempt _outright_
>>
>> Who is the "we" who is rejecting this post?
>
>Execution via script. Parameters determined by group consensus.
>
>i.e. "we".
Hmm... In that case, "we" seem not to like this idea. The only posts
I see that are in favor of your proposal are yours. That's certainly
not intended as a slam at you, but "group concensus", as you say,
seems to be against it.
best,
dha
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"I didn't say I'd never slay another vampire. It's not like I have
fluffy bunny feelings about them. I'm just not going to get too
extra-curricular about it."
- Buffy
------------------------------
Date: Fri, 16 Jun 2000 14:45:17 -0400
From: Afshin Akbari <aakbari@crosskeys.com>
Subject: Re: creating and opening a file
Message-Id: <394A75BD.1F802591@crosskeys.com>
Hi,
Try this at your own risk. It works for me.
open (FH, ">> /tmp/messageFile");
print FH ("Dear User,\n\n");
print FH ("All the following views .................\n");
use ">>" if you are going to append to it.
use ">" if you are going to over write it each time.
A.A.
Tyler Robert Wood wrote:
> Hello,
>
> For some reason, I'm having trouble creating and opening a file.
> The code looks like this:
>
> $filename = $highest.".txt";
> open (FILE, $filename) || print "Can't open the file";
> print FILE $message;
> close (FILE);
>
> The file is never created or opened.
> I bet it's something simple I'm missing,
> any ideas?
>
> Thanks in advance,
>
> Tyler Wood
> twood@uwm.edu
------------------------------
Date: 16 Jun 2000 19:51:13 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: creating and opening a file
Message-Id: <8ie0fh$4mbdj$1@fu-berlin.de>
hi,
Jerome O'Neil <jerome@activeindexing.com> wrote:
> Tina Mueller <tina@streetmail.com> elucidates:
>>> open FILE, "> $filename" or die "cannot open $filename: $!\n";
>>
>> open FILE, "> $filename" or die "cannot open $filename: $!";
>>
>> better to leave that newline out:
> Better for who? If I'm managing my error messages, even unto death,
> perhaps I don't want a line number.
better for most of the programmers, especially starters.
and if i hava a large perlscript, i am glad about that
line number. if you don't need it, ok, but try to
write code so that starters can learn from it.
how many people are out there who really *don't* want
a line number in the errormessage? everybody
else can leave that newline out because die()
provides one for you.
tina
--
http://tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
------------------------------
Date: Fri, 16 Jun 2000 20:05:46 GMT
From: jerome@activeindexing.com (Jerome O'Neil)
Subject: Re: creating and opening a file
Message-Id: <uMv25.566$uE5.5821@news.uswest.net>
Tina Mueller <tina@streetmail.com> elucidates:
> hi,
>
> Jerome O'Neil <jerome@activeindexing.com> wrote:
>> Tina Mueller <tina@streetmail.com> elucidates:
>
>>>> open FILE, "> $filename" or die "cannot open $filename: $!\n";
>>>
>>> open FILE, "> $filename" or die "cannot open $filename: $!";
>>>
>>> better to leave that newline out:
>
>> Better for who? If I'm managing my error messages, even unto death,
>> perhaps I don't want a line number.
>
> better for most of the programmers, especially starters.
If you are the spokesperson for The Society of Most Programmers, Especialy
New Ones, you should just say so.
As it stands, you don't speak for anyone but you.
> and if i hava a large perlscript, i am glad about that
> line number.
What about most of those programmers?
> if you don't need it, ok,
I use features that help me solve a problem. If printing
the line number helps, then I do it. If it confuses the
user, then I don't.
> but try to write code so that starters can learn from it.
The one thing starters need to know more than anything else
is that the appropriate tool for the job should always be used,
and each job is different.
I'll give you a hint. It behaves that way for a reason.
You have no idea whether or not a program's death should
indicate a line number or not, unless you are the author.
> how many people are out there who really *don't* want
> a line number in the errormessage?
Don't you speak for most programmers?
> everybody else can leave that newline out because die()
> provides one for you.
It also doesn't provide one for you. Everybody else can use
that feature to suit their needs.
------------------------------
Date: 16 Jun 2000 20:14:37 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: creating and opening a file
Message-Id: <8ie1rc$4mbdj$4@fu-berlin.de>
hi,
Jerome O'Neil <jerome@activeindexing.com> wrote:
> Tina Mueller <tina@streetmail.com> elucidates:
>>
>> Jerome O'Neil <jerome@activeindexing.com> wrote:
>>> Tina Mueller <tina@streetmail.com> elucidates:
>>
>>>>> open FILE, "> $filename" or die "cannot open $filename: $!\n";
>>>>
>>>> open FILE, "> $filename" or die "cannot open $filename: $!";
>>>>
>>>> better to leave that newline out:
>>
>>> Better for who? If I'm managing my error messages, even unto death,
>>> perhaps I don't want a line number.
>>
>> better for most of the programmers, especially starters.
> If you are the spokesperson for The Society of Most Programmers, Especialy
> New Ones, you should just say so.
hey, don't start a thread for that problem...
i said also:
perldoc -f die
so everybody can make his/her own decision.
tina
--
http://tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
------------------------------
Date: Fri, 16 Jun 2000 19:40:15 GMT
From: Antonio Gonzalez <antonio_gonzalez@wap3.net>
Subject: Re: curious databse of webhosting like geocities
Message-Id: <PnrMNnd2dnpXgMTL=Mwxl86T0oom@4ax.com>
The best, of course, is MySQL running on Red Hat 6.1+
On Thu, 15 Jun 2000 16:13:13 GMT, "Daniel van den Oord"
<danielxx@bart.nl> wrote:
>I'm curious what kind of database geocities uses to store the info of their
>users
>I know they are using CGI scripts for form proccesing but if they are using
>ODBC or SQL or whatever I don't know. Does anybody have some more
>information.. If not what would be the best database to maintain when
>frequently used and getting kinda huge ?!? at the moment I'm working with
------------------------------
Date: Fri, 16 Jun 2000 14:44:57 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: dbm's and associative arrays
Message-Id: <Pine.GSO.4.10.10006161438100.21108-100000@user2.teleport.com>
On Fri, 16 Jun 2000, Robin Senior wrote:
> dbmopen(%ALLRECORDS, 'MYDBM', 0777);
Just as with any other open-typ call, even if your code is "just an
example", you should check the return value from dbmopen.
> $ALLRECORDS{allkey1} = {%aa1};
> It prints:
> ALLRECORDS content:HASH(0x8762208)
Yes, that's the string (not a reference!) stored in the file.
> Can this be done, or have I made a syntax error?
It can't be done as you're trying. But there are several modules which can
help you to convert data into strings and back again. FreezeThaw and
Data::Dumper come to mind.
http://search.cpan.org/search?dist=FreezeThaw
http://search.cpan.org/doc/GSAR/perl-5.6.0/ext/Data/Dumper/Dumper.pm
Beware that some such strings may well exceed the storage capacity of a
single record of the DBM file. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 16 Jun 2000 16:13:22 -0400
From: "Kevin Lim" <kevinllim@usa.net>
Subject: do i need flock()?
Message-Id: <8ie1r3$kmv$1@news.chatlink.com>
I am writing a simple appointment book script that will be accessed by many
people at once.
i need to prevent more than one user from making an appointment for
different clients in the same time slot.
i am confused by what I have read about flock(), is this a system command or
part of perl? do i have to use linux to use flock()?
i would like to continue to use xitami server on win2000 because this is
easy for me, but if I need to i will setup linux and apache and learn it.
this project is simple enough I think i can use plain text files for the
database, but if i use something like mSQL would that eliminate the file
locking issue, ie does mSQL handle the locking of the database files so I
wouldn't have to worry about it?
thank you
------------------------------
Date: Fri, 16 Jun 2000 17:48:33 -0400
From: "Kevin Lim" <kevinllim@usa.net>
Subject: Re: do i need flock()?
Message-Id: <8ie7dm$npo$1@news.chatlink.com>
this http://webreview.com/pub/98/10/16/perl/index.html mostly answered my
question, but does
"Also, file locking does not work the same as on a Unix system. On non-NT
systems (ie Windows 95/98), file locking is not supported. On Windows NT
systems, file locking is supported. But, NT locks files strangely so if you
are doing a copy or rename on a file in NT, you need to make sure that you
close the file before you execute the commands. Otherwise, the command will
fail."
this mean i'm ok using flock if i immediately close my files? i don't
anticipate copying or renaming files inside my perl script
thank you
"Kevin Lim" <kevinllim@usa.net> wrote in message
news:8ie1r3$kmv$1@news.chatlink.com...
> I am writing a simple appointment book script that will be accessed by
many
> people at once.
> i need to prevent more than one user from making an appointment for
> different clients in the same time slot.
>
> i am confused by what I have read about flock(), is this a system command
or
> part of perl? do i have to use linux to use flock()?
>
> i would like to continue to use xitami server on win2000 because this is
> easy for me, but if I need to i will setup linux and apache and learn it.
>
> this project is simple enough I think i can use plain text files for the
> database, but if i use something like mSQL would that eliminate the file
> locking issue, ie does mSQL handle the locking of the database files so I
> wouldn't have to worry about it?
>
> thank you
>
>
------------------------------
Date: Fri, 16 Jun 2000 14:03:43 -0700
From: Zolla Michalak <michalak@hwr.arizona.edu>
Subject: embedding Java and Java script in Perl
Message-Id: <394A962F.A4D664AC@hwr.arizona.edu>
I have an HTML page with embedded Java and Javascript, and I would like
to embed the whole thing in a Perl script. Actually, I did this, by
putting the whole thing in a print statement, and it works, except that
it can't read the java. So, I'm wondering if I need to use Java.pm or
something else to make this work. Any ideas?????
Thanks -zolla michalak
------------------------------
Date: Fri, 16 Jun 2000 09:02:41 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: End delimiter line
Message-Id: <slrn8kk9bh.8kp.tadmc@magna.metronet.com>
On Fri, 16 Jun 2000 09:22:50 +0200, Jean-Pascal Laux <jplaux@easynet.fr> wrote:
>I want to write text lines in a file using print fonction but I also
>want that the en delimiter is line-feed (with no CR).
Why do you want that?
If you want to run your program on Windows and use its output
on Unix, you can use FTP "ASCII" mode to translate line endings.
>How to do it ?
print "line\n";
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 16 Jun 2000 11:18:18 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: filled in fields
Message-Id: <MPG.13b40f448485c8a198ab8e@nntp.hpl.hp.com>
[Rearranged and trimmed for logical flow and relevance.]
In article <394A15D2.74215393@lycosmail.com> on Fri, 16 Jun 2000
13:56:02 +0200, Johannes <gedichte@lycosmail.com> says...
> Simon Christie wrote:
>
> > I have a form that goes to a cgi script to email me
> > how can i check that a field has been filled in?
...
> use CGI(param);
> foreach (param) {
> if (! defined param($_)) {
> ... # the field $_ was not filled in
> }
> }
That isn't quite good enough. If the unfilled field is a textfield on
the form that was submitted, CGI.pm will pass the parameter on as a null
string. So a complete test would be:
unless (defined param($_) and length param($_)) {
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 16 Jun 2000 19:48:43 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: First day with Perl
Message-Id: <394c81c8.1537405@news.skynet.be>
STF wrote:
>Can i include Perl-code in HTML-files as easily as PHP-code?
>And how do i do that?
There are several template modules thatdo that. See CPAN
(<http://search.cpan.org/>). I think Text::Template does it, I'm not too
sure. If you have some control over the server, stuuf like ePerl and
EmbPerl could be worth checking out.
>What about executing PHP-commands from perl-code?
Er... why? PHP is not TOO different from Perl as a language, since PHP
was originally written in Perl. But the answer is "no", AFAIK.
>Problem is, i want to write some datas in a mysql database ... these
>datas are content of input fields of an html-file.
>
>How do i do this with perl?
You don't need PHP for that.
A quick web search turned up this page, which looks like what you're
looking for:
http://www.wcug.wwu.edu/sloth/userguide/mysql/perl.html
--
Bart.
------------------------------
Date: Fri, 16 Jun 2000 14:58:06 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: flock() and blocking lock?
Message-Id: <Pine.GSO.4.10.10006161456210.21108-100000@user2.teleport.com>
On Fri, 16 Jun 2000, Marc Haber wrote:
> Tom Phoenix <rootbeer@redcat.com> wrote:
> >On Fri, 16 Jun 2000, Marc Haber wrote:
> >> if( open FH, "< $FHNAME" )
> >> {
> >> print "trying to hget lock on $FHNAME\n";
> >> unless( flock( FH, LOCK_EX ) )
> >
> >On most systems I've seen, you can't get an exclusive lock if you don't
> >have write permission.
>
> My script runs with root privileges, and the file is located in a mode
> 777 directory.
I see I was unclear. On most systems I've seen, you can't get an exclusive
lock if you haven't opened the file with a mode which includes write
permission.
> >Try a shared lock if you're only reading. Cheers!
>
> Even with a shared lock, my flock() call doesn't block.
Make a small, stand-alone example program which demonstrates this. You may
have found a bug. Good luck with it!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 16 Jun 2000 10:24:17 +0100
From: "Wayne Plummer" <Wayne.Plummer@isltd.insignia.com>
Subject: Re: Getting an absolute path from a (potentially) relative one
Message-Id: <961147457.631834@proxy0.isltd.insignia.com>
Well to reply to my own post... I found that the File::Spec package should
do what I want (but not before I'd written my own anyway!).
Sadly, this seems:
A) to be a recent addition (so not all of the systems I am looking at have
the module as standard)
B) seems to be broken (at least in ActivePerl 5.6.0.613 where I'm testing
it).
The following script, xxx.pl:
#/usr/local/bin/perl -w
use Strict;
use File::Spec::Functions qw(rel2abs canonpath);
my $relPath = "..\\fred\\foo";
# my $relPath = "../fred/foo"; # My first try
my $absPath = canonpath (rel2abs($relPath));
# my $absPath = rel2abs($relPath); # My first try
print "Rel: $relPath Abs: $absPath\n";
When run thus on an X86, NT 4.0 box, displays:
D:\Users\wayne>perl xxx.pl
Rel: ..\fred\foo Abs: D:\Users\wayne\..\fred\foo
IMHO, the answer should definitely be D:\Users\fred\foo
I think I'll deploy the cheap and cheerful version I wrote myself!
Regards,
Wayne Plummer http://www.cix.co.uk/~plum/
(Consultant, Embedded Java VM Team, Insignia Solutions, High Wycombe)
Wayne Plummer <Wayne.Plummer@isltd.insignia.com> wrote in message
news:961063935.998687@proxy0.isltd.insignia.com...
> I want to get the absolute form of a pathname which *may* be relative to
my
> current working directory (or perhaps not) - this must work even of the
file
> identified by the input path does *not* exist (nor may any number of its
> parent directories) - and it must work portably over different filesystem
> types.
>
> &getAbsPath ("../../fred/foo")
>
> would return "/usr/wayne/fred/foo" if my CWD was "/usr/wayne/bert/harry"
> or 'C:\User\Wayne\fred\foo' if my CWD was 'C:\User\Wayne\thelma\louise'
>
> Anyone know if there's something that does what I want? I could write one
> myself, but this would be daft if there already was such a beast!
------------------------------
Date: Fri, 16 Jun 2000 17:09:31 -0400
From: Yongfeng Luo <yluo@ececs.uc.edu>
Subject: help: how to let it go
Message-Id: <394A978A.B73BF13F@ececs.uc.edu>
I have a perl file to be used in a web page. It works fine in shell. But
no resonpse when executing from browser. No any err message.
I am using a submit button to triger it and i am using linux 6.1+apache
I guess it do with the permission. but when i even change the mode of
directory and file to 777, it still does not work!
Your reply is appreciated.
------------------------------
Date: Fri, 16 Jun 2000 17:30:37 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: help: how to let it go
Message-Id: <394A9C7D.FC54ED71@attglobal.net>
Yongfeng Luo wrote:
>
>
> Your reply is appreciated.
Try this out in comp.infosystems.www.authoring.cgi
You'll get a much warmer reception. Followups set.
------------------------------
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 3394
**************************************