[10824] in Perl-Users-Digest
Perl-Users Digest, Issue: 4425 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 15 02:07:13 1998
Date: Mon, 14 Dec 98 23:00:18 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 14 Dec 1998 Volume: 8 Number: 4425
Today's topics:
Re: ANNOUNCE: CodeMagic Universal IDE for Win32 (Free P (Tad McClellan)
Re: Beginner: What's wrong? josher19@rocketmail.com
DBI Parse error <darrensweeney@eswap.co.uk>
Re: diagnostics <r_larsen@image.dk>
Re: Ensuring only one of me is running? <nospam@see.signature>
Re: fork and defunct processes <aqumsieh@matrox.com>
Help Needed? <chad@anlon.com>
Re: Help Needed? (Martien Verbruggen)
Re: How to disallow fields to input puncuations excepts <saeparam@chollian.net>
Re: Ip number (Andre L.)
Re: Newbie Question (Kevin Reid)
Re: OLE referencing problem: PerlScript, ASP and CDONTS bdavis@mediaphex.com
Passing Variable Problem (Henry Lifton)
reading HTTPS connections <johnDoe@nowhere.com>
Re: Saving Multidimentional Hash's? <ebohlman@netcom.com>
Re: Setting Cookies... Thanks <no_way_amaring@jps.net>
Setting Cookies... <no_way_amaring@jps.net>
Re: Setting Cookies... <cherry66@widomaker.com>
Using "fork" to avoid crashing script (JT)
Re: What can't a file handle Have in it? (Andrew Allen)
Re: What can't a file handle Have in it? <tchrist@mox.perl.com>
Re: Why Is Perl not a Language? <dgris@moiraine.dimensional.com>
Write to a flat file database <mgivens@kidswish.org>
Re: Write to a flat file database <adam@simpledia.com>
Re: Writing Perl with Notepad (Thomas Brian Holdren)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 14 Dec 1998 20:50:49 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: ANNOUNCE: CodeMagic Universal IDE for Win32 (Free Perl IDE)
Message-Id: <9qi457.js8.ln@magna.metronet.com>
pete@davesworld.net wrote:
: BETA 2 will be released on January 1,
: 1999, and Version 1.0 will be released on January 1, 1999.
Wow!
Now that's what I call quick turnaround. ;-)
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 15 Dec 1998 02:15:40 GMT
From: josher19@rocketmail.com
Subject: Re: Beginner: What's wrong?
Message-Id: <754gob$4eb$1@nnrp1.dejanews.com>
>From perlfunc Manual Pages:
The exec() function executes a system command AND
NEVER RETURNS. Use the system() function if you
want it to return.
->><<-
In article <36743EBC.4535B2DD@stat.auckland.ac.nz>,
Mark Holmes <mhol003@stat.auckland.ac.nz> wrote:
> My simple loop only produces one file (corresponding to i=j=0 - it does
> the correct thing in this case). Can anyone see the problem? I'm sure
> it's glaringly obvious, but I can't see it! Thanks in advance :-) !
>
> for($i=0;$i<12;$i++){
> for($j=0;$j<13;$j++){
> $x=60*$j;$y=60*$i;
> exec("pnmcut $x $y 60 60 testgif.pnm | ppmtogif > icon$i$j.gif");}}
>
> --
> When I found the skull in the woods, the first thing I did was call the
> police. But then I got curious about it. I picked it up, and started
> wondering who this person was, and why he had deer horns.
>
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Mon, 14 Dec 1998 19:00:56 -0800
From: "Darren" <darrensweeney@eswap.co.uk>
Subject: DBI Parse error
Message-Id: <754jdt$d30@dfw-ixnews8.ix.netcom.com>
Hi
I am using Perl and DBI to write to a MySQL database.
I get a parse error if I try to put certain types of character in.
Is there a blanket field definition as opposed to VARCHAR which will allow
me to do this?
Thanks
Darren
------------------------------
Date: Tue, 15 Dec 1998 06:26:36 +0100
From: R. A. Larsen <r_larsen@image.dk>
Subject: Re: diagnostics
Message-Id: <VA.00000092.0006afae@octo>
gemhound@gemhound.com (Jim Mooney) wrote:
>
> My apologies if this is a dupe, but I sent it via dejanews and it
> doesn't seem to have arrived.
It did arrive and I (among others) have replied.
Your message has the message-id: <74q425$leh$1@nnrp1.dejanews.com>
Reni
--
Using Virtual Access
http://www.vamail.com
------------------------------
Date: Mon, 14 Dec 1998 17:58:32 -0800
From: "J|rgen Exner" <nospam@see.signature>
Subject: Re: Ensuring only one of me is running?
Message-Id: <754flk$2u4@news.dns.microsoft.com>
Barry Edwards wrote in message <36758e27.12257315@news.u-net.com>...
[...]
>What is the best way a perl script can ensure that only one instance
>of itself is running?
Use a lock file.
It can even be created in an atomic action, so you won't even run into race
conditions.
>Under UNIX, my guess is to use the trick which I have used with shell
>scripts, that is grep the ps command and look for $0.
I would consider that to be "smart coding", i.e. it's not really reliable.
What if someone renames or copies the script? Then you will have a another
instance of the same program with a different name and they will show up
under different names in the process table.
jue
--
J|rgen Exner; microsoft.com, UID: jurgenex
Sorry for this anti-spam inconvenience
------------------------------
Date: Mon, 14 Dec 1998 18:39:22 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
To: "Crist J. Clark" <cjc@scitec.com>
Subject: Re: fork and defunct processes
Message-Id: <x3yzp8quwd1.fsf@tigre.matrox.com>
[posted and emailed]
"Crist J. Clark" <cjc@scitec.com> writes:
> to compress the freshly d/l'ed file. Now, the problem is that
> when the compression program completes, the forked parent process
> becomes a 'defunct' process on the OS, but does not go away.
Have a look at section eight of the FAQs
from perlfaq8:
How do I avoid zombies on a Unix system?
Use the reaper code from the section on Signals in the
perlipc manpage to call wait() when a SIGCHLD is received,
or else use the double-fork technique described in the fork
entry in the perlfunc manpage.
Hope this helps,
Ala
------------------------------
Date: Mon, 14 Dec 1998 23:07:52 -0600
From: Chad Moston <chad@anlon.com>
Subject: Help Needed?
Message-Id: <3675EEA8.48168935@anlon.com>
Can't find the perl command that limits the number of decimal places a
number takes on.
I only want to go one decimal place.
Thanks,
Chad
------------------------------
Date: Tue, 15 Dec 1998 05:54:13 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Help Needed?
Message-Id: <9Qmd2.206$g15.252@nsw.nnrp.telstra.net>
In article <3675EEA8.48168935@anlon.com>,
Chad Moston <chad@anlon.com> writes:
> Can't find the perl command that limits the number of decimal places a
> number takes on.
There is no such thing.
> I only want to go one decimal place.
Do you mean you want to display some floating number, but want to
limit the number of digits after the dot? You do realise that that
isn't the same as 'limit the number of decimal places a number takes
on', right?
# perldoc perlfaq4
[snip]
Does perl have a round function? What about ceil() and
floor()? Trig functions?
[snip]
Is that what you were looking for?
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | If it isn't broken, it doesn't have
Commercial Dynamics Pty. Ltd. | enough features yet.
NSW, Australia |
------------------------------
Date: Tue, 15 Dec 1998 15:24:58 +0900
From: "saeparam" <saeparam@chollian.net>
Subject: Re: How to disallow fields to input puncuations excepts
Message-Id: <Bhnd2.89$j7.223@news.bora.net>
@'@G 1[5i GQ1[7N 9x?*GX AV=G :P >H0h=J4O1n..?
------------------------------
Date: Mon, 14 Dec 1998 22:54:07 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: Ip number
Message-Id: <alecler-1412982254070001@dialup-560.hip.cam.org>
In article <3675A56D.8CF4A490@hotmail.com>, Torsten Lund
<torsten_l@hotmail.com> wrote:
> Is it possible to log the IP of the person that has accessed a
> perlscript through http?
> I have a web site on a linux server, using Apache httpd.
I take it you're talking about a CGI? Then the environment variable
$ENV{REMOTE_ADDR} contains the IP number.
HTH,
Andre
------------------------------
Date: Mon, 14 Dec 1998 21:08:59 -0500
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: Newbie Question
Message-Id: <1djzmv2.nj9t3s1w7b15gN@slip166-72-108-241.ny.us.ibm.net>
E Brown <absent@DIE_SPAMMERamug.org> wrote:
> I'm trying to type examples out of a book and i can't
> figure out what the syntax of these type of routines are:
>
> #!/usr/bin/perl
> use 'Getopt::Std';
>
> now, around Getopt::Std, are those ticks? single quotes?
> i think i've tried every combination possible
> `Getopt::Std' (<tick>Getopt::Std<single-quote>)
> 'Getopt::Std' (<single-quote>Getopt::Std<single-quote>)
> ,etc....
> what's the deal?
Usually, you can't use quotes around module names:
use Getopt::Std;
Also, I have never heard of a programming language that uses quoting
like `this'.
--
Kevin Reid. | Macintosh.
"I'm me." | Think different.
------------------------------
Date: Tue, 15 Dec 1998 03:09:47 GMT
From: bdavis@mediaphex.com
Subject: Re: OLE referencing problem: PerlScript, ASP and CDONTS.NewMail object
Message-Id: <754jtq$71d$1@nnrp1.dejanews.com>
jan.dubois@ibm.net (Jan Dubois) wrote:
> >This is using the SetProperty with multiple values system. It's a
> >horrible horrible thing. Unfortunately MS think it's useful, so you're
> >stuck with it.
>
> What he said. :-(
I'm definitely willing to agree that this method signature is ugly.
> You need Win32::OLE version 0.10 or later.
I have Win32::OLE version 0.1003, Perl 5.005_02 (ActiveState Build 507)
> I think the following is more likely:
> $obj->SetProperty('Value', 'header', 'headervalue');
Your version does not generate an error, but the headers are still not getting
set. Is it of any help to point out that this is the default property of the
object?
I'm trying to pickup all of this OLE "stuff" in a hurry, but it doesn't seem
to be working out too well for me. If I could only convince all of my clients
that Linux was the one true answer to their problems.
I'm still confused by the method's signature not containing an [in] specifier
for the bstrHeader argument. Could someone with more OLE insight explain how
that's supposed to work for me?
Thanks for the help,
Bryan Davis
--
Bryan Davis -M E D I A P H E X- 815 Park Blvd, Ste 340
<bdavis@mediaphex.com> Technical Director Boise, ID 83712
http://www.mediaphex.com v:208.343.2868 f:208.343.1336
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 15 Dec 1998 02:46:05 GMT
From: henlif@elsfl.com (Henry Lifton)
Subject: Passing Variable Problem
Message-Id: <754ico$8io$1@remarQ.com>
I am a newbie who has been going crazy with this. Can any one tell me what is
wrong?
$key is a number that corresponds to the first field $id and comes from
another page.
In trying to debug it, I print the $key and $info variables. $key comes up
properly but $info is blank.
I need to be able to split this into the proper fields.
I would be grateful for any help
Thanks
Henry Lifton
open(land,'/data/land.txt') || die "can't open file land";
$key=$ENV{'PATH_INFO'};
$key =~ s|/||;
$info=$land{$key};
($id,$address,$city,$type,$imp,$desc,$terms,$comments)=split('\t',$info);
------------------------------
Date: Mon, 14 Dec 1998 20:35:38 -0600
From: kevin scott <johnDoe@nowhere.com>
Subject: reading HTTPS connections
Message-Id: <3675CAFA.82AE93D4@nowhere.com>
I looking at writing a robot that will navigate my corporate intranet
looking for specific text. PERL is the perfect language to do this,
however, most of the sites at work are encrypted using SSL. So I need
to get PERL to read a HTTPS: connection. Is there a way to do this
that is legal in the USA?
I know that the PERL module LWP will allow you to read HTTPS documents
using using SSLeay , however, SSLeay is not legal to use in a
corporate setting(in the USA), because of RSA's patent.
Can anyone provide any help (CODE would be nice!) even if it only works
with HTTP
Kev
------------------------------
Date: Tue, 15 Dec 1998 04:52:12 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Saving Multidimentional Hash's?
Message-Id: <ebohlmanF3zpJ1.8Fu@netcom.com>
Ala Qumsieh <aqumsieh@matrox.com> wrote:
: Eric Bohlman <ebohlman@netcom.com> writes:
: > MLDBM. Beg, borrow or steal a copy of Sriram Srinivasan's _Advanced Perl
: > Programming_ (the "panther" book) and read the chapter on "persistence."
: why not "buy" ???
Because the purchase price doesn't include a poetic license.
------------------------------
Date: Mon, 14 Dec 1998 21:25:03 -0800
From: "amaring" <no_way_amaring@jps.net>
Subject: Re: Setting Cookies... Thanks
Message-Id: <3675f2bb.0@blushng.jps.net>
Hehe, thanks... New it was something simple, after I posted the message I
got thinking and tried it... It seems to work.
Thanks again,
{{{ Remove No_Way_ from my email address }}}
------------------------------
Date: Mon, 14 Dec 1998 19:38:47 -0800
From: "amaring" <no_way_amaring@jps.net>
Subject: Setting Cookies...
Message-Id: <3675d9d3.0@blushng.jps.net>
IM trying to set cookies in the http header. When I print the cookie(s) the
text just prints to the top of the screen. I have it after the context type
header, (could that be the problem?)
Also, what is the exact code for printing a cookie?
Baking cookies has never been my strong point...
Code :::
print "Set-Cookie: name=nameval \r\n";
:::End Code
If flipped everything around to every way I can think of, and the same thing
happens.
{{{ Remove No_Way_ from my email address }}}
------------------------------
Date: Mon, 14 Dec 1998 23:47:04 -0500
From: "Bob Kirsch" <cherry66@widomaker.com>
Subject: Re: Setting Cookies...
Message-Id: <3675ebb9.0@newnews.widomaker.com>
Yes, that could be your problem, in fact it is.
A cookie must be sent to the browser before the 'Content-Type' header.
Your cookie code looks fine.
Ever looked into using CGI.pm?
amaring wrote in message <3675d9d3.0@blushng.jps.net>...
>IM trying to set cookies in the http header. When I print the cookie(s)
the
>text just prints to the top of the screen. I have it after the context
type
>header, (could that be the problem?)
>
>Also, what is the exact code for printing a cookie?
>Baking cookies has never been my strong point...
>
>Code :::
>print "Set-Cookie: name=nameval \r\n";
>:::End Code
>
>If flipped everything around to every way I can think of, and the same
thing
>happens.
>
>
>{{{ Remove No_Way_ from my email address }}}
>
>
------------------------------
Date: Tue, 15 Dec 1998 04:54:33 GMT
From: jett1not@homedot.com (JT)
Subject: Using "fork" to avoid crashing script
Message-Id: <3679e240.36766480@news>
I have a mass-mail script which I've successfully modified to
accomodate my client, the problem is my server only allows 64
processes to be forked simultaneously. We need to mail a list of 2500
addresses at a time. I'm running this on BSDI 3.1 running Apache and
Perl v.5.004_04
Since this is a sendmail routine, the script forks several processes
and has no inherent error handling. My server affords me 64
simultaneous processes, but the script doesn't acknowledge this and as
a result causes a: kvm_open: kvm_getprocs: Cannot allocate memory
error. I realize that I need to introduce a sleep if the processes are
tied up, but I don't know how to implement this. I'm hoping someone
else can show me an example of how to implement a "fork" function to
handle the child processes and sleep if ($| =~ /No more process/)
I am jumping way ahead in my "programming Perl" just to get this much,
but I know the script very well and would like to try and implement
this as a remedy.
Apologies if this a "newbie" question, but I am still rather green at
this point.
TIA
-JT
Remove the "not" and delete the "dot" to reply
jett1not@homedot.com
------------------------------
Date: 15 Dec 1998 02:22:18 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: Re: What can't a file handle Have in it?
Message-Id: <754h4q$7r5@fcnews.fc.hp.com>
Tom Christiansen (tchrist@mox.perl.com) wrote:
: [courtesy cc of this posting sent to cited author via email]
: In comp.lang.perl.misc,
: eln@cyberhighway.net (Erik) writes:
: :> handle in a string variable like, $handle = "handle"; and use $handle as
: :> your file handle?
: :
: :Yes. Just be careful to avoid any special characters or reserved words
: :in that string.
: That's not so.
: $handle = "/etc/motd";
: open ($handle, $handle) || die "can't open $handle: $!";
: while (<$handle>) {
: print;
: }
Yup. Not a lot different that, say,
${" "}="bob";
It's a lot clearer when you think of variables as just special cases
of keys in the namespace hash:
print ${$::{" "}};
But why:
${$::{" "}}="bob";
print ${" "};
doesn't work, but this works
${" "}="hal";
${$::{" "}}="bob";
print ${" "};
and this works too:
${$::{"a"}}="bob";
print $a;
and this prints out 1:
print exists($::{"a"}); $a
but this prints out nothing:
print exists($::{"a"}); $b
is beyond me (perhaps a scalar dereference of a glob won't
automatically create namespace entries, but compiling a name
will?). At least this makes sense:
print *{" "}{"IO"},"\n"; #prints nothing
open(" ","-");
print *{" "}{"IO"},"\n"; #prints IO::Handle=IO(0x40016064)
Andrew
------------------------------
Date: 15 Dec 1998 03:39:33 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: What can't a file handle Have in it?
Message-Id: <754lll$fv6$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, ada@fc.hp.com (Andrew Allen) writes:
: print *{" "}{"IO"},"\n"; #prints nothing
: open(" ","-");
: print *{" "}{"IO"},"\n"; #prints IO::Handle=IO(0x40016064)
I'm glad to see that you've learned not to let a silly little thing like
the lexer stand in your way. :-)
--tom
--
Your csh still thinks true is false. Write to your vendor today and tell
them that next year Configure ought to "rm /bin/csh" unless they fix their
blasted shell. :-) --Larry Wall in Configure from the perl distribution
------------------------------
Date: 14 Dec 1998 23:37:08 -0700
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: Why Is Perl not a Language?
Message-Id: <m3u2yxkj1n.fsf@moiraine.dimensional.com>
bart.lateur@skynet.be (Bart Lateur) writes:
> Daniel Grisinger wrote:
>
> >> *My* Perl "programs" usually don't have a user interface. Just a command
> >> line.
> >
> >A command line isn't an interface?
>
> Well all right, it's not an "interactive interface".
Hmmmmm..... I completely do not understand what `interactive' means in
this context. It's kind of like `intuitive', a neat sounding buzzword
with absolutely no communication value. All interesting programs have
some degree of interactivity because they all require data to work on.
I suspect, however, that you are using `interactive' as a synonym for
`graphical'.
> Even without this expliciteness, a command line does not really qualify
> as a user interface:
You and I appear to use very different definitions for `user',
`interface', or both. I think that a command line makes a perfectly
acceptable interface to a program.
> * A command line only allows you to make some settings (and specify
> files). You enter a command line, and are finished COMPLETELY before the
> program/script even starts to run. So it's not really an interface of
> your program.
_Any_ point where your program can accept input from an external
source or can provide output to an external source is an interface.
It doesn't matter if it's a command line, a webpage, or a helper
function that's only useful in the debugger- if it accepts input or
produces output it's an interface. It should be designed and coded
with the same care that you'd give some windowed application that
wants 80 megs of memory and will always be wasting space on the user's
desktop.
> If you do insist that a command line is an interface, you may even
> stretch it further, and pass the settings in a file, which the script
> can read. In that respect, a makefile is a user interface to the program
> make. Not.
You couldn't have picked a better example of why not thinking about
your interfaces produces hard-to-use software. We all have paid the
price in extra bugs and wasted hours because of the poor interface
decisions made while writing make. :-(
dgris
--
Daniel Grisinger dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'
------------------------------
Date: Mon, 14 Dec 1998 22:20:33 -0600
From: "The KidsWish Foundation" <mgivens@kidswish.org>
Subject: Write to a flat file database
Message-Id: <754o2m$ika@dfw-ixnews6.ix.netcom.com>
=== code snip below ===
Situation:
We are using FormMail.pl to send HTML form responses via email from our
website to an in-house account.
Proposal:
Change the method in which we process the information from the form by
eliminating the e-mail and writing the information to a | delimited flat
file instead. Also, add an auto "thank you" message to be sent to the
submitter.
Problem:
With limited knowledge of PERL and programming in general, my efforts have
not succeeded. I know this is a simple procedure for the knowledgeable
people of the PERL world so we are asking for assistance. The email part is
completed and seems to work fine. Would someone be willing to contribute
some assistance or write a script that will do the job as a contribution to
The KidsWish Foundation? If so, let me know. We need to get this done as
soon as possible as our emails are getting out of hand and would be much
easier to manage the data out of the flat file. The script needs to work,
even if we add additional fields to the form in the future.
Thank you,
--
Mark Givens
mgivens@kidswish.org
The KidsWish Foundation
http://www.kidswish.org
we are using cgi-lib.pl to parse the form. below is the meat of the 'write'
functions
$filename = "sitedata.txt";
&parse_form;
&addrecord
sub addrecord {
$infoa = $FORM{'infoa'};
$infob = $FORM{'infob'}; #more fields to be added
###############################
# Convert HTML < tags to < #
###############################
$infoa =~ s/</\</g;
$infob =~ s/</\</g; #more fields to be added
&open_file("FILE1",">>",$filename);
&write_file("FILE1",$infoa . "|". $infob. "\n"); #more fields to be added
close(FILE1);
sub parse_form {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
if (length($buffer) < 5) {
$buffer = $ENV{QUERY_STRING};
}
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
}
&open_file("FILE1",">>",$filename);
&write_file("FILE1",$infoa . "|". $infob. "\n"); #more fields to be added
close(FILE1);
sub open_file {
local ($filevar, $filemode, $filename) = @_;
open ($filevar,$filemode . $filename) ||
die ("Can't open $filename");
}
sub read_file {
local ($filevar) = @_;
<$filevar>;
}
sub write_file {
local ($filevar, $line) = @_;
print $filevar ($line);
}
------------------------------
Date: Tue, 15 Dec 1998 04:38:10 GMT
From: "Adam Michela" <adam@simpledia.com>
Subject: Re: Write to a flat file database
Message-Id: <SIld2.1553$e66.75843@typhoon.nycap.rr.com>
Mark:
Please email me the full details and I would be more than happy to put
together a script for your organization.
Sincerely,
Adam Michela
Simpledia Designs
http://www.simpledia.com
The KidsWish Foundation <mgivens@kidswish.org> wrote in message
news:754o2m$ika@dfw-ixnews6.ix.netcom.com...
>=== code snip below ===
>
>Situation:
>We are using FormMail.pl to send HTML form responses via email from our
>website to an in-house account.
>
>Proposal:
>Change the method in which we process the information from the form by
>eliminating the e-mail and writing the information to a | delimited flat
>file instead. Also, add an auto "thank you" message to be sent to the
>submitter.
>
>Problem:
>With limited knowledge of PERL and programming in general, my efforts have
>not succeeded. I know this is a simple procedure for the knowledgeable
>people of the PERL world so we are asking for assistance. The email part
is
>completed and seems to work fine. Would someone be willing to contribute
>some assistance or write a script that will do the job as a contribution to
>The KidsWish Foundation? If so, let me know. We need to get this done as
>soon as possible as our emails are getting out of hand and would be much
>easier to manage the data out of the flat file. The script needs to work,
>even if we add additional fields to the form in the future.
>
>Thank you,
>
>--
>Mark Givens
>mgivens@kidswish.org
>The KidsWish Foundation
>http://www.kidswish.org
>
>we are using cgi-lib.pl to parse the form. below is the meat of the
'write'
>functions
>$filename = "sitedata.txt";
>
>&parse_form;
>
>&addrecord
>
>sub addrecord {
>
>$infoa = $FORM{'infoa'};
>
>$infob = $FORM{'infob'}; #more fields to be added
>
>###############################
>
># Convert HTML < tags to < #
>
>###############################
>
>$infoa =~ s/</\</g;
>
>$infob =~ s/</\</g; #more fields to be added
>
>&open_file("FILE1",">>",$filename);
>
>&write_file("FILE1",$infoa . "|". $infob. "\n"); #more fields to be added
>
>close(FILE1);
>
>
>
>sub parse_form {
>
>read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
>
>if (length($buffer) < 5) {
>
>$buffer = $ENV{QUERY_STRING};
>
>}
>
>
>@pairs = split(/&/, $buffer);
>
>foreach $pair (@pairs) {
>
>($name, $value) = split(/=/, $pair);
>
>$value =~ tr/+/ /;
>
>$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
>
>$FORM{$name} = $value;
>
>}
>
>}
>
>&open_file("FILE1",">>",$filename);
>
>&write_file("FILE1",$infoa . "|". $infob. "\n"); #more fields to be added
>
> close(FILE1);
>
>sub open_file {
>
>local ($filevar, $filemode, $filename) = @_;
>
>
>open ($filevar,$filemode . $filename) ||
>
>die ("Can't open $filename");
>
>}
>
>sub read_file {
>
>local ($filevar) = @_;
>
><$filevar>;
>
>}
>
>sub write_file {
>
>local ($filevar, $line) = @_;
>
>print $filevar ($line);
>
>}
>
>
>
------------------------------
Date: 15 Dec 1998 02:53:01 GMT
From: irc_addict@hotmail.com (Thomas Brian Holdren)
Subject: Re: Writing Perl with Notepad
Message-Id: <754iud$6ks$1@cletus.bright.net>
In article <36730C4B.D0A1B217@technologist.com>, evanp@technologist.com says...
>I have no problems writing Perl scripts with vi. Yesterday though, I
>tried to write a script with Notepad but after I saved it on Linux and
>tried to execute it gave me an error complaining about linefeeds or
>something like that. Can I use Notepad or different windows editor
>for script writing? I have a class of high school students and using
>vi is like pulling teeth.
I have found, IMHO, what I believe to be the best Win32 (95, 98, and NT)
replacement for notepad for perl developers being forced to work in today's
tainted Win32/UNIX environment. Love Vi? Hate Windows becuase you can't
"Esc:w" to save a file? Try this :
http://www.snafu.de/~ramo/WinVi32.zip
This is a program called WinVi32. It honestly feels like Vi, and can save
files on a UNIX system without adding Notepad's "^M" character to the end of
every line. And, you can use the mouse (of course), with the End, Del, and
Home keys etc etc. I think it's worth looking into. Please, someone else take
a look at it and tell me what you think!
No, I didn't write it, and the author's not paying me. Unless he wants to.
Regards,
-Thomas Brian Holdren
"Seeping Beepurism? Gleeping Naturism? Heaping Anuerism?"
-Me (after too long with my contacts in staring at my new perl book)
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 4425
**************************************