[12712] in Perl-Users-Digest
Perl-Users Digest, Issue: 122 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 13 19:21:00 1999
Date: Tue, 13 Jul 1999 16:17:35 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 13 Jul 1999 Volume: 9 Number: 122
Today's topics:
Re: Beginner in perl, checking header and footer (Abigail)
Re: Beginner in perl, checking header and footer <coers@evsx.com>
Re: Beginner in perl, checking header and footer (Anno Siegel)
Re: Beginner in perl, checking header and footer <coers@evsx.com>
Re: Beginner in perl, checking header and footer (Anno Siegel)
Re: Beginner in perl, checking header and footer (Andrew Allen)
Broken newsreaders (was Re: Who is right ?) (Abigail)
Calculations <susan@anthony1.force9.co.uk>
Re: Calculations (Larry Rosler)
Re: Calling C libs from C libs from Perl with XS (Rob Sweet)
calling XSUBs from other XSUBs <marco@pc.chemie.tu-darmstadt.de>
Can I unread a line from <>? (Scott V. McGuire)
Re: Can I unread a line from <>? (Sitaram Chamarty)
Can't find string terminator "]" <paragmehta@hotmail.com>
Re: Case of hash keys (Abigail)
cgi mail need help!!! <ps205@my-deja.com>
Re: cgi.pm question... THANKS! (John Hurley)
Cgiemail or Perl script processing form submissions <kjcox@vii.com>
Re: Cgiemail or Perl script processing form submissions <cityedin@cableinet.co.uk>
Checking for <STDIN> <csdelane@students.uiuc.edu>
Re: Checking for <STDIN> <tobez@plab.ku.dk>
Re: Checking for <STDIN> (Tad McClellan)
Re: Checking for <STDIN> (Abigail)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 12 Jul 1999 21:37:05 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Beginner in perl, checking header and footer
Message-Id: <slrn7ol9ho.h7.abigail@alexandra.delanet.com>
Nostradamus (mboertien@my-deja.com) wrote on MMCXLI September MCMXCIII in
<URL:news:7mccle$iqt$1@nnrp1.deja.com>:
"" At the moment i've just started with perl and i really have to do some
"" stuff which i couldn't find in the cookbook or learning perl
"" book....they're probably simple but i have no idea how to do this :
""
"" I have a file with a header (BEGIN) and a trailer (END). I want to
"" check if the first line has the BEGIN in it, and if the last line has
"" END in it.....how can i do this??
Are you sure neither of the cookbook or learning Perl explains how you
can read from a file, line by line? Or did both of them forget to explain
how to check if a pattern matches a string?
If I can find the answer in both learning Perl and the cookbook within
10 minutes, do I get your first born son?
Abigail
--
sub f{sprintf'%c%s',$_[0],$_[1]}print f(74,f(117,f(115,f(116,f(32,f(97,
f(110,f(111,f(116,f(104,f(0x65,f(114,f(32,f(80,f(101,f(114,f(0x6c,f(32,
f(0x48,f(97,f(99,f(107,f(101,f(114,f(10,q ff)))))))))))))))))))))))))
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Tue, 13 Jul 1999 09:09:58 -0500
From: John Coers <coers@evsx.com>
Subject: Re: Beginner in perl, checking header and footer
Message-Id: <378B48B6.6535A5D3@evsx.com>
Nostradamus wrote:
>
> At the moment i've just started with perl
Read Learning Perl. Chapter 7 is pattern matching and chapter 10 is
filehandles. Or look those subjects up in the Camel book.
> I have a file with a header (BEGIN) and a trailer (END). I want to
> check if the first line has the BEGIN in it, and if the last line has
> END in it.....how can i do this??
Read the whole file into an array then check the first [0] and last [-1]
elements with regular expressions. Cookbook recipe 8.4 mentions this
sort of thing -- also look in the Camel chapter 2 under "pattern
matching." There are more sophisticated ways to do this as well. If
your file is too big for memory, check out recipes 8.8 and 8.10.
Be grateful Abigail was generous. She could have asked for all of your
children.
--
John Coers EVSX, Inc.
coers@evsx.com Austin, Texas
------------------------------
Date: 13 Jul 1999 17:45:36 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Beginner in perl, checking header and footer
Message-Id: <7mfu00$cs7$1@lublin.zrz.tu-berlin.de>
John Coers <coers@evsx.com> wrote in comp.lang.perl.misc:
>Read the whole file into an array then check the first [0] and last [-1]
>elements with regular expressions. Cookbook recipe 8.4 mentions this
>sort of thing -- also look in the Camel chapter 2 under "pattern
>matching."
I have seen this advice here so often, it begins to make me nervous.
open( F, 'file') or die "$!\n";
@lines = <F>;
has almost become an idiom, but of a dialect of perl that grates on
my... well, whatever organ it is you appraise the esthetics of
programming languages with. It is rarely a good idea to read all
of a file into memory before doing anything, and it's certainly out
of place when all you want is the first and the last line.
> There are more sophisticated ways to do this as well. If
>your file is too big for memory, check out recipes 8.8 and 8.10.
You should normally assume that a file is too big for memory. Disk
space, besides being persistent, is there to hold chunks of data that
are too big for memory. That's why files are often organized to be
processed sequentially, and if they are, it is good practice to make
use of the fact.
Anno
------------------------------
Date: Tue, 13 Jul 1999 14:13:56 -0500
From: John Coers <coers@evsx.com>
Subject: Re: Beginner in perl, checking header and footer
Message-Id: <378B8FF4.D1D51824@evsx.com>
> I have seen this advice here so often, it begins to make me nervous.
Close your eyes and take deep breaths.
> open( F, 'file') or die "$!\n";
> @lines = <F>;
>
> has almost become an idiom, but of a dialect of perl that grates on
> my... well, whatever organ it is you appraise the esthetics of
Systems programmers use the pipe organ.
> programming languages with. It is rarely a good idea to read all
> of a file into memory before doing anything, and it's certainly out
> of place when all you want is the first and the last line.
Of course the 'rarely' part won't matter to him if it works well in his
case and I would also argue the 'certainly' part.
If his files are 3-5 lines long, it's probably a good way to do it.
That is his call to make.
> You should normally assume that a file is too big for memory. Disk
> space, besides being persistent, is there to hold chunks of data that
> are too big for memory. That's why files are often organized to be
> processed sequentially, and if they are, it is good practice to make
> use of the fact.open (IN,"infile");
You should normally look at your problem and make a decision based on
the situation. Anno has a good point, but I don't necessarily agree
with his adverbs. So, if you don't want to read the whole file into
memory at once, try:
open (IN,"input_filename");
$first_line = <IN>;
$begin_flag = $first_line =~ /BEGIN/;
while(<IN>) { $where = tell(IN) unless eof(IN); }
seek IN,$where,0;
$last_line = <IN>;
$end_flag = $last_line =~ /END/;
if($begin_flag && $end_flag) {
# do something
}
Of course there are ways to shorten this, but it is written for clarity.
--
John Coers EVSX, Inc.
coers@evsx.com Austin, Texas
------------------------------
Date: 13 Jul 1999 19:44:34 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Beginner in perl, checking header and footer
Message-Id: <7mg4v2$d4a$1@lublin.zrz.tu-berlin.de>
John Coers <coers@evsx.com> wrote in comp.lang.perl.misc:
[whether or not to slurp a file]
>If his files are 3-5 lines long, it's probably a good way to do it.
>That is his call to make.
Will it stay three lines long?
>> You should normally assume that a file is too big for memory. Disk
>> space, besides being persistent, is there to hold chunks of data that
>> are too big for memory. That's why files are often organized to be
>> processed sequentially, and if they are, it is good practice to make
>> use of the fact.
>You should normally look at your problem and make a decision based on
>the situation. Anno has a good point, but I don't necessarily agree
>with his adverbs.
True, but not the whole truth. A program tends to be used way longer
than you expect when you write it, and for problems much bigger than
you anticipate at the time. So it's sometimes not good enough to look
at your problem as it presents itself today. Unless you are writing
a throwaway solution for a one-time problem a few more lines of code
and a few more minutes of programmer time can pay back hugely if they
make for a solution that scales well.
[non-slurping solution snipped]
Anno
------------------------------
Date: 13 Jul 1999 21:33:21 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: Re: Beginner in perl, checking header and footer
Message-Id: <7mgbb1$mbf$1@fcnews.fc.hp.com>
John Coers (coers@evsx.com) wrote:
: open (IN,"input_filename");
: $first_line = <IN>;
: $begin_flag = $first_line =~ /BEGIN/;
: while(<IN>) { $where = tell(IN) unless eof(IN); }
: seek IN,$where,0;
: $last_line = <IN>;
: $end_flag = $last_line =~ /END/;
: if($begin_flag && $end_flag) {
: # do something
: }
: Of course there are ways to shorten this, but it is written for clarity.
On what planet would this be clear? Besides not checking your open for
failure, it unnecessarily uses file positions and reads the last line
twice.
$first=<IN>;
$last=$_ while <IN>;
if($first=~/BEGIN/ && $last=~/END/) {...
Andrew
------------------------------
Date: 12 Jul 1999 22:11:34 -0500
From: abigail@delanet.com (Abigail)
Subject: Broken newsreaders (was Re: Who is right ?)
Message-Id: <slrn7olbie.h7.abigail@alexandra.delanet.com>
birgitt@my-deja.com (birgitt@my-deja.com) wrote on MMCXLI September
MCMXCIII in <URL:news:7mdqpo$1eq$1@nnrp1.deja.com>:
Your newsreader seems to be seriously broken. You start a new thread
by posting an original question. However, for some mysterious reason,
your newsreader included a References line, suggesting that your posting
refers to some other posting. But, nothing in the text of your posting
suggests such a thing. Ergo, your newssoftware has a mind of its own
and creates bogus headers.
This causes a major pain for the thousands of people in this group that
use threading newsreaders. Your posting gets threaded wrong. And you can
hurt yourself that way too. Perhaps someone with deep insight in the
questions you raised didn't even read the message because he junked
the thread your message was threaded into.
Here is the bogus reference header:
References: <Pine.GSO.4.10.9907121449590.14126-100000@ux9.cso.uiuc.edu>
I suggest that you contact the vendor who supplied you the newsreader.
Abigail
--
perl -wlpe '}{$_=$.' file # Count the number of lines.
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Tue, 13 Jul 1999 20:25:47 +0100
From: "Susan C. Sayce" <susan@anthony1.force9.co.uk>
Subject: Calculations
Message-Id: <HoMi3.2652$34.2848@wards>
Hi,
How do you get perl to add 2 numbers together??
Also is there a function to test to see if a string is numeric such as the
"isnumeric(string)" in VB
Thanks
gghjhgf1@hotmail.com
------------------------------
Date: Tue, 13 Jul 1999 13:46:48 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Calculations
Message-Id: <MPG.11f545969d821ed7989cbe@nntp.hpl.hp.com>
In article <HoMi3.2652$34.2848@wards> on Tue, 13 Jul 1999 20:25:47
+0100, Susan C. Sayce <susan@anthony1.force9.co.uk> says...
> How do you get perl to add 2 numbers together??
Throw it a fish.
> Also is there a function to test to see if a string is numeric such as the
> "isnumeric(string)" in VB
No. But there is a FAQ.
How's my Abigail imitation?
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 12 Jul 1999 23:47:22 GMT
From: sweet@enterpriseusa.com (Rob Sweet)
Subject: Re: Calling C libs from C libs from Perl with XS
Message-Id: <378a7c94.23453218@news1.mi.home.net>
On Mon, 12 Jul 1999 20:07:30 +0200, Anton Berezin <tobez@plab.ku.dk>
wrote:
>I am afraid I do not follow you this time. What are you trying to
>accomplish and what is the problem you have? Can you provide us with a
>piece of code which does not work (of a reasonable size)?
Never mind. I was barking up the wrong tree. I've got everything
working now, though lots of crashing with Segmentation fault (core
dumped) messages on my return data. It looks pretty straight forward
from here on out.
Thanks
Rob.
------------------------------
Date: Tue, 13 Jul 1999 14:45:52 -0700
From: Marco Mueller <marco@pc.chemie.tu-darmstadt.de>
Subject: calling XSUBs from other XSUBs
Message-Id: <378BB390.B4EC6AA9@pc.chemie.tu-darmstadt.de>
Hi all,
I have a question concerning the call of a XSUB from another XSUB within
the same .xs file.
After:
>h2xs -n foo
I changed to the newly created dir foo, edited foo.xs to look like:
(files indented to improve readability :-)
################################################### foo.xs
#ifdef __cplusplus
extern "C" {
#endif
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "foo.h"
#ifdef __cplusplus
}
#endif
MODULE = foo PACKAGE = foo
float *
new( CLASS, n )
char *CLASS
I32 n
CODE:
RETVAL = (float *) safemalloc( sizeof(float) * n );
OUTPUT:
RETVAL
float *
init( CLASS, sv )
char *CLASS
SV *sv
PREINIT:
I32 n, i;
AV *arr;
SV **sv_tmp;
float *ptr;
CODE:
if( SvROK( sv ) ) {
arr = (AV *) SvRV( sv );
}
n = av_len( arr ) + 1;
-----------------> /* Here is what I would like to do: */
/* ptr = (float *) new( CLASS, n ); */
/* Instead I have to say: */
ptr = (float *) safemalloc( sizeof(float) * n );
for(i=0; i<n; i++)
{
sv_tmp = av_fetch( arr, i, 0 );
ptr[i] = SvNV( *sv_tmp );
}
RETVAL = ptr;
OUTPUT:
RETVAL
void
print_arr( obj, n )
float *obj
I32 n
PREINIT:
I32 i;
float f;
CODE:
for(i=0; i<n; i++)
{
f = obj[i];
printf("%d %f\n", i, f);
}
void
DESTROY( obj )
float *obj
CODE:
printf("# destroying %s\n", SvPV(ST(0),na) );
safefree( (char*) obj );
Also I edited test.pl, which looks now like:
################################################## test.pl
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use foo;
$loaded = 1;
print "ok 1\n";
my @a = (3., 2., 1.);
my $p = foo->init( \@a);
$p->print_arr( scalar(@a) ); ### I know this can be done better
Finally I added a typemap:
################################################# typemap
TYPEMAP
float * O_OBJECT
OUTPUT
O_OBJECT
sv_setref_pv($arg, CLASS, (void *) $var);
INPUT
O_OBJECT
if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) )
$var = ($type)SvIV((SV*)SvRV( $arg ));
else
{
warn( \"${Package}::$func_name() - ERROR\" );
XSRETURN_UNDEF;
}
And a foo.h header file:
################################################# foo.h
float *arr;
float *new( char *CLASS, I32 n );
float *init( char *CLASS, SV *sv );
void print_arr( float *obj, I32 n );
void DESTROY( float *obj );
Now, applying the usual sequence of commands:
>perl Makefile.PL
>make
>make test
runs fine with the above definition of foo.xs; but as soon as I change
the subroutine init at the marked place (marked by an arrow) to:
ptr = (float *) new( CLASS, n );
/* ptr = (float *) safemalloc( sizeof(float) * n ); */
I receive the following error (after running make test again):
Can't load 'blib/arch/auto/foo/foo.so' for module foo:
blib/arch/auto/foo/foo.so: undefined symbol: new at
/usr/lib/perl5/5.00502/i586-linux/DynaLoader.pm line 168.
at test.pl line 11
BEGIN failed--compilation aborted at test.pl line 11.
Apparently I cannot call the XSUB new from init, which is what I would
like to do.
What am I missing and also: is there a better way for defining and using
a constructor ?
Tia,
Marco
------------------------------
Date: Tue, 13 Jul 1999 05:28:32 GMT
From: svmcguir@syr4-22c.twcny.rr.com (Scott V. McGuire)
Subject: Can I unread a line from <>?
Message-Id: <slrn7oljd1.1pj.svmcguir@syr4-22c.twcny.rr.com>
I'm processing a file (usually, sometime standard input) in chunks.
Each chunk is identified by a regular expression. The code looks
something like:
while(stuff left to do){
initialize
while( ($line = <>) =~ Some Regular Expression){
do something
}
}
My problem is that this way, at the end of a chunk, I'm reading a line
which belongs to the next chunk. Is there a nice way to put it back
or otherwise make sure its included at the top of the next chunk?
--
Scott V. McGuire <svmcguir@syr.edu>
PGP key available at http://web.syr.edu/~svmcguir
Key fingerprint = 86 B1 10 3F 4E 48 75 0E 96 9B 1E 52 8B B1 26 05
What is PGP? Why do you need it? http://world.std.com/~franl/crypto
------------------------------
Date: Tue, 13 Jul 1999 21:28:56 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: Can I unread a line from <>?
Message-Id: <slrn7omtrg.pq2.sitaram@diac.com>
On Tue, 13 Jul 1999 05:28:32 GMT, Scott V. McGuire
<svmcguir@syr4-22c.twcny.rr.com> wrote:
>I'm processing a file (usually, sometime standard input) in chunks.
>Each chunk is identified by a regular expression. The code looks
>something like:
>
>
>while(stuff left to do){
> initialize
> while( ($line = <>) =~ Some Regular Expression){
> do something
> }
>}
>
>
>My problem is that this way, at the end of a chunk, I'm reading a line
>which belongs to the next chunk. Is there a nice way to put it back
>or otherwise make sure its included at the top of the next chunk?
Use a lookahead buffer. Try something like this:
$lb=undef;
while (stuff left to do)
{
initialize
while ($line = $lb || <>)
{
$lb = undef; # either way, it's been "used up"
if ($line =~ /regex/)
{
do something
}
else
{
$lb = $line; # stuff this "future" line into $lb
last;
}
}
}
May not be exactly what you need, but should get you started...
------------------------------
Date: Mon, 12 Jul 1999 17:33:24 -0400
From: Parag Mehta <paragmehta@hotmail.com>
Subject: Can't find string terminator "]"
Message-Id: <378A5F24.A4F71191@hotmail.com>
Hi,
I am trying to install DBI on win NT and get the following error when I
do make after makefile.pl:
Can't find string terminator "]" anywhere before EOF at -e line 1.
make: *** [pm_to_blib] Error 2
I have cygwin and perl already installed. I also get the same error
when I do make test and make install and for any other modules I install
the perl way (makefile.pl, make, make test, make install way).
Anyone knows the problem.
Thanks for looking into.
:-)
Regards
Parag
paragmehta@hotmail.com
------------------------------
Date: 12 Jul 1999 22:00:40 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Case of hash keys
Message-Id: <slrn7olatv.h7.abigail@alexandra.delanet.com>
Clinton Gormley (clint@drtech.co.uk) wrote on MMCXLI September MCMXCIII
in <URL:news:7mda68$6il$1@taliesin.netcom.net.uk>:
## Is there any (neat, quick) way of making case irrelevant to key names in
## hashes?
##
## ... ie other than $hash{lc($key)} =
Both lc and uc are 2 characters. How much neater do you want?
I guess you make a tied hash, but I don't know whether that's neat.
Anyway, perhaps you like it:
#!/opt/perl/bin/perl -w
use strict;
package Neato;
sub TIEHASH {bless {} => $_[0]}
sub FETCH {$_[0] -> {lc $_[1]}}
sub STORE {$_[0] -> {lc $_[1]} = $_[2]}
sub DELETE {delete $_[0] -> {lc $_[1]}}
sub CLEAR {%{$_[0]} = ()}
sub EXISTS {exists $_[0] -> {lc $_[1]}}
sub FIRSTKEY {keys %{$_[0]}; each %{$_[0]}}
sub NEXTKEY {each %{$_[0]}}
package main;
tie my %hash => 'Neato';
$hash {One} = 1;
$hash {Two} = 2;
$hash {Three} = 3;
$, = ' ';
print $hash {one}, $hash {TWO}, $hash {thRee}, "\n";
__END__
1 2 3
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Mon, 12 Jul 1999 19:25:27 GMT
From: penny <ps205@my-deja.com>
Subject: cgi mail need help!!!
Message-Id: <7mdfem$sdd$1@nnrp1.deja.com>
#!/usr/bin/perl
print "Content-type:text/html\n\n";
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@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;
$value =~ s/\n/ /g; # added to strip line
breaks
$FORM{$name} = $value;
}
###################### Assigning Variables ######################
$mailprog = '/usr/sbin/sendmail'; ## Location of sendmail
$mail_recipient = $FORM{'recipient'}; ## Sends mail to the
recipient
open (MAIL, "!$mailprog -t") or &dienice("Couldn't open $mailprog!\n");
print MAIL "To: $mail_recipient\n";
print MAIL "Subject: Ordering Information\n\n";
print MAIL "Customer name: $FORM{'name'}\n\n";
print MAIL "Phone: $FORM{'phone'}\n\n";
print MAIL "Zip Code: $FORM{'zip'}\n";
close(MAIL);
######## Print Thank You Message ########
print "Location: http://www.horizonfoods.com/message.html";
########## Print Error Message ##########
sub dienice {
($msg) = @_;
print "<h2>Error</h2>\n";
print $msg;
exit;
}
That's basically the code my friend wrote but we couldn't find the
sendmail program thinking this was a unix server. We found out the
server is NT and uses blatmail. Anyhow now we don't know how to
configure the script to include the blatmail. The server admin said
that this:
$mailprog = "blat c:/www/com/horizon/cgi-shl/message.tmp -s Mail -f
Mailer -t " . $recipients;
is the what we're suppose to use instead of sendmail. Can anyone help
me figure out what's going on? Thank you!
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Mon, 12 Jul 1999 20:15:36 GMT
From: jhurleyremove@njsba.org (John Hurley)
Subject: Re: cgi.pm question... THANKS!
Message-Id: <378a4c7f.17631987@news.erols.com>
Thanks for the help everyone. Finally got through to the isp and they
said i was using the path for my association's box which has an old
ver. of perl. They re-directed me and now everything works fine!!!
Again Thanks,
John Hurley
On Wed, 07 Jul 1999 17:03:04 GMT, jhurleyremove@njsba.org (John
Hurley) wrote:
>hi all,
>
>I have been having a problem with using cgi mail forms on my web site
>for quite some time. And I THINK I found the problem and want to know
>if it is possible.......
>
>My site is running on a BSD server and every time i try to run a Perl
>program on it with the use CGI line, i get a 500 error. Can it be
>that the Perl interpreter on the server may be an old version that
>does not contain cgi.pm on it? I have been trying to get a hold of my
>isp for a while now to find out about this and have not been replied
>to yet. So I just thought I would ask you Perl pros.
>
>Thanks,
>John M Hurley
------------------------------
Date: Mon, 12 Jul 1999 14:30:31 -0600
From: "Kerry J. Cox" <kjcox@vii.com>
Subject: Cgiemail or Perl script processing form submissions
Message-Id: <378A5067.25A4BB75@vii.com>
This may be a bit off topic, but I'm hoping someone here is familiar
enough with cgiemail and/or perl to assist. I'm needing to have a form
submit information not as email but rather have a small Perl script take
over and then append the text to a file.
For example, I have a form that after you submit it sends a line comma
delimited text with each field surrounded by quotes as a email.
"Mr.","Kerry","Cox","1234 Anywhere Street", etc........ What I want to
have it do instead is have a Perl script write this form to a text
file. And then have each succeeding submission append to the next line
of that file. That weay each submission takes a line.
If anyone is familiar enough with something like this and could please
assist me, I would very much appreciate it.
Thanks.
KJ
--
.-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-.
| Kerry J. Cox Vyzynz International Inc. |
| kjcox@vii.com Systems Administrator |
| (801) 596-7795 http://www.vii.com |
| ICQ# 37681165 http://quasi.vii.com/linux/ |
`-------------------------------------------------------'
------------------------------
Date: Tue, 13 Jul 1999 19:29:53 +0000
From: Wallace Nicoll <cityedin@cableinet.co.uk>
Subject: Re: Cgiemail or Perl script processing form submissions
Message-Id: <378B93B1.4AC0@cableinet.co.uk>
There are a wide range of perl scripts available that do this. Check out
some of the scripts on the following sites ...
webreview.com
www.netscapeworld.com
www.javaworld.com
www.webreference.com
www.webcoder.com
Wallace
------------------------------
Date: Mon, 12 Jul 1999 14:58:17 -0500
From: christopher sean delaney <csdelane@students.uiuc.edu>
Subject: Checking for <STDIN>
Message-Id: <Pine.GSO.4.10.9907121449590.14126-100000@ux9.cso.uiuc.edu>
I am trying to write a piece of code that will check STDIN for input but
if there is none, for it to continue execution. To make it clearer,
consider this: I have a script that updates itself every two minutes.
During those two minutes, the following code executes:
$i = 60;
while ($i != 0)
{
print ".";
sleep 2;
$i--;
}
I would like it if in the case of the user pressing either any key or
maybe just return, for it to break out of this while loop and update
itself again. I've tried to say:
last if ($temp = <STDIN>);
but this blocks until return is pressed. Anyone have any ideas?
------------------------------
Date: Mon, 12 Jul 1999 22:29:45 +0200
From: Anton Berezin <tobez@plab.ku.dk>
Subject: Re: Checking for <STDIN>
Message-Id: <19990712222945.S42941@lion.plab.ku.dk>
On Mon, Jul 12, 1999 at 02:58:17PM -0500, christopher sean delaney wrote:
> I am trying to write a piece of code that will check STDIN for input
> but if there is none, for it to continue execution. To make it
> clearer, consider this: I have a script that updates itself every two
> minutes. During those two minutes, the following code executes:
> $i = 60;
> while ($i != 0)
> {
> print ".";
> sleep 2;
> $i--;
> }
Four-argument select (perlodc -f select) is your friend. Like this:
for (1..60) {
print STDERR ".";
$rin = $win = $ein = '';
vec($rin,fileno(STDIN),1) = 1;
last if select($rin, $win, $ein, 2);
}
This require return to be pressed, though. Hope that's fine. :-)
--
Anton Berezin <tobez@plab.ku.dk>
The Protein Laboratory, University of Copenhagen
------------------------------
Date: Mon, 12 Jul 1999 13:11:13 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Checking for <STDIN>
Message-Id: <hj7dm7.vue.ln@magna.metronet.com>
christopher sean delaney (csdelane@students.uiuc.edu) wrote:
: I am trying to write a piece of code that will check STDIN for input but
: if there is none, for it to continue execution.
: Anyone have any ideas?
Here is a powerful idea that nobody seems to know about:
Check the Perl FAQ before posting to the Perl newsgroup!!
Perl FAQ, part 8:
"How do I check whether input is ready on the keyboard?"
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 12 Jul 1999 22:02:25 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Checking for <STDIN>
Message-Id: <slrn7olb18.h7.abigail@alexandra.delanet.com>
christopher sean delaney (csdelane@students.uiuc.edu) wrote on MMCXLI
September MCMXCIII in <URL:news:Pine.GSO.4.10.9907121449590.14126-100000@ux9.cso.uiuc.edu>:
``
`` I would like it if in the case of the user pressing either any key or
`` maybe just return, for it to break out of this while loop and update
`` itself again.
FAQ!
Abigail
--
perl -wlpe '}$_=$.;{' file # Count the number of lines.
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
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 V9 Issue 122
*************************************