[6988] in Perl-Users-Digest
Perl-Users Digest, Issue: 613 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 16 02:07:43 1997
Date: Sun, 15 Jun 97 23:00:22 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 15 Jun 1997 Volume: 8 Number: 613
Today's topics:
Re: [HELP] Perl on WindowsNT 4.0 Problem... <tamcgee@ibm.net>
Best port of Perl 5 for DOS? (Mark E. Crane)
Re: Breaking out of a while. <jbokma@caiw.nl>
Re: Case Conversion (Dean Inada)
cgi form library problem (Chris Fogarty)
Re: Comparing dates. (J.B. Nicholson-Owens)
Re: DBM <@bender.com>
Re: DBM <zenin@best.com>
Does perl version matter? (Rick Freeman)
Re: ENVIRONMENTAL VARIABLES...... how do you access the (Tung-chiang Yang)
File Permissions for Counters etc <cgprice@austin.ibm.com>
Re: File Permissions for Counters etc (Abigail)
Here is some Source Code <chizl@cyberdude.com>
Mailing in Perl <amerar@unsu.com>
Re: multiple white spaces <jbokma@caiw.nl>
Re: Perl error (Tad McClellan)
Re: Perl to awk translator <merlyn@stonehenge.com>
Re: PLEASE HELP: Problems with using perl to generate H (Abigail)
Re: PLEASE HELP: Problems with using perl to generate H <perlprogrammer@hotmail.com>
Re: question on session management in cgi in perl <rootbeer@teleport.com>
Re: regexp question: greener than godzilla... (Clay Irving)
Re: Repost form data? message. How to get rid of it? (Abigail)
Re: Search & Replace Multiple Lines (Clay Irving)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 13 Jun 1997 23:10:22 -0400
From: Tom McGee <tamcgee@ibm.net>
Subject: Re: [HELP] Perl on WindowsNT 4.0 Problem...
Message-Id: <33A20B9C.7CEE@ibm.net>
The solution for me was that cgi.pm goes in the lib subdirectory, not in
the perl5 directory itself.
--Tom McGee
tamcgee@ibm.net
1h@g:@ wrote:
>
> Hello?
>
> Please Help ME!!! -_-;
>
> I have some problem whit Perl CGI on WindowsNT 4.0.
>
> I have installed Website 1.2 on WindowsNT4.0.
>
> And Perl5 too...
>
> When I execute follwing code on web.. I receive right output...
>
> code------------------------------------------------------------
> print "Content-type: text/html\n\n";
> print "helpme!!";
>
> output----------------------------------------------------------
> helpme!
> ----------------------------------------------------------------------
>
> but after is install CGI.pm, and I use that package...
>
> code------------------------------------------------------------
> use CGI;
>
> print "Content-type: text/html\n\n";
> print "helpme!!";
>
> output----------------------------------------------------------
> 500 Server Error
>
> The server encountered an internal error or misconfiguration and was
> unable to complete your request.
>
> Message: CGI output from C:/WebSite/cgi-shl/test3.pl contained no
> blank line separating
> header and data
>
> Please contact the server administrator at jbkim@cnt.co.kr and inform
> them of the time the error occured, plus
> anything you know of that may have caused the error.
> ----------------------------------------------------------------------
>
> What mistake I have?
>
> Please Help me!!!!
>
> My Address jbkim@cnt.co.kr
>
> I'm korean.. and here is korea...
> I'm sorry My Dumb English....
------------------------------
Date: 15 Jun 1997 23:29:18 GMT
From: mecran01@homer.louisville.edu (Mark E. Crane)
Subject: Best port of Perl 5 for DOS?
Message-Id: <5o1tse$gdb$1@hermes.louisville.edu>
Hi, I was wondering if someone could recommend the most stable port of
Perl 5 for DOS. I'm a rank beginner with a Dummies book...
Mark Crane
--
______________________________________________________
The oppressors do not perceive their monopoly on *having more* as a
privilege which dehumanizes others and themselves. They cannot see that,
in the egoistic pursuit of *having* as a possessing class, they suffocate
in their own possessions and no longer *are*; they merely *have*.
-Paulo Freire, _Pedagogy of the Oppressed_
------------------------------
Date: 12 Jun 1997 22:01:58 GMT
From: "John Bokma" <jbokma@caiw.nl>
Subject: Re: Breaking out of a while.
Message-Id: <01bc777c$66022d40$cc0ab2c2@tschai>
William Rozmiarek <wdroze@news.dct.com> wrote in article
<5nka38$kll$1@gbol.dct.com>...
> How do I abort out of a while(){} statement?
>
> I need to do something like this:
>
> while (<S>) # S is an open socket
> {
> chop;
> print;
> if ($_ eq ".")
> {
> exit_out_of_this_while_loop;
> }
> }
>
> As long as S (an open socket) is open, the while loop won't finish.
> I need to come to the end of a block of text (ending with a "."),
and continue with the open socket.
>
> The only way I can break this loop is to close S but I'm not going
to open and close the socket for each bit of text I'm retrieving.
>
> Any simple way to blast out of a while statement?
last. so replace exit_ ... _loop; with last; (hmm, this is almost
some obfuscated perl, what I
mean:
while (<S>)
{
chop;
print;
last if $_ eq ".";
}
John
--
----------------------------------------------------------------------
Need a Freelance Software Developer (MSc)? (CGI, Perl, Java, C, C++)
http://www.caiw.nl/~jbokma [Java demo's, Curriculum Vitae and
more...]
email: jbokma@caiw.nl phone: +31 10 4291827
------------------------------
Date: 14 Jun 1997 04:29:02 GMT
From: dmi@deltanet.com (Dean Inada)
Subject: Re: Case Conversion
Message-Id: <5nt6me$iot$1@news01.deltanet.com>
In article <tcyangEBG1KF.D3x@netcom.com>,
Tung-chiang Yang <tcyang@netcom.com> wrote:
>Well, if you feel he/she is doing his/her homework, this should be good
>enough for him/her :)
>
>==============================
>Tom Phoenix typed when the mommy tyrannosaurus found him/her:
>: On Fri, 6 Jun 1997, Tung-chiang Yang wrote:
>
>: > tr/A-Za-z/a-zA-Z/;
>
>: That's not going to work on accented characters.
>
Since the homework is probably due by now, it should be safe
to reveal the answer:
$_ ^= lc($_) ^ uc($_);
------------------------------
Date: Sat, 14 Jun 1997 11:48:44 -0400
From: ctf@faithquest.com (Chris Fogarty)
Subject: cgi form library problem
Message-Id: <v03102800afc86dc66e4a@205.199.35.58>
The following is a library and a form script, but they do not work, and I
cannot for the life of me figure out what the problem is. The Form does not
seem to get the array from the library. Can someone help? If someone can
help, could you also email me an answer directly to ctf@faithquest.com
Christopher Fogarty
This is the forms-lib.pl
++++++++++++++++++++++++++++
#!/usr/sbin/perl
sub GetFormInput {
local (%input);
$input = &ReadInput();
%input = &ParseInput($input) if $input;
return (%input);
}
sub ReadInput {
local ($method, $input, $length);
$method = $ENV{'REQUEST_METHOD'};
if ($method eq 'GET') {
$input = $ENV{'QUERY_STRING'};
}
elsif ($method eq 'POST') {
$length = $ENV{'CONTENT_LENGTH'};
read(STDIN, $input, $length);
}
return($input);
}
sub ParseInput {
local($input) = @_;
local(@pairs);
@pairs = split('&', $input);
foreach $pair (@pairs) {
$pair =~ s/\+/ /g;
($key, $value) = split('=', $pair, 2);
$key =~ s/%(..)/pack("c",hex($1))/ge;
$value =~ s/%(..)/pack("c",hex($1))/ge;
$input{$key} .="\n" if defined($input{$key});
$input{key} .= $value;
}
return(%input);
}
return 1;
+++++++++++++++++++++++++++++++++++
This is the form
+++++++++++++++++++++++++++++++++++
#!/usr/sbin/perl
require('forms-lib.pl');
%input = &GetFormInput();
$recipient = $input{'address'} || "ctf\@the-machine.com";
$message = $input{'comments'}; || "did not work"
$sender = $ENV{'HTTP_FROM'} || "ctf\@the-machine.com";
$MAILER = "/usr/lib/sendmail";
open(MAIL, "|$MAILER -f$sender $recipient");
print MAIL "To: $recipient\n";
print MAIL "Subject: Comments on your web site\n";
print MAIL "\n";
print MAIL $message;
close(MAIL);
print "Content-type: text/html\n\n";
print <<"EndOfMessage";
<HTML>
<HEAD>
<TITLE> Site Comments</TITLE>
</HEAD>
<BODY>
<H1> Your Comments Were Sent</H1>
<PRE>
To: $recipient
Subject: Comments on your Web Site
$message
</PRE>
EndOfMessage
++++++++++++++++++++++++++++++++++++++++++
and this is the html file
++++++++++++++++++++++++++++++++++++++++++
<HTML>
<HEAD>
<TITLE> FeedBack</TITLE>
</HEAD>
<BODY BGCOLOR=WHITE>
<FORM ACTION="http://www.protos-inc.com/cgi/form.pl">
Please enter Email Address:
<br>
<strong>
E-Mail:
</strong>
<input type="text" name="address" Size=30 maxlength=50>
<p> Your Comments:
<br>
<textarea name="comments" rows=8 cols=50>
</textarea
<p>
<input type="submit" value="Send Comments">
</FORM>
</BODY
</HTML>
----- End Included Message -----
------------------------------
Date: Thu, 12 Jun 1997 17:08:45 -0500
From: jbn@pop-a-wheelie.midwest.net (J.B. Nicholson-Owens)
Subject: Re: Comparing dates.
Message-Id: <slrn5q0sn2.9hf.jbn@pop-a-wheelie.midwest.net>
Greg Bacon <gbacon@adtran.com> wrote:
> [Posted and mailed]
Out of curiosity, why tell this to everyone? I don't understand what I'm
supposed to get out of this when I wasn't the recipient of the e-mail.
> Well, if the dates are in ISO standard format, i.e. yyyy/mm/dd, then you
> can do this:
But if you'd like to avoid regex shenanigans and accept dates and times in a
variety of formats and languages, I suggest Date::Manip.
http://perl.com/cgi-bin/cpan_mod?module=Date::Manip
should get you the latest version on a CPAN site near you.
------------------------------
Date: Thu, 12 Jun 1997 17:16:49 -0700
From: murali <@bender.com>
Subject: Re: DBM
Message-Id: <33A09171.55A7@bender.com>
Monty VanEmmerik wrote:
>
> I'm working on a cgi that uses:
>
> dbmopen(%users,"users",0666) || die "Can't open users DBM file\n";
>
> When I run this script on our web server, when the data file is made, the
> server puts a '.pag' after the file name. It also creates a second file
> called 'filename.dir'. It doesn't do this on my Mac. On my Mac I use
> '0700' instead of '0666'.
>
> I'm new to DBM, and I'm trying to find a better way to store my guestbook data.
> Any thoughts on what's causing the suffix on the end of the file name, and
> the second file? Where can I learn more about DBM and Msql?
>
> To see the script go to:
> http://www.swfla.infi.net/~montyvan/docs/perl.html
>
> Please email me at: montyvan@swfla.infi.net
> Monty VanEmmerik
Read on tie(), untie()
------------------------------
Date: 15 Jun 1997 17:18:08 GMT
From: Byron Brummer <zenin@best.com>
Subject: Re: DBM
Message-Id: <5o184g$su3$1@nntp2.ba.best.com>
Monty VanEmmerik <montyvan@swfla.infi.net> wrote:
> dbmopen(%users,"users",0666) || die "Can't open users DBM file\n";
>snip<
> when the data file is made, the
> server puts a '.pag' after the file name. It also creates a second file
> called 'filename.dir'. It doesn't do this on my Mac. On my Mac I use
> '0700' instead of '0666'.
>snip<
> I'm new to DBM, and I'm trying to find a better way to store my guestbook data.
> Any thoughts on what's causing the suffix on the end of the file name, and
> the second file? Where can I learn more about DBM and Msql?
Dbmopen uses whatever DBM library is available on your system. Most
DBM librarys use two files per database, the .pag and .dir files you
notice. Your DBM lib on the Mac must be something other then NDBM,
SDBM, or the other similar ones.
Berkeley DBM (DB_File) and GNU DBM (GDBM_File) only use one file for
database. Your Mac lib is probably one of these. -They don't add
any extension to the file name.
Don't change the extensions if the lib automacticly puts them on for
you or you won't be able to open them. If you really don't like
having the two files, install GDBM_File or DB_File on your system.
-You'll have to install the gdbm or db C librarys first however.
All of these are available at your local CPAN:
http://www.perl.com/perl/CPAN
--
-Zenin
zenin@best.com
------------------------------
Date: Sun, 15 Jun 1997 18:01:18 GMT
From: Rick@MarinWeb.com (Rick Freeman)
Subject: Does perl version matter?
Message-Id: <33a428b5.11934229@nntp2.ba.best.com>
Hi all,
I'm trying to get Matt's wwwboard script running, but am having some
trouble. I'm new to perl and cgi, but have some programming
experience, followed all the directions correctly (a couple of times
now) and think I am avoiding all the basic errors (everything is
chmoded correctly, paths are all correct, etc.) I have been able to
succcessfully install another Matt script, the search script.
Wwwboard won't work, though.
When running the script, I can get a "no name" and "no subject" error
by leaving those fields blank, so I know it's getting that far at
least.
If I fill in all the fields I get a Server Error
Using the -c switch reports syntax OK. -w switch mentions possible
typos, trying to use unopened fliehandles, and uninitialized
variables. I am assuming all these are ok to ignore since they are in
areas of the downloaded script which have not been changed (all I have
changed is the configuration stuff at the top, and set the propper
path to perl at the very top).
I have a couple of questions...
(1)
"perl -v" says
This is perl, version 4.0
$RCSfile: perl.c,v $$Revision: 1.2 $$Date: 1993/12/22 17:08:26 $
Patch level: 36
Is that OK for this script? Is that old? Should I ask about getting
perl5 on my machine?
(2)
In the readme for wwwboard it shows a config setting $date_command =
"/bin/date", but in the script I downloaded (from
http://www.worldwidemart.com/scripts/) wwwboard.pl DOESN'T have that
line in it. Is that a problem? ( I went ahead and inserted it as the
readme seemed to indicate, but it made no difference.)
Anyhow, I would really appreciate any help with this -- I'd love to
use the script, but even more so, I would like to understand the
problem.
TIT
Rick Freeman
M a r i n W e b
Marin's Home on the World Wide Web
http://www.marinweb.com/
98 Main Street #453
Tiburon CA 94920
415-458-3201
------------------------------
Date: Thu, 12 Jun 1997 22:02:56 GMT
From: tcyang@netcom.com (Tung-chiang Yang)
Subject: Re: ENVIRONMENTAL VARIABLES...... how do you access them in your program
Message-Id: <tcyangEBonww.DJ5@netcom.com>
The Perl book did not make it clear -- but you cannot expect it to become
a 1-foot thick book. Use single quotes or double quotes to surround
REMOTE_USER like
$user = $ENV{'REMOTE_USER'};
Besides, it is a hash, so you should use {} to address %ENV.
==================================
rthomas typed when the mommy tyrannosaurus found him:
: I'm not sure how to pull the current environmental variables into my perl
: program. I tried the following:
: $user=%ENV(REMOTE_USER);
: $host=%ENV(REMOTE_HOST);
: also tried,
: $user=$ENV(REMOTE_USER);
: $host=$ENV(REMOTE_HOST);
: no good either way. The perl books don't make this very clear for a newbie
: but it seems as though the current environment is stored in an associative
: array %ENV and that you must associate a key (which is the name of the variable.
: ie %ENV(key).
: (deleted)
--
========= Try the low-crossposting robomoderated 'alt.culture.taiwan' ===
soc.culture.taiwan, soc.culture.china (by SCC FAQ Team) FAQ's:
http://www.iglou.com/tcyang/Taiwan_faq.shtml, China_faq.shtml
------------------------------
Date: Fri, 13 Jun 1997 16:07:14 -0500
From: Chris Price <cgprice@austin.ibm.com>
Subject: File Permissions for Counters etc
Message-Id: <33A1B682.2781@austin.ibm.com>
What do you have to set the file permissions of the directories,
files, etc to for a dbm file? Or a lock file? The following code
is causing me problems:
*********BEGIN*****
while (-f "counter.lock")
{
select(undef,undef,undef, 0.1);
}
open(LOCKFILE, '>counter.lock'); //|| die("Can't open counter.lock:
$!\n");
dbmopen(%COUNTERS, '/PATH/counterfile', 0777);
if (!(defined($COUNTERS{'index'})))
{
$COUNTERS{'index'} = 0;
}
$COUNTERS{'index'}++;
$count=$COUNTERS{'index'};
dbmclose (%COUNTERS);
close(LOCKFILE);
unlink('counter.lock');
******END*******
It works fine when I run it locally but the file permissions don't work
right when I run it via a browser. Thanks in advance for any help.
Chris Price
e-mail replies appreciated at cgprice@austin.ibm.com
------------------------------
Date: Sat, 14 Jun 1997 02:32:12 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: File Permissions for Counters etc
Message-Id: <EBqv1o.CoJ@nonexistent.com>
Chris Price (cgprice@austin.ibm.com) wrote on 1382 September 1993 in
<URL: news:33A1B682.2781@austin.ibm.com>:
++ What do you have to set the file permissions of the directories,
++ files, etc to for a dbm file? Or a lock file? The following code
++ is causing me problems:
That's a CGI problem. Every faq that mentions the letters CGI (any
order) handles this. Go ask in comp.infosystems.www.authoring.cgi, it
gets only asked 10 times a day there. They'll yell at you there too,
but at least it's on topic there.
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=$]*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: 16 Jun 1997 05:05:12 GMT
From: "Chizl" <chizl@cyberdude.com>
Subject: Here is some Source Code
Message-Id: <01bc7a11$e6b0a420$549112cf@default>
The Source Site
The ONLY Source Code Site that covers Any Platform and Any Language!
http://www.sourcesite.simplenet.com/
Get your source here for FREE and give some source code for others to use
and learn..
This site will soon be going under some major changes so it will be easier
for you to use and find what you need. At the moment I have the first
directories as platforms and then you find the language. I will be
changing this by making the Language the first directory and then the
Platform if the code is specifically made for it.
--
L8r,
Chiz
chizl@cyberdude.com
chizl@sourcesite.simplenet.com
The Source Site
http://www.sourcesite.simplenet.com/
The ONLY site for All platforms and all language source code in one place.
Take code and give code for FREE!
------------------------------
Date: Thu, 12 Jun 1997 18:53:09 -0500
From: Arthur Merar <amerar@unsu.com>
Subject: Mailing in Perl
Message-Id: <33A08BE5.334B@unsu.com>
Hello,
I am trying to write a Perl program that will send e-mail. All I get is
a dialog box that says 'Document contains no data'.
I have these commands in my program:
open(MAIL,"|$mailprog -t");
print MAIL "To: amerar\@unsu.com\n";
print MAIL "From: $FORM{'username'}\n";
print MAIL "Subject: $FORM{'subject'}\n\n";
print MAIL $FORM{'comments'}, "\n";
close (MAIL);
Am I missing something?
Thank you,
Arthur
amerar@unsu.com
------------------------------
Date: 12 Jun 1997 22:04:53 GMT
From: "John Bokma" <jbokma@caiw.nl>
Subject: Re: multiple white spaces
Message-Id: <01bc777c$ce4f8820$cc0ab2c2@tschai>
Tri Duy Tram <trit@olympic.seas.ucla.edu> wrote in article
<EBL6ru.9on@seas.ucla.edu>...
>
> I am wondering how do you change multiple white spaces to just one
single
> white space? Lets suppose I have a string
>
> $line = "This is a line that has multiple white space";
>
> to
>
> $line = "This is a line that has multiple white spaces";
>
> I tried:
> $_ = $line;
> s/^\s*(.*?)\s*$/$1/;
>
> but that gives me an error
> /^\s*(.?)\s*$/: nested *?+ in regexp
>
> any help will be appreciated. Thank you.
>
You can use tr, but I don't use it that much that I can tell you
how to use it from memory (I know it is able to compress many
thingies into one).
However, s/\s+/ /g; should do the trick. (g means global)
If you want to do it on $line, use: ($line = $line) =~ s/\s+/ /g;
John
--
----------------------------------------------------------------------
Need a Freelance Software Developer (MSc)? (CGI, Perl, Java, C, C++)
http://www.caiw.nl/~jbokma [Java demo's, Curriculum Vitae and
more...]
email: jbokma@caiw.nl phone: +31 10 4291827
------------------------------
Date: Fri, 13 Jun 1997 16:22:54 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Perl error
Message-Id: <endsn5.bu3.ln@localhost>
Thomas Lachlan XMS x4206 (etltsln@etlxd30.ericsson.se) wrote:
: Lennard Kong (lennard@carib-link.net) wrote:
: : Hi,
: : I've downloaded some Perl scripts,
: : however I get this error when running them:
: : Number found where operator expected at (eval 178) line 1, near ") 0"
^^^^
^^^^
: : (Missing operator before 0?)
: : The script still works however.
: : Any ideas ? I suspect it may be some kind of enviroment thing
: : however I am not a Perl expert.
: : Thanks much
: : Lennard
: Hi Lennard,
: Could you post the relevent extracts from your code.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
These would be any eval()s you have in there...
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: 13 Jun 1997 17:18:44 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: martin.roeth@mail.heyde.de
Subject: Re: Perl to awk translator
Message-Id: <8crae611gb.fsf@gadget.cscaper.com>
>>>>> "Martin" == Martin Rvth <martin.roeth@mail.heyde.de> writes:
Martin> Hello,
Martin> I'm looking for an easy method to translate perl scripts to awk. I know
Martin> about the a2p translator, but is there something like a p2a translator.
It's not possible. Perl is a semantic superset of awk. You can go
the other way almost mechanically because awk is, well, a subset of
Perl.
Can we ask, why you need such a translator?
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 444 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Sat, 14 Jun 1997 02:40:06 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: PLEASE HELP: Problems with using perl to generate HTML.
Message-Id: <EBqvEu.DEo@nonexistent.com>
Temporary Account (cgprice@austin.ibm.com) wrote on 1382 September 1993
in <URL: news:33A1AE8C.41C6@austin.ibm.com>:
++ Hi.
++
++ I have written a perl script to generate my home page. The script is
++ supposed to open a DBM file, read/update my "hits" counter, and then
++ generate the HTML page using the information from above. I am having a
It's a very well known problem. Probably 95% of the problems with
CGI are this problem. Any faq containing the letters c, g, and i
somewhere mentions this and offers solutions. No doubt this question
is asked 10 times a day in the CGI group.
Why, oh why, don't you:
- Read some basic information?
- Read the faq?
- Read the server error log?
- use CGI; with debuggin options?
- Ask in the appropriate group?
I know the answer, and I could give it one or two lines.
But it's much better if you find out for yourself where
to find the answer.
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=$]*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: Sat, 14 Jun 1997 01:11:45 -0700
From: perl guy <perlprogrammer@hotmail.com>
Subject: Re: PLEASE HELP: Problems with using perl to generate HTML.
Message-Id: <33A25241.351D@hotmail.com>
perl guy wrote:
>
> Temporary Account wrote:
> >
> > Hi.
> >
> > I have written a perl script to generate my home page. The script is
> > supposed to open a DBM file, read/update my "hits" counter, and then
> > generate the HTML page using the information from above. I am having a
> > strange problem--when I run the script from the command line, it works
> > fine. The dbm file is updated properly, and the output that comes up on
> > my screen is correct. It has a Content-type header with a blank line
> > after it, and then my html document.
> >
> > The problem is, when I call the script through a browser (netscape), it
> > seems to be totally ignoring any commands that aren't "print"
> > statements. If I don't put the "print" statements right at the top
> > (which I can't, since I need to process some info first), the browser
> > spits up this message:
> >
> > "Internal Server Error
> >
> > The server encountered an internal error or misconfiguration and was
> > unable to complete your request."
> >
> > If I move the print statements to the front, and put the processing
> > commands at the end of the script, then the browser reads the HTML file
> > properly and displays the page--HOWEVER, the other commands do not get
> > executed at all. The DBM file is not opened or modified at all. (I've
> > checked the time stamp). If I run the SAME script from the command
> > line, it updates the DBM just fine.
> >
> > If I split the script by putting some print statements at the top,
> > followed by the processing commands, followed by the rest of the print
> > statements, the browser reads the first print statements, and once it
> > reaches the end of them, it immediately kills the execution of the
> > script. Neither the processing commands NOR the remaining print
> > statements are executed.
> >
> > I have even toyed briefly with the $| variable, which is supposed to
> > control print buffering, but whether it is set to 1 or 0 I get the same
> > results.
> >
> > If anyone has any idea how to solve this problem or what might be
> > causing it, I would really appreciate a response, preferably by e-mail
> > since I don't always have time to check the newsgroups. I'm growing a
> > bit desparate.
> >
> > I will include the meat of the script below.
> >
> > Thanks in advance for your time and help.
> >
> > Chris Price (cgprice@austin.ibm.com, c.price@mail.utexas.edu)
> >
> > ***********BEGIN PASTE**********
> >
> > #!/usr/local/bin/perl
> >
> > $number_of_digits = 6;
> >
> > #OPEN THE ACCESS COUNTER FILE AND INCREMENT THE COUNTER
> >
> > while (-f "counter.lock")
> > {
> > select(undef,undef,undef, 0.1);
> > }
> > open(LOCKFILE, '>counter.lock') || die("Can't open counter.lock: $!\n");
> > dbmopen(%COUNTERS, '/PATH/counterfile', 0777);
> > if (!(defined($COUNTERS{'index'})))
> > {
> > $COUNTERS{'index'} = 0;
> > }
> >
> > $COUNTERS{'index'}++;
> >
> > $count=$COUNTERS{'index'};
> >
> > dbmclose (%COUNTERS);
> > close(LOCKFILE);
> > unlink('counter.lock');
> >
> > $formatted_count=sprintf("%0${number_of_digits}d",$count);
> >
> > #THE FOLLOWING LOOP JUST CREATES A STRING TO EXECUTE AT THE SHELL
> > # WHICH WILL BE USED TO CREATE A GIF OF THE COUNTER
> > $make_img_comm = "/PATH/makeImage ";
> >
> > for ($i = 0; $i < $number_of_digits; $i++)
> > {
> > $make_img_comm .= substr($formatted_count, $i, 1);
> > $make_img_comm .= " ";
> > }
> >
> > #THE FOLLOWING COMMAND WILL CALL A PROGRAM THAT USES THE GD
> > #GRAPHICS LIBRARY TO GENERATE AN IMAGE ON-THE-FLY
> > `$make_img_comm`;
> >
> > open(DEBUG, '>>debug.index');
> > printf DEBUG "The counter is: $formatted_count\n\n";
> > close(DEBUG);
> >
> > $|=0;
> >
> > print "Content-type: text/html\n\n";
> > print << "EOP";
> > <HTML>
> > #BODY REMOVED FOR THE SAKE OF BREVITY
> > </HTML>
>
> Hi.. just curious.. did you forget to include the end "EOP" at the
> bottom of your script sample?.
> print "Content-type: text/html\n\n";
> print << "EOP";
> <HTML>
> #BODY REMOVED FOR THE SAKE OF BREVITY
> </HTML>
> EOP
>
> Please inform me.. that would cause an error.. if not, I assume not,
> then I can give you a better opinion of what to do.. but right there,
> you have an error..
PS: Don;t get me wrong. I am in no way saying that is your problem. :o)
------------------------------
Date: Sat, 14 Jun 1997 18:40:52 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Hui Chun Kit <jackyhui@cuhk.edu.hk>
Subject: Re: question on session management in cgi in perl
Message-Id: <Pine.GSO.3.96.970614183343.10719A-100000@kelly.teleport.com>
On 14 Jun 1997, Hui Chun Kit wrote:
> I want to ask a simple question cencerning cgi.
Then you want to find a newsgroup about CGI. That's not this one, since
this newsgroup is about nothing but Perl (even though Perl may be used to
implement the CGI protocol). Good luck!
news:comp.infosystems.www.authoring.cgi
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 12 Jun 1997 09:45:07 -0400
From: clay@panix.com (Clay Irving)
Subject: Re: regexp question: greener than godzilla...
Message-Id: <5nouh3$3ll@panix.com>
In <01bc76b1$43728980$5ae004d0@kennyv> "Ken Van Allen" <kennyv@montana.com> writes:
> I've been racking my brains to find a regexp that will replace ALL
>instances of a given character in a line, and not just the first! I know
>this must be relatively simple. I've been through the FAQ, CPAN, and other
>resources, but can't seem to hit upon what I want. I would appreciate any
>help...
Could it be a simple as this?
#!/usr/local/bin/perl
$line = "I've been racking my brains to find a regexp that will replace ALL";
$line =~ s/a/A/g;
print "$line\n";
Output:
I've been rAcking my brAins to find A regexp thAt will replAce ALL
--
Clay Irving See the happy moron,
clay@panix.com He doesn't give a damn,
http://www.panix.com/~clay I wish I were a moron,
My God! Perhaps I am!
------------------------------
Date: Sun, 15 Jun 1997 04:51:23 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Repost form data? message. How to get rid of it?
Message-Id: <EBsw5n.8A4@nonexistent.com>
Colleen (bricr01@execpc.com) wrote on 1384 September 1993 in
<URL: news:33A35E56.7976@execpc.com>:
++ I have a perl cgi script that at the end calls another html document.
++ The second document comes up fine, however, I am getting "Repost form
++ data?" from Netscape. If I answer "yes", my cgi script is re-executed by
++ the server resulting in a error message as the script was designed to
++ do. If I reply no, everything seems to be alright. Question: how can I
++ get rid of the "Repost" message without using expire or pragma headers
++ which I understand some browsers do not handle correctly.
Uhm, get a browser that doesn't follow RFC recommendations?
++ PS I have looked at the FAQS and have looked at several books to find
++ the answer. No luck.
It doesn't have _anything_ to do with Perl. Go ask in a browser group.
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=$]*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: 13 Jun 1997 23:13:16 -0400
From: clay@panix.com (Clay Irving)
Subject: Re: Search & Replace Multiple Lines
Message-Id: <5nt28c$jtl@panix.com>
In <339F445A.2897@shadow.net> David <dralph01@shadow.net> writes:
>Can someone tell me how to search and replace a string that spans
>multiple lines? I have been trying to do this for the last two weeks.
>Thanks,
>David Ralph
This:
#!/usr/local/bin/perl5.003
$string = "an";
$| = "";
while (<DATA>) {
s/$string/XX/g;
print;
}
__DATA__
Can someone tell me how to search and replace a string that spans
multiple lines? I have been trying to do this for the last two weeks.
Thanks,
David Ralph
Outputs this:
CXX someone tell me how to search XXd replace a string that spXXs
multiple lines? I have been trying to do this for the last two weeks.
ThXXks,
David Ralph
--
Clay Irving See the happy moron,
clay@panix.com He doesn't give a damn,
http://www.panix.com/~clay I wish I were a moron,
My God! Perhaps I am!
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 613
*************************************