[16272] in Perl-Users-Digest
Perl-Users Digest, Issue: 3684 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jul 16 18:05:49 2000
Date: Sun, 16 Jul 2000 15:05:18 -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: <963785118-v9-i3684@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 16 Jul 2000 Volume: 9 Number: 3684
Today's topics:
[NEWBI] Reg Exp request for help <kloomis@bigplanet.com>
Re: [NEWBI] Reg Exp request for help <ecco64@chello.nl>
Re: [NEWBI] Reg Exp request for help <godzilla@stomp.stomp.tokyo>
Re: [NEWBI] Reg Exp request for help <joe.kline@sdrc.com>
Re: [NEWBI] Reg Exp request for help (Keith Calvert Ivey)
Re: Accessing string <bart.lateur@skynet.be>
Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!! <nospam@nospam.com>
CGI: How do I set/get cookies ? martho@my-deja.com
Re: clear query string <gellyfish@gellyfish.com>
Re: communicating through the location bar (Keith Calvert Ivey)
Re: communicating through the location bar <ecco64@chello.nl>
Re: communicating through the location bar <raphaelp@nr1webresource.com>
Re: communicating through the location bar <tony_curtis32@yahoo.com>
Difference between a .cgi file and a .pl file? <snakeman@kc.rr.com>
Re: Difference between a .cgi file and a .pl file? <joe.kline@sdrc.com>
Re: Difference between a .cgi file and a .pl file? fvision@my-deja.com
Re: Difference between a .cgi file and a .pl file? <bart.lateur@skynet.be>
easy: forms and frames <nospam@mistnet.com>
Re: flock nonsense ? (Tad McClellan)
Re: flock nonsense ? <jaws@mindspring.com>
Re: flock nonsense ? <jaws@mindspring.com>
Re: flock nonsense ? <bart.lateur@skynet.be>
Re: forms and frames <ecco64@chello.nl>
Re: Getting a random var as output (Tad McClellan)
Re: Getting a random var as output (Clinton A. Pierce)
Re: Getting a random var as output <ecco64@chello.nl>
Help - Installation problem ! <stefan.jonsson@chello.se>
Re: Help - Installation problem ! <nnickee@nnickee.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 16 Jul 2000 11:24:52 -0700
From: Ken Loomis <kloomis@bigplanet.com>
Subject: [NEWBI] Reg Exp request for help
Message-Id: <3971FDF6.8A4F77E0@bigplanet.com>
This is a multi-part message in MIME format.
--------------EFC9DE84C9CEDF61BC190116
Content-Type: text/plain; charset=us-ascii; x-mac-type="54455854"; x-mac-creator="4D4F5353"
Content-Transfer-Encoding: 7bit
I need to take a user's input and convert it to "Proper Case".
For example:
User Input -> Converts to
john doe -> John Doe
John Doe -> John Doe
JOHN DOE -> John Doe
j q public -> J Q Public
123 main st -> 123 Main St
houston -> Houston
I know this can be done in a regular expression, but those are so
confusing. I would appreciate any help with this.
Also, does anyone know of a book or online tutorial that does a great
job of explaining regular expressions?
Thanks,
Ken Loomis
kloomis@bigplanet.com
--------------EFC9DE84C9CEDF61BC190116
Content-Type: text/x-vcard; charset=us-ascii;
name="kloomis.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Ken Loomis
Content-Disposition: attachment;
filename="kloomis.vcf"
begin:vcard
n:Loomis;Ken
tel;pager:888-423-8493
tel;fax:603-299-4785
tel;work:619-232-6919
x-mozilla-html:TRUE
url:http://www.KenLoomis.com/
org:Loomis Technology Group
adr:;;302 Island Avenue, Suite 201;San Diego;CA;92101;USA
version:2.1
email;internet:kloomis@bigplanet.com
title:Director
x-mozilla-cpt:;3
fn:Ken Loomis
end:vcard
--------------EFC9DE84C9CEDF61BC190116--
------------------------------
Date: Sun, 16 Jul 2000 18:58:37 GMT
From: "Ecco" <ecco64@chello.nl>
Subject: Re: [NEWBI] Reg Exp request for help
Message-Id: <xBnc5.396573$k22.1751179@flipper>
Try www.useractive.com
--
-----------------------------------------------------
Click here for Free Video!!
http://www.gohip.com/free_video/
"Ken Loomis" <kloomis@bigplanet.com> wrote in message
news:3971FDF6.8A4F77E0@bigplanet.com...
> I need to take a user's input and convert it to "Proper Case".
>
> For example:
>
> User Input -> Converts to
>
> john doe -> John Doe
> John Doe -> John Doe
> JOHN DOE -> John Doe
> j q public -> J Q Public
>
> 123 main st -> 123 Main St
> houston -> Houston
>
> I know this can be done in a regular expression, but those are so
> confusing. I would appreciate any help with this.
>
> Also, does anyone know of a book or online tutorial that does a great
> job of explaining regular expressions?
>
> Thanks,
> Ken Loomis
> kloomis@bigplanet.com
>
>
>
------------------------------
Date: Sun, 16 Jul 2000 14:01:25 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: [NEWBI] Reg Exp request for help
Message-Id: <397222A5.87DA0528@stomp.stomp.tokyo>
Ken Loomis wrote:
> I need to take a user's input and convert it
> to "Proper Case".
> For example:
> User Input -> Converts to
> john doe -> John Doe
> John Doe -> John Doe
> JOHN DOE -> John Doe
> j q public -> J Q Public
> 123 main st -> 123 Main St
> houston -> Houston
> I know this can be done in a regular expression,
> but those are so confusing.
> I would appreciate any help with this.
Honestly and truly?
(snippage)
How about a nice Godzilla style schizo method?
For testing, @User_Input represents, guess?
Your user input!
First foreach prepends a space to your
user input line for a match. This is
needed because matching is based on
" space letter " style as you show.
Then all letters are lowercased.
Nested second foreach matches letters
at the beginning of each word, again
based on " space letter " matching.
Note each element in @Alpha_Up is a
space followed by a capital letter of
our English alphabet. This is where
each first letter is capitalized.
Pretty!
Last substitution line at the end of
the primary loop is to remove the
leading space prepended earlier for
a match.
All done!
Well... almost. There is another way of
doing this but it is not as much fun, sigh...
foreach $element (@User_Input)
{
$element = " $element";
$element =~ tr/A-Z/a-z/;
$element =~ s/ ([a-z])/ \u$1/g;
$element =~ s/ //;
}
Produces the same results, oh but is
this method ever so very boring...
Godzilla!
TEST SCRIPT:
____________
#!/usr/local/bin/perl
print "Content-Type: text/plain\n\n";
@User_Input = ("goDZilLA ROCKS!", "GOdziLLa roCks!",
"godzilla rocks!", "GODZILLA ROCKS!");
foreach $element (@User_Input)
{
print "Input: $element\n";
$element = " $element";
$element =~ tr/A-Z/a-z/;
(@Alpha_Up) = (" A", " B", " C", " D", " E", " F",
" G", " H", " I", " J", " K", " L",
" M", " N", " O", " P", " Q", " R",
" S", " T", " U", " V", " W", " X",
" Y", " Z");
foreach $au (@Alpha_Up)
{
if ($element =~ /($au)/i)
{ $element =~ s/$1/$au/g; }
}
$element =~ s/ //;
print "Output: $element\n\n";
}
exit;
PRINTED RESULTS:
________________
Input: goDZilLA ROCKS!
Output: Godzilla Rocks!
Input: GOdziLLa roCks!
Output: Godzilla Rocks!
Input: godzilla rocks!
Output: Godzilla Rocks!
Input: GODZILLA ROCKS!
Output: Godzilla Rocks!
------------------------------
Date: Sun, 16 Jul 2000 17:01:49 -0400
From: Joe Kline <joe.kline@sdrc.com>
To: kloomis@bigplanet.com
Subject: Re: [NEWBI] Reg Exp request for help
Message-Id: <397222BD.26B7F81A@sdrc.com>
[posted and mailed]
Ken Loomis wrote:
> I need to take a user's input and convert it to "Proper Case".
>
> For example:
>
> User Input -> Converts to
>
> john doe -> John Doe
> John Doe -> John Doe
> JOHN DOE -> John Doe
> j q public -> J Q Public
> <SNIP>
Give the following a whirl:
$line =~ s/(\w)(\w+)?/\u$1\L$2\E/g;
>
>
> Also, does anyone know of a book or online tutorial that does a great
> job of explaining regular expressions?
Go directly to perldoc, do not pass go, do not collect $200:
perldoc perlre
As for a book, the best is:
Mastering Regular Expressions: Powerful Techniques for Perl and Other
Tools (O'Reilly Nutshell) by Jeffrey E. Friedl
--
Joe Kline
It takes a lot of brains to enjoy satire, humor, and wit;
but none to be offended by them. ---The Midnight Skulker
------------------------------
Date: Sun, 16 Jul 2000 21:01:59 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: [NEWBI] Reg Exp request for help
Message-Id: <39741968.4065293@news.newsguy.com>
Avoid the words "newbie" and "help" in your subject lines --
you're more likely to get an answer if you stick to a
description of the problem. Also, check the FAQs to see if your
question is answered there before posting. You'll get the
answer much faster, and it will be more likely to be correct.
Ken Loomis <kloomis@bigplanet.com> wrote:
>john doe -> John Doe
>John Doe -> John Doe
>JOHN DOE -> John Doe
>j q public -> J Q Public
>123 main st -> 123 Main St
>houston -> Houston
>
>I know this can be done in a regular expression, but those are so
>confusing. I would appreciate any help with this.
Type "perdoc -q capitalize" at the command line, or look in
perlfaq4 in the documentation for the question "How do I
capitalize all the words on one line?" Note that you'll have to
give some thought to what you want to do about "John von
Neumann" and "JoAnn McDonald" (not to mention "brian d foy") --
it's not a totally soluble problem.
>Also, does anyone know of a book or online tutorial that does a great
>job of explaining regular expressions?
Look in perlre (part of the Perl documentation, which is on your
system if you've installed Perl properly). For more than you
probably want to know about regular expressions, see "Mastering
Regular Expressions" by Jeffrey E.F. Friedl (O'Reilly).
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
(Free at last from the forced spamsig of
Newsfeeds.com, cursed be their name)
------------------------------
Date: Sun, 16 Jul 2000 21:44:18 +0200
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Accessing string
Message-Id: <2p24ns89f5brk9r8n9nvrv4tao3l5vo9c6@4ax.com>
martho@my-deja.com wrote:
>Are there any possebilitys to access a string like in other
>script-languages with
>left
>right
>mid
substr, for all three
>length
Guess...
--
Bart.
------------------------------
Date: 16 Jul 2000 20:40:34 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!!
Message-Id: <8kt6k2$6p0$0@216.155.32.172>
In article <8kobd5$99v$1@nnrp1.deja.com>, p3rlc0dr@my-deja.com wrote:
| In article <8ko9th$6h6$0@216.155.32.162>,
| The WebDragon <mactech@webdragon.net> wrote:
| > In article <8ko5ds$4tr$1@nnrp1.deja.com>, p3rlc0dr@my-deja.com wrote:
| >
| > I NEVER said I killfiled you personally. Neither explicitly or
| implied.
| > I suggest that you re-read what I said.
|
| You, mactech@webdragon.net, wrote the following in
| <8kntta$8ab$0@216.155.32.162>. You can explain your interpretation of
| the following later:
| "
| I'm done with this thread, as it has nothing to contribute to the group.
|
| *plonk*
| "
|
| Now, stalker, are you *REALLY* done with this thread? You're still
| responding to me AND this thread. Or newbie, don't you know what
| *plonk* and *done with this thread* REALLY means?
Obviously and self-evidently you are NOT the newbie you took such
careful pains to portray yourself as.
Q.E.D.
Say Goodnight, Gracie.
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: Sun, 16 Jul 2000 15:00:45 GMT
From: martho@my-deja.com
Subject: CGI: How do I set/get cookies ?
Message-Id: <8ksimn$t9$1@nnrp1.deja.com>
Hi !
How do I set/get cookies in Perl-CGIs ?
Regards
Martin
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 16 Jul 2000 15:29:44 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: clear query string
Message-Id: <8ksgso$rmb$1@orpheus.gellyfish.com>
On Fri, 14 Jul 2000 20:52:26 GMT sethipra@wellsfargo.com wrote:
> Hi,
>
> I can delete my query string sent through POST method by saying :
> CGI::delete_all() ;
>
> can you pls tell me a way to clear my query string in GET method so
> that it is not shown in address bar always
>
You can't.
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: Sun, 16 Jul 2000 14:26:33 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: communicating through the location bar
Message-Id: <397ac4bd.138685405@news.newsguy.com>
"Ecco" <ecco64@chello.nl> wrote:
>preview.pl?form_type=feedback
>
>you just need to split it up:
>
>@array = SPLIT(/=/$ENV{'QUERY_STRING'});
>
>now both "form-type" and "feedback" are stored in an array, you can work
>with that.
He's already doing fine with that part. No need to persuade him
to take a step backward and abandon CGI.pm in favor of some
buggy hand-coded solution. Suppose the request ends like this:
preview.pl?form_type=feedback&mode=create
Then how does your method help? Just use CGI.pm (or some other
well-tested, supported module) -- it works.
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
(Free at last from the forced spamsig of
Newsfeeds.com, cursed be their name)
------------------------------
Date: Sun, 16 Jul 2000 18:46:33 GMT
From: "Ecco" <ecco64@chello.nl>
Subject: Re: communicating through the location bar
Message-Id: <dqnc5.396508$k22.1750278@flipper>
YOU USE SPLIT SMARTGUY
--
-----------------------------------------------------
Click here for Free Video!!
http://www.gohip.com/free_video/
"Keith Calvert Ivey" <kcivey@cpcug.org> wrote in message
news:397ac4bd.138685405@news.newsguy.com...
> "Ecco" <ecco64@chello.nl> wrote:
>
> >preview.pl?form_type=feedback
> >
> >you just need to split it up:
> >
> >@array = SPLIT(/=/$ENV{'QUERY_STRING'});
> >
> >now both "form-type" and "feedback" are stored in an array, you can work
> >with that.
>
> He's already doing fine with that part. No need to persuade him
> to take a step backward and abandon CGI.pm in favor of some
> buggy hand-coded solution. Suppose the request ends like this:
>
> preview.pl?form_type=feedback&mode=create
>
> Then how does your method help? Just use CGI.pm (or some other
> well-tested, supported module) -- it works.
>
> --
> Keith C. Ivey <kcivey@cpcug.org>
> Washington, DC
> (Free at last from the forced spamsig of
> Newsfeeds.com, cursed be their name)
------------------------------
Date: Sun, 16 Jul 2000 23:23:20 +0200
From: "Raphael Pirker" <raphaelp@nr1webresource.com>
Subject: Re: communicating through the location bar
Message-Id: <8kt9mj$v8a$10$1@news.t-online.com>
> you just need to split it up:
>
> @array = SPLIT(/=/$ENV{'QUERY_STRING'});
could someone please provide the code that I would use to make a variable
called $form_type and it's respecting value the thing after the "=" sign.
I'm very unfamiliar with perl and don't know anything about it!
------------------------------
Date: 16 Jul 2000 16:42:00 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: communicating through the location bar
Message-Id: <87snt93g7r.fsf@limey.hpcc.uh.edu>
>> On Sun, 16 Jul 2000 23:23:20 +0200,
>> "Raphael Pirker" <raphaelp@nr1webresource.com> said:
> could someone please provide the code that I would use
> to make a variable called $form_type and it's respecting
> value the thing after the "=" sign.
http://www.server/path/to/script?name=tony&sex=m
script:
use CGI ':standard';
my $name = param('name');
See the documentation
perldoc LWP
perldoc HTTP::Request
perldoc URI
for how to construct and make requests for URLs.
hth
t
--
"With $10,000, we'd be millionaires!"
Homer Simpson
------------------------------
Date: Sun, 16 Jul 2000 17:31:07 GMT
From: "DS" <snakeman@kc.rr.com>
Subject: Difference between a .cgi file and a .pl file?
Message-Id: <vjmc5.94$L5.2310@typhoon.kc.rr.com>
What is the diference betweeen a .pl file and a .cgi file?
Can I convert a .pl to a .cgi?
Thanks
Dirk
------------------------------
Date: Sun, 16 Jul 2000 13:50:00 -0400
From: Joe Kline <joe.kline@sdrc.com>
To: DS <snakeman@kc.rr.com>
Subject: Re: Difference between a .cgi file and a .pl file?
Message-Id: <3971F5C7.9E56AF01@sdrc.com>
[posted and mailed]
DS wrote:
> What is the diference betweeen a .pl file and a .cgi file?
> Can I convert a .pl to a .cgi?
Depends upon how your web-server is configured (whether it uses file
extension and/or specific dirs for CGI files).
As for converting them...depends. Do they have the proper format to
support CGI protocols?
--
Joe Kline
It takes a lot of brains to enjoy satire, humor, and wit;
but none to be offended by them. ---The Midnight Skulker
------------------------------
Date: Sun, 16 Jul 2000 18:04:51 GMT
From: fvision@my-deja.com
Subject: Re: Difference between a .cgi file and a .pl file?
Message-Id: <8kstfs$7sp$1@nnrp1.deja.com>
Dirk,
The difference between a .cgi and .pl file is really not the issue you
are probably facing. .cgi and .pl are simply file extensions that tell
your web server how to deal with that particular file. On almost all web
servers there is a "cgi-bin" directory. The web server treats all files
in this directory as executables. Web servers can also be configured to
recognize files as executables even when they are not in the "cgi-bin"
directory. When this option is turned on the default for the server is
to treat files ending in .cgi as executables. This however can be
extended to include .pl or .exe or .bucky for all the server cares. It
just wants to know what to try to execute. Making that file executable
is up to you. And yes you can simply change the name of a file from
something.pl to somthing.cgi. This will only cause problems if the
executable itself or other resources expect to find it named something.pl
In article <vjmc5.94$L5.2310@typhoon.kc.rr.com>,
"DS" <snakeman@kc.rr.com> wrote:
> What is the diference betweeen a .pl file and a .cgi file?
> Can I convert a .pl to a .cgi?
>
> Thanks
> Dirk
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sun, 16 Jul 2000 21:44:20 +0200
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Difference between a .cgi file and a .pl file?
Message-Id: <6u24nsoecug7l2oeko997po0vaomkvdk1d@4ax.com>
DS wrote:
>What is the diference betweeen a .pl file and a .cgi file?
>Can I convert a .pl to a .cgi?
If in Perl, both are the same. It depends on the servcer configuration
whether they are truely interchangable.
But a CGI script can be written in one of many languages. So a .cgi file
needn't actually have been written in Perl.
--
Bart.
------------------------------
Date: Sun, 16 Jul 2000 15:53:04 GMT
From: "n" <nospam@mistnet.com>
Subject: easy: forms and frames
Message-Id: <3971da5f@news.iprimus.com.au>
Anyone know how to pass data from a non forms, cgi generated page, to a page
which is part of a frameset?
------------------------------
Date: Sun, 16 Jul 2000 11:10:00 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: flock nonsense ?
Message-Id: <slrn8n3k28.jvi.tadmc@magna.metronet.com>
On Sun, 16 Jul 2000 14:15:32 GMT, John Armsby <jaws@mindspring.com> wrote:
>
>As just a guy who wants the basics of file locking like everyone else,
>I have followed these and other posts, compared code snippets, etc. To
>use Fcntl or not to use Fcntl... to use semaphone files... not to use
>semaphore files...not sure how semaphone files work.... Can I not
>just avoid the problem by renaming the file to PID ($$), doing
>something to it, and then renaming it back?
No.
"instance1" of your program renames a file named '123' (its PID).
"instance1" then loses its time slice.
"instance2" of your program renames a file named '456' (its PID).
"instance2" does some changes, moves the file back
and terminates.
"instance1" gets a turn, does some changes, moves the file back
and terminates.
"instance2"'s changes disappear!
>I have concurrently run the code below as test1.pl and test2.pl. I
>changed test1.pl and test2.pl so that they would print slightly
>different values. That way I could compare what each program was
>doing to the common file.. It seems to work. Why should I agonize
>with flock?
Because you cannot control the scheduling of jobs.
Multitasking is hard. CGI is multitasking. CGI is hard.
>#!/usr/bin/perl/bin
Surely you meant:
#!/usr/bin/perl -w
use strict;
Or similar. Naming your perl interpreter 'bin' is gonna be pretty confusing...
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 16 Jul 2000 13:28:49 -0400
From: John Armsby <jaws@mindspring.com>
Subject: Re: flock nonsense ?
Message-Id: <963768636.564154455@news.mindspring.com>
I don't see it. Instance 1 writes the file. Instance 2 waits until instance 1
is finished and then writes the file (append). When I run the programs they
append to the TestFile.txt.
John
On Sun, 16 Jul 2000, Tad McClellan wrote: >On Sun,
16 Jul 2000 14:15:32 GMT, John Armsby <jaws@mindspring.com> wrote: >>
>>As just a guy who wants the basics of file locking like everyone else,
>>I have followed these and other posts, compared code snippets, etc. To
>>use Fcntl or not to use Fcntl... to use semaphone files... not to use
>>semaphore files...not sure how semaphone files work.... Can I not
>>just avoid the problem by renaming the file to PID ($$), doing
>>something to it, and then renaming it back?
>
>
>No.
>
>"instance1" of your program renames a file named '123' (its PID).
>
>"instance1" then loses its time slice.
>
>"instance2" of your program renames a file named '456' (its PID).
>
>"instance2" does some changes, moves the file back
>and terminates.
>
>"instance1" gets a turn, does some changes, moves the file back
>and terminates.
>
>
>"instance2"'s changes disappear!
>
>
>
>>I have concurrently run the code below as test1.pl and test2.pl. I
>>changed test1.pl and test2.pl so that they would print slightly
>>different values. That way I could compare what each program was
>>doing to the common file.. It seems to work. Why should I agonize
>>with flock?
>
>
>Because you cannot control the scheduling of jobs.
>
>Multitasking is hard. CGI is multitasking. CGI is hard.
>
>
>
>>#!/usr/bin/perl/bin
>
>
>Surely you meant:
>
>
>#!/usr/bin/perl -w
>use strict;
>
>
>Or similar. Naming your perl interpreter 'bin' is gonna be pretty confusing...
>
>
>
>--
> Tad McClellan SGML Consulting
> tadmc@metronet.com Perl programming
> Fort Worth, Texas
------------------------------
Date: Sun, 16 Jul 2000 13:32:50 -0400
From: John Armsby <jaws@mindspring.com>
Subject: Re: flock nonsense ?
Message-Id: <963768867.101226048@news.mindspring.com>
You are right on the #!/usr/bin..
I should have done the #!/usr/bin/perl..... I was just playing around this
morning and was not paying attention.
>Because you cannot control the
scheduling of jobs. >
>Multitasking is hard. CGI is multitasking. CGI is hard.
>
>
>
>>#!/usr/bin/perl/bin
>
>
>Surely you meant:
>
>
>#!/usr/bin/perl -w
>use strict;
>
>
>Or similar. Naming your perl interpreter 'bin' is gonna be pretty confusing...
>
>
>
>--
> Tad McClellan SGML Consulting
> tadmc@metronet.com Perl programming
> Fort Worth, Texas
------------------------------
Date: Sun, 16 Jul 2000 19:43:37 +0200
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: flock nonsense ?
Message-Id: <ips3nscahl3974hl57ak3ir6q5inteqlc5@4ax.com>
martho@my-deja.com wrote:
>> Yes: don't release the lock until you're done with the file. If you
>> need to read AND write from it, then open it for reading and writing.
>Okay, thats the solution. I didnÄt know that you could open a file for
>both. Thanks.
The mode is "+<", but careful: it only succeeds for files that exist.
"+>>" works for new files too, but I'm actually a bit surprised that it
can be used.
WHen you're done reading, do
seek FILE, 0, 0;
truncate FILE, 0;
and you're ready to write new contents.
>> See the open documentation.
>Where can I get it ? Everybody tells me to look at "perldoc ....", but
>in my perl-installtion, there is no file called so. I thank, I didn't
>get the doc-files.
perldoc is a perl script. In the Windows ports, it's a in the form of a
BAT file; in the same directory zs perl itself. At the command line (AKA
"DOS prompt", you can type:
perldoc -f open
optionally followed by "| more" or "> somefile.txt", which makes reading
easier.
I prefer doing this from within a text editor, one which allows you to
run external programs, capture the output, and show it in a new document
window.
--
Bart.
------------------------------
Date: Sun, 16 Jul 2000 18:56:09 GMT
From: "Ecco" <ecco64@chello.nl>
Subject: Re: forms and frames
Message-Id: <dznc5.396561$k22.1746824@flipper>
If I understand you correctly, the easiest way I can think of is using html
in your script using the TARGET function
--
-----------------------------------------------------
Click here for Free Video!!
http://www.gohip.com/free_video/
"n" <nospam@mistnet.com> wrote in message
news:3971da5f@news.iprimus.com.au...
>
> Anyone know how to pass data from a non forms, cgi generated page, to a
page
> which is part of a frameset?
>
>
------------------------------
Date: Sun, 16 Jul 2000 11:11:54 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Getting a random var as output
Message-Id: <slrn8n3k5q.jvi.tadmc@magna.metronet.com>
On Sun, 16 Jul 2000 13:38:22 GMT, Ecco <ecco64@chello.nl> wrote:
>I need to find a way to have my script randomly pick a variable out of a
>list of variables for output...Any suggestions would be appreciated!
I suggest checking the Perl FAQ *before* posting to the Perl newsgroup.
perldoc -q random
"How do I select a random element from an array?"
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 16 Jul 2000 16:24:53 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: Getting a random var as output
Message-Id: <pllc5.39428$fR2.361962@news1.rdc1.mi.home.com>
[Posted and mailed]
In article <iVic5.394345$k22.1732510@flipper>,
"Ecco" <ecco64@chello.nl> writes:
> I need to find a way to have my script randomly pick a variable out of a
> list of variables for output...Any suggestions would be appreciated!
"out of a list of variables"? Do you mean you have like: $a, $c and $q
and you have to pick one at random?
@varlist=\($a, $c, $q);
$vref=$varlist[rand @varlist];
And then later on:
print $$vref;
The reference allows you to go back and modify the one you selected
also. If references frighten you, you could also use a rand() with a
switch-like statement (perlfaq7) to pick one with a little more code.
A final word, if you've picked this kind of structure and you've got
a lot of variables to choose from...usually it means you've picked
the wrong data representation for your data. Use an array or a hash
instead.
--
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: Sun, 16 Jul 2000 18:51:20 GMT
From: "Ecco" <ecco64@chello.nl>
Subject: Re: Getting a random var as output
Message-Id: <Iunc5.396532$k22.1750812@flipper>
That's wat I needed. Thanx. And Tad, sorry for not feeling like spitting
through an FAQ, I hate those things.
------------------------------
Date: Sun, 16 Jul 2000 20:00:51 GMT
From: "Stefan Jonsson" <stefan.jonsson@chello.se>
Subject: Help - Installation problem !
Message-Id: <Tvoc5.1178$u21.276383@nntp1.chello.se>
Hi! I am a newbeginner on Perl programming. How do I execute an
Perlprogram - from the doswindow by writing "perl helloworld.pl" or how?
When I do this i get a message "wrong commando or filename".
I have installed the "Perl 5.6.0.616" - package on a Window 95 system and a
AMD K6 200 mhz processor. I downloaded InstMsi.exe (Installer 1.1) to make
it possible to install the "Perl 5.6.0.616" - package on to it, and the
installation procedure runned smoth. What am I doing wrong?
------------------------------
Date: Sun, 16 Jul 2000 15:35:05 -0500
From: Nnickee <nnickee@nnickee.com>
Subject: Re: Help - Installation problem !
Message-Id: <04A6BEC7B9C77040.E965234D535F1977.A0D53FCA4244AB75@lp.airnews.net>
On Sun, 16 Jul 2000 20:00:51 GMT, someone claiming to be "Stefan
Jonsson" <stefan.jonsson@chello.se> said:
>Hi! I am a newbeginner on Perl programming. How do I execute an
>Perlprogram - from the doswindow by writing "perl helloworld.pl" or how?
Yup, that's how you do it, as long as you aren't leaving in those "
marks.
Try the following from your doswindow: perl -v
Does that come back with wrong command too? If it does, then your
perl didn't install properly. Have you rebooted your system? Checked
your autoexec.bat to make sure perl got added to the path?
If the perl -v came back correctly, are you cd'ing to the directory
where you saved your helloworld.pl script before doing the perl
helloworld.pl ? Have you checked to make sure that that's the actual
name of the script (notepad sometimes adds the .txt extension).
>When I do this i get a message "wrong commando or filename".
>I have installed the "Perl 5.6.0.616" - package on a Window 95 system and a
>AMD K6 200 mhz processor. I downloaded InstMsi.exe (Installer 1.1) to make
>it possible to install the "Perl 5.6.0.616" - package on to it, and the
>installation procedure runned smoth. What am I doing wrong?
Nnickee
------------------------------
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 3684
**************************************