[13707] in Perl-Users-Digest
Perl-Users Digest, Issue: 1117 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 19 13:07:28 1999
Date: Tue, 19 Oct 1999 10:05:16 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <940352715-v9-i1117@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 19 Oct 1999 Volume: 9 Number: 1117
Today's topics:
"Setting locale failed..." ... say huh <rwilliamson@uno.gers.com>
Re: "Setting locale failed..." ... say huh (M.J.T. Guy)
Re: %hash array problem <aqumsieh@matrox.com>
Re: 'use FileHandle' fails if indirectly referenced fro (Kragen Sitaker)
Re: A simple question about Mail::Send (Randal L. Schwartz)
Re: A simple question about Mail::Send (brian d foy)
Re: Baffled! <aqumsieh@matrox.com>
Can I put ssi's in what my cgi prints? dterrors@my-deja.com
Re: Can I put ssi's in what my cgi prints? <amonotod@netscape.net>
Re: Can't get Perl working with Apache <jtribbeck@argogroup.com>
Re: Can't get Perl working with Apache <kevin.porter@fast.no>
Re: Can't get Perl working with Apache <kevin.porter@fast.no>
Re: Can't get Perl working with Apache (Kragen Sitaker)
Re: creating a list of unique records <sariq@texas.net>
Re: creating a list of unique records (Craig Berry)
Re: encryption and crypt() ? (Martin Vorlaender)
erorr output to browser? newsmf@bigfoot.com
Re: erorr output to browser? <gellyfish@gellyfish.com>
Re: erorr output to browser? (Brett W. McCoy)
Re: erorr output to browser? <amonotod@netscape.net>
Re: erorr output to browser? (Brett W. McCoy)
Re: erorr output to browser? <jboes@qtm.net>
formatting text with filling '.'s (Jared Evans)
Re: help with substrings <kpmonroe@unity.ncsu.edu>
Re: help with substrings <aqumsieh@matrox.com>
Help with TCP can't read error???? (Bob Mariotti)
Re: Ignore the idiots <aqumsieh@matrox.com>
Re: in the array or not? (Craig Berry)
Insolvable Timeout problem? <Tobias.Byron-Carlsson@ivf.se>
Re: making a directory <sariq@texas.net>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 19 Oct 1999 09:34:36 -0700
From: "Rusty Williamson" <rwilliamson@uno.gers.com>
Subject: "Setting locale failed..." ... say huh
Message-Id: <M41P3.80$A%6.8348@news.connectnet.com>
Hi!
Anyone have information on this error and what it might mean?
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings: LC_ALL
Thanks in advance!
Rusty
------------------------------
Date: 19 Oct 1999 16:57:23 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: "Setting locale failed..." ... say huh
Message-Id: <7ui7tj$d4g$1@pegasus.csx.cam.ac.uk>
Rusty Williamson <rwilliamson@uno.gers.com> wrote:
>Hi!
>
>Anyone have information on this error and what it might mean?
>
>perl: warning: Setting locale failed.
>perl: warning: Please check that your locale settings: LC_ALL
Whenever you get a message from Perl you don't understand (and even one
you think you do understand :-), look it up in 'perldiag'.
Then post here only if you don't understand what it says.
In this case:
perl: warning: Setting locale failed.
(S) The whole warning message will look something like:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LC_ALL = "En_US",
LANG = (unset)
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Exactly what were the failed locale settings varies. In
the above the settings were that the LC_ALL was "En_US"
and the LANG had no value. This error means that Perl
detected that you and/or your system administrator have
set up the so-called variable system but Perl could not
use those settings. This was not dead serious,
fortunately: there is a "default locale" called "C" that
Perl can and will use, the script will be run. Before
you really fix the problem, however, you will get the
same error message each time you run Perl. How to
really fix the problem can be found in the perllocale
manpage section LOCALE PROBLEMS.
Mike Guy
------------------------------
Date: Tue, 19 Oct 1999 09:58:05 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: %hash array problem
Message-Id: <x3yln8zbggj.fsf@tigre.matrox.com>
"Marc" <kwantm@convertis.nl> writes:
> I have got a problem. I have a hash array named %users I do not know what is
> in it and I want to print it. The following code I use:
>
> foreach (keys(%users)
> { print (" ");
> }
>
> What must I use in the print statement to print the contents of the hash
> array???
Please don't post trivially simple questions just because you are too
lazy to find the answer yourself. Hashes are one of the basic types in
Perl, and *any* decent Perl book will have more info than what you
request. You can even resort to on-line tutorials and documentation
(at www.perl.com) if you want.
Usenet has enough noise, please don't add to it. Moreover, looking up
the answer yourself is faster and much more useful than posting to
usenet and waiting for somebody to answer.
--Ala
------------------------------
Date: Tue, 19 Oct 1999 17:03:36 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: 'use FileHandle' fails if indirectly referenced from a setuid script
Message-Id: <Iv1P3.18385$E_1.1032877@typ11.nn.bcandid.com>
In article <7uhtii$b0r$1@nnrp1.deja.com>, aml <andrew.mclaren@swx.ch> wrote:
>Thanks for the notes. I wasn't aware of cgiwrap, so am having a look at
>this at present. It's not that clean needing a separate script for each
>user (sounds like the ongoing maintenance holes I try and avoid!), but
>it may work.
cgiwrap may not need a separate script per user; I'm not familiar with
it. suEXEC does. But a "script" that simply tells the server where to
find the Perl interpreter and the real script is probably not going to
be a maintenance headache unless you move said interpreter or script.
> On the suEXEC side, we use Netscape servers, and have only
>heard references to this in an Apache context. Does Netscape have an
>equivalent? (not really a Perl question I know!)
Dunno.
>On the setuid perl, I can find no signs of an sperl or suidperl on our
>systems (it's not my installation, so don't know much of the history).
>From looking at the config, it appears to have been built using the
>SETUID_SCRIPTS_ARE_SECURE_NOW option. Is the setuid emulator still
>installed in this case?
I don't think so -- I think that's what that option is for. But I
don't really know.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Tue Oct 19 1999
21 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: 19 Oct 1999 08:37:37 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: A simple question about Mail::Send
Message-Id: <m1aepftl8e.fsf@halfdome.holdit.com>
>>>>> "J-P" == J-P Theberge <jphil@act.oda.fr> writes:
J-P> Hi,
J-P> With Mail::Send, how can I change the From field?
Invoke "su" before calling your program.
:-)
Perhaps you want something besides Mail::Send, where the headers are
more controlled. There's only a dozen ways or so to send mail. :) See:
http://search.cpan.org/search?mode=module&query=mail
for many more ways.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Tue, 19 Oct 1999 11:54:28 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: A simple question about Mail::Send
Message-Id: <brian-1910991155120001@rtp-cr45-dhcp-170.cisco.com>
In article <m1aepftl8e.fsf@halfdome.holdit.com>, merlyn@stonehenge.com (Randal L. Schwartz) wrote:
>>>>>> "J-P" == J-P Theberge <jphil@act.oda.fr> writes:
>
>J-P> Hi,
>J-P> With Mail::Send, how can I change the From field?
>
>Invoke "su" before calling your program.
or be a trusted user, which might be a good thing on a completely
controlled box.
--
brian d foy
Perl Mongers <URI:http://www.perl.org>
CGI MetaFAQ
<URI:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: Tue, 19 Oct 1999 09:14:37 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Baffled!
Message-Id: <x3yn1tfbigy.fsf@tigre.matrox.com>
petolino@joe.Eng.Sun.COM (Joe Petolino) writes:
[please keep proper attributes of your quotes. I have no idea who you
are quoting right now]
> >A few weeks ago, I suggested that the use of a literal string as the
> >first argument to split() should draw a warning. If that were the case
> >(and assuming the programmer used '-w'), this incessant problem *might*
> >go away!
Might have been a good idea in the past, by I strongly disagree right
now. Adding this feature to '-w' will cause many already existing
good scripts to spit a lot of unnecessary warnings.
Backward compatibility has always been one of lwall's primary
concerns.
> Good idea. Is it even defined what happens when you use a literal string
> that can't be parsed as a regular expression match?
What do you mean? I can't think of any good examples.
> The documentation of
> split(), both in the Camel book and in perlfunc, says nothing about it
> except for the special case of ' '.
Could you give an example of what you mean?
HTH,
--Ala
------------------------------
Date: Tue, 19 Oct 1999 16:06:33 GMT
From: dterrors@my-deja.com
Subject: Can I put ssi's in what my cgi prints?
Message-Id: <7ui4tu$giq$1@nnrp1.deja.com>
I want put ssi's into the page that results from a cgi. (I know I know
I can just open the file within perl and print it, but I'm working in a
team and I want the html people to just be able to stick in ssi calls
without me having to change the script).
So, essentially, rather than my cgi printing html, I want it to print
shtml. Is there something I can do with the mime type? I tried
"Content-type: text/shtml\n\n" but it didn't work.
I guess if I can change the mime type, then this might not directly be
a perl question, but if I need to use some library then it would be...
I writing this in perl...
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 19 Oct 1999 16:44:37 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: Can I put ssi's in what my cgi prints?
Message-Id: <7ui75g$ibk$1@nnrp1.deja.com>
dterrors@my-deja.com wrote:
> I want put ssi's into the page that results from a cgi. (I know I
know
> I can just open the file within perl and print it, but I'm working in
There was recently a thread on this very subject, it was decided that
the answer was exactly what you just suggested. However, what you may
want to do, is use SSI to call your script from a regular .shtml page,
then then you can also call whatever includes your html programmers like
to throw in.
HTH, and HAND,
amonotod
--
`\|||/ amonotod@
(@@) netscape.net
ooO_(_)_Ooo________________________________
_____|_____|_____|_____|_____|_____|_____|_____|
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 19 Oct 1999 17:52:52 +0100
From: Jason P Tribbeck <jtribbeck@argogroup.com>
Subject: Re: Can't get Perl working with Apache
Message-Id: <380CA1E4.C7DFFAEB@argogroup.com>
kev wrote:
>
> Hi,
>
> I hope someone here can tell me what I'm doing wrong. I'm trying to
> configure Apache (on Linux) to run Perl CGI scripts. All I get at the
> moment is a "Internal server error" error in the browser when I try to
> run a Perl script from cgi-bin. The 'test-cgi' file (shell script) which
> came with Apache 1.3.9 does not produce an error.
>
> I have also tried addingan AddHandler file like:
>
> AddHandler cgi-script cgi pl
>
> to my httpd.conf file, but that makes no difference. What am I doing
> wrong?
This isn't a PERL question at all.
See http://www.apache.org/docs-1.2/misc/FAQ.html, section 13 "How do I
enable CGI execution in directories other than the ScriptAlias?"
Also, the default configuraton file actually has a working line in it.
Clue: You're missing '.' before the extensions.
--
Jason Tribbeck Argo Interactive ltd
Senior Design Engineer 7 Dukes Court, Chichester
West Sussex, PO19 2FX
Tel: +44 1243 815 815 Fax: +44 1243 815 805 England
------------------------------
Date: Tue, 19 Oct 1999 17:38:39 +0100
From: kev <kevin.porter@fast.no>
Subject: Re: Can't get Perl working with Apache
Message-Id: <380C9E8F.83F8F2AB@fast.no>
Kent Perrier wrote:
> kev <kevin.porter@fast.no> writes:
>
> > Hi,
> >
> > I hope someone here can tell me what I'm doing wrong. I'm trying to
> > configure Apache (on Linux) to run Perl CGI scripts. All I get at the
> > moment is a "Internal server error" error in the browser when I try to
> > run a Perl script from cgi-bin. The 'test-cgi' file (shell script) which
> > came with Apache 1.3.9 does not produce an error.
> >
> > I have also tried addingan AddHandler file like:
> >
> > AddHandler cgi-script cgi pl
> >
> > to my httpd.conf file, but that makes no difference. What am I doing
> > wrong?
>
> From what you describe, it sounds like you don't have the server configured
> correctly. Look at the documentation that should have come with the source
> distribution of apache.
Perhaps I should have mentioned, I followed the install instructions that came
with the distribution, and have also read the documentation, otherwise I
wouldn't be posting here. I also have the O'Reilly Apache book, which hasn't
solved this for me.
> A peek at the error log would probably provide a clue to the problem as well.
>
Ok, I should have posted the log file too. Two lines are produced when an
attempt is made to look at a URL that points to a perl script:
[Mon Oct 18 20:20:13 1999] [error] (8)Exec format error: exec of
/home/httpd/cgi-bin/test1.php3 failed
[Mon Oct 18 20:20:13 1999] [error] [client 127.0.0.1] Premature end of
script headers: /home/httpd/cgi-bin/test1.php3
What do you think?
- Kev
>
> Kent
> --
> Expect to be publicly mocked as long as you call yourselves "perl experts".
>
> - Abigail in slrn7qbcr6.r33.abigail@alexandra.delanet.com
------------------------------
Date: Tue, 19 Oct 1999 17:42:34 +0100
From: kev <kevin.porter@fast.no>
Subject: Re: Can't get Perl working with Apache
Message-Id: <380C9F7A.881864D2@fast.no>
Jason P Tribbeck wrote:
> kev wrote:
> >
> > Hi,
> >
> > I hope someone here can tell me what I'm doing wrong. I'm trying to
> > configure Apache (on Linux) to run Perl CGI scripts. All I get at the
> > moment is a "Internal server error" error in the browser when I try to
> > run a Perl script from cgi-bin. The 'test-cgi' file (shell script) which
> > came with Apache 1.3.9 does not produce an error.
> >
> > I have also tried addingan AddHandler file like:
> >
> > AddHandler cgi-script cgi pl
> >
> > to my httpd.conf file, but that makes no difference. What am I doing
> > wrong?
>
> This isn't a PERL question at all.
>
> See http://www.apache.org/docs-1.2/misc/FAQ.html, section 13 "How do I
> enable CGI execution in directories other than the ScriptAlias?"
That doesn't apply, because I'm not trying to execute scripts anywhere other
than the ScriptAlias. cgi-bin is the ScriptAlias'ed directory, which is where
I've put my Perl script.
>
> Also, the default configuraton file actually has a working line in it.
>
> Clue: You're missing '.' before the extensions.
>
Hmm, I'm pretty sure my example httpd.conf which came with the distribution
omitted the '.'
It's my home machine I'm having this problem with, I'll double check when I
get home.
- Kev
>
> --
> Jason Tribbeck Argo Interactive ltd
> Senior Design Engineer 7 Dukes Court, Chichester
> West Sussex, PO19 2FX
> Tel: +44 1243 815 815 Fax: +44 1243 815 805 England
------------------------------
Date: Tue, 19 Oct 1999 16:57:11 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Can't get Perl working with Apache
Message-Id: <Hp1P3.18369$E_1.1031880@typ11.nn.bcandid.com>
In article <380C9E8F.83F8F2AB@fast.no>, kev <kevin.porter@fast.no> wrote:
>Ok, I should have posted the log file too. Two lines are produced when an
>attempt is made to look at a URL that points to a perl script:
>
>[Mon Oct 18 20:20:13 1999] [error] (8)Exec format error: exec of
>/home/httpd/cgi-bin/test1.php3 failed
>[Mon Oct 18 20:20:13 1999] [error] [client 127.0.0.1] Premature end of
>script headers: /home/httpd/cgi-bin/test1.php3
>
>What do you think?
If it's a PHP page, it's not a Perl script, and is also not a CGI.
Take it out of the CGI directory and set up PHP so Apache knows what to
do with it.
The errors here suggest that it doesn't begin with #!, which also
suggests it's not a Perl script.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Tue Oct 19 1999
21 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Tue, 19 Oct 1999 11:06:19 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: creating a list of unique records
Message-Id: <380C96FB.7B5373D5@texas.net>
Steve Kirby wrote:
>
> creating a list of unique records:
>
> I'm looking for the most efficient way to go through a sorted list and
> print only one case of each unique record to a file.
>
perlfaq4
- Tom
------------------------------
Date: Tue, 19 Oct 1999 16:56:00 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: creating a list of unique records
Message-Id: <s0p8l0i7r0131@corp.supernews.com>
Michael Budash (mbudash@sonic.net) wrote:
: In article <s0nubbmcr0118@corp.supernews.com>, cberry@cinenet.net (Craig
: Berry) wrote:
: >Given that the original poster already has a sorted list, which they
: >presumably want to stay sorted, a hash might not be the best approach.
:
: true. never said "best" ... TMTOWTDI ...
Amen. Just trying to optimize within the solution space.
: i'm damn sure no expert, but here's another way that could conceivably
: take less resources than filling an array with acknowledged dupes,
: assuming the 'list' is actually read in from a file, which they often are:
:
: open (LIST, "list") or die ($!);
: while (<LIST>) { $hash{$_} = 1; }
: close LIST;
:
: foreach (sort keys %hash) { print; }
This will lose the input ordering unless you take some other step to
record it or recreate it. But it's certainly the case that you can
improve on reading the whole thing into memory.
--
| Craig Berry - cberry@cinenet.net
--*-- http://www.cinenet.net/users/cberry/home.html
| "They do not preach that their God will rouse them
a little before the nuts work loose." - Kipling
------------------------------
Date: Tue, 19 Oct 1999 18:28:40 +0200
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: encryption and crypt() ?
Message-Id: <380c9c38.524144494f47414741@radiogaga.harz.de>
Tom Phoenix (rootbeer@redcat.com) wrote:
: On Sun, 17 Oct 1999, Martin Vorlaender wrote:
: > Should one just warn against such violations of the calling standard,
: > or try to do something about it?
:
: I'd say: Don't sweat it too much. I was thinking of checking only that
: there are actually two args, and maybe that the salt is at least two chars
: long.
...or else make it at least two chars long (by duplicating the 1st salt char).
: > : And it should not export crypt() if the built-in is there (except
: > : maybe as a special debugging option).
: >
: > Done. It's regulated by $Crypt::UnixCrypt::OVERLOAD_BUILTIN (must be
: > set to true if $Config{d_crypt} to get the module's crypt function),
: > or by explicitely demanding the export of crypt().
:
: Hmmmm.... I'm not sure that I like that. Maybe it's the best thing. So,
: you're saying that these comments are correct?
:
: use Crypt::UnixCrypt; # imports crypt() if needed
:
: use Crypt::UnixCrypt qw/ crypt /; # imports always
Yup, that's how I intended it to work.
: Here's what I'm not sure about. Maybe (not likely, but maybe) we will add
: another function to this module someday. Let's call it "fred". Now someone
: who wants "fred" is likely to ask for qw/ fred crypt / and get the
: override when they don't want it, rather than remembering to ask for
: something like qw/ :standard fred /.
Only so that I get this right: the export tag 'standard' would have an
empty contents, or even '!crypt'?
: I think I'd prefer something like this (although maybe with a different
: keyword).
:
: use Crypt::UnixCrypt; # imports crypt() if needed
:
: use Crypt::UnixCrypt qw/ force_crypt /; # imports always
:
: force_crypt? override_crypt? import_crypt? I don't know what's best....
This should be an export tag, right? If it isn't: how do you get crypt
onto the export list when 'force_crypt' (or whatever) is on it?
My suggestion would be ':override_builtin' (the 'crypt' part is mentioned
two times in the module name already).
I've renamed the variable to set always-import mode to OVERRIDE_BUILTIN
already. But this isn't that elegant:
BEGIN { $Crypt::UnixCrypt::OVERRIDE_BUILTIN=1 }
use Crypt::UnixCrypt;
: > Done, though the test suite contains just the load test and one real
: > password check now. How many empiric tests would be enough?.
:
: I'd say this should do it. Adjust the $start as needed. I can't think of
: any major cases this doesn't cover, but it's easy to add them later.
Thanks for those.
cu,
Martin
--
| Martin Vorlaender | VMS & WNT programmer
OpenVMS: When you | work: mv@pdv-systeme.de
KNOW where you want | http://www.pdv-systeme.de/users/martinv/
to go today. | home: martin@radiogaga.harz.de
------------------------------
Date: Tue, 19 Oct 1999 15:13:13 GMT
From: newsmf@bigfoot.com
Subject: erorr output to browser?
Message-Id: <7ui1ps$e85$1@nnrp1.deja.com>
Wheen debugging perl cgi-scripts, how can I get the error output to
show up in the browser instead of just getting the generic "Internal
Server Error" message?
Thx for helping.
Marc.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 19 Oct 1999 16:24:38 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: erorr output to browser?
Message-Id: <380c8d36_2@newsread3.dircon.co.uk>
newsmf@bigfoot.com wrote:
> Wheen debugging perl cgi-scripts, how can I get the error output to
> show up in the browser instead of just getting the generic "Internal
> Server Error" message?
>
use CGI::Carp qw(fatalsToBrowser);
/J\
--
"We've even been asked to review a luxury hotel. I can't think why" -
Neil Hamilton
------------------------------
Date: Tue, 19 Oct 1999 16:10:22 GMT
From: bmccoy@foiservices.com (Brett W. McCoy)
Subject: Re: erorr output to browser?
Message-Id: <slrn80p67t.cp1.bmccoy@moebius.foiservices.com>
Also Sprach newsmf@bigfoot.com <newsmf@bigfoot.com>:
>Wheen debugging perl cgi-scripts, how can I get the error output to
>show up in the browser instead of just getting the generic "Internal
>Server Error" message?
>
>Thx for helping.
Put this at the top of your CGI script:
use CGI::Carp qw(fatalsToBrowser);
The documentation for CGI::Carp has more details on how to do this.
--
Brett W. McCoy bmccoy@foiservices.com
Computer Operations Manager (Alpha Geek) http://www.foiservices.com
FOI Services, Inc./DIOGENES 301-975-0110
---------------------------------------------------------------------------
------------------------------
Date: Tue, 19 Oct 1999 16:21:38 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: erorr output to browser?
Message-Id: <7ui5q3$hd1$1@nnrp1.deja.com>
In article <7ui1ps$e85$1@nnrp1.deja.com>,
newsmf@bigfoot.com wrote:
> Wheen debugging perl cgi-scripts, how can I get the error output to
> show up in the browser instead of just getting the generic "Internal
> Server Error" message?
There really is no way to do what you ask, because either your script
did not "compile" at runtime, or the server is not configured correctly
(Not likely if your other scripts run!), or you are not giving the
browser anything to display. Take a look at some examples I have at
http://www.geocities.com/amonotod , and notice how I always start with
an html header, so that regardless of my script, the browser gets
something to start with. The first option, that your script did not
compile, can be dealt with by either going to the command prompt, and
making sure to use -w and strict(). Check your web logs, they may help.
Good Luck,
amonotod
--
`\|||/ amonotod@
(@@) netscape.net
ooO_(_)_Ooo________________________________
_____|_____|_____|_____|_____|_____|_____|_____|
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 19 Oct 1999 16:41:26 GMT
From: bmccoy@foiservices.com (Brett W. McCoy)
Subject: Re: erorr output to browser?
Message-Id: <slrn80p823.cp1.bmccoy@moebius.foiservices.com>
Also Sprach amonotod <amonotod@netscape.net>:
> newsmf@bigfoot.com wrote:
>> Wheen debugging perl cgi-scripts, how can I get the error output to
>> show up in the browser instead of just getting the generic "Internal
>> Server Error" message?
>There really is no way to do what you ask, because either your script
>did not "compile" at runtime, or the server is not configured correctly
>(Not likely if your other scripts run!), or you are not giving the
>browser anything to display. Take a look at some examples I have at
>http://www.geocities.com/amonotod , and notice how I always start with
>an html header, so that regardless of my script, the browser gets
>something to start with. The first option, that your script did not
>compile, can be dealt with by either going to the command prompt, and
>making sure to use -w and strict(). Check your web logs, they may help.
The CGI::Carp module is useful in this regard, because it does provide a
way to print useful (and timestamped) diagnostic error messages to the
browser rather than just the web server error log (although you can still
have it write to the log).
--
Brett W. McCoy bmccoy@foiservices.com
Computer Operations Manager (Alpha Geek) http://www.foiservices.com
FOI Services, Inc./DIOGENES 301-975-0110
---------------------------------------------------------------------------
------------------------------
Date: Tue, 19 Oct 1999 16:38:41 GMT
From: Jeff Boes <jboes@qtm.net>
To: newsmf@bigfoot.com
Subject: Re: erorr output to browser?
Message-Id: <7ui6qe$i08$1@nnrp1.deja.com>
In article <7ui1ps$e85$1@nnrp1.deja.com>,
newsmf@bigfoot.com wrote:
> Wheen debugging perl cgi-scripts, how can I get the error output to
> show up in the browser instead of just getting the generic "Internal
> Server Error" message?
>
Several different ways. If you are using the excellent CGI.pm module,
just add this:
use CGI::Carp qw(fatalsToBrowser);
Alternatively, just reassign the STDERR file to STDOUT:
open (STDERR, ">&STDOUT");
Here are some additional resources that may help you (note that they
are FAQs, which should have been your first stop):
http://www.liquidsilver.com/scripts/debug101.html
http://htmlhelp.com/faq/cgifaq.html
http://htmlhelp.com/faq/cgifaq.html
http://support.pair.com/tutorials/cgidebug.html
--
Jeff Boes jboes@qtm.net
http://www.qtm.net/~jboes/
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 19 Oct 1999 17:00:01 GMT
From: jared@frontiernet.net (Jared Evans)
Subject: formatting text with filling '.'s
Message-Id: <7ui82h$10hm$1@node17.cwnet.frontiernet.net>
Hi,
Is there an easy way to produce this output:
Eggs..............$2.00
Bacon.............$3.00
One gallon Milk...$4.00
As you can see the prices are all lined up and the area between the
item and prices are filled with '.' instead of spaces.
I could do character counting and add the right number of dots to each line,
but am wondering if there was a dirty n' easy trick to do with with something
like Format?
Jared
------------------------------
Date: Tue, 19 Oct 1999 10:39:32 -0400
From: Kevin Monroe <kpmonroe@unity.ncsu.edu>
Subject: Re: help with substrings
Message-Id: <380C82A4.44838756@unity.ncsu.edu>
Thanks for the help guys (Jonathan, Martien, and Anand). I came back to work
this morning and looked at my code and realized just as you guys must have
noticed I must have been an idiot yesterday. I got it fixed but thanks again
for the help everybody.
>
------------------------------
Date: Tue, 19 Oct 1999 10:12:08 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: help with substrings
Message-Id: <x3yk8ojbft4.fsf@tigre.matrox.com>
Kevin Monroe <kpmonroe@unity.ncsu.edu> writes:
> I have a comma deliminated text file such as
>
> 121,Jimmy,Jones,0,1,21,555,89
> 1547,James,Johnson,155,87,6,1,301
> 14,Me,Again,12,197,0,22,1
>
> and so on
> all Im trying to do is get say the first and the third fields after the
> comma
Ok. Did you read the docs on split()?
> I have tried to split it over and over again but no matter what I try I
> get "use of uninitialized valued at line"
>
> here is the code albeit very simple
>
> #!/usr/local/bin/perl -w
>
>
> open(NEW, "< /path/to/file.txt") or die "Can't open file.txt: $!";
>
> @data = <NEW>;
Maybe you need to chomp() your data there to remove the trailing new
lines. That might not be desired depending on your application:
chmop (@data = <NEW>);
you can close NEW here if you so wish.
> foreach $element(@data){
> split(/,/, $line);
Assuming $line is defined (which it isn't!!), this should give you:
Use of implicit split to @_ is deprecated at - line xx.
split() returns an array. You are simply throwing the array away after
splitting. Perhaps you should save the values you want into variables.
> print $element;
> }
>
> close <NEW>;
>
>
> What I would like to be able to do here is get the say 1st,3rd and 5th
> entries following the comma. However $data[0] reveals the first full
> line commas and all. And since the length of each field varies using
> subst($line,0,1) will not work either
@data contains the lines from your file. That is what the line:
@data = <NEW>;
does. You didn't replace the contents of @data with anything else, so
they're staying the way they are. You should read the docs on split()
to see what is exactly happening. The following will do what you want:
foreach my $element (@data) {
my ($first, $third, $fifth) =
(split /,/, $element)[0, 2, 4];
print "Elements are $first and $third and $fifth.\n";
}
HTH,
--Ala
------------------------------
Date: Tue, 19 Oct 1999 17:00:42 GMT
From: bobm@cunix.com (Bob Mariotti)
Subject: Help with TCP can't read error????
Message-Id: <380ca0f9.17332172@news.earthlink.net>
Already searched the FAQ's and used deja, dogpile, etc.
All our cgi programming is done is perl. We keep getting the error
about opening too many files and lsof shows the following message:
"TCP can't read inpcg at 0x0000000" to about 2000 time per hour.
What in perl could be causing this? We are no idea and as our perl
cgi scripts are called from the server, we normally don't do anything
about it. Any suggestions are GREATLY APPRECIATED.
Bob Mariotti
Financial DataCorp
bobm@cunix.com
------------------------------
Date: Tue, 19 Oct 1999 09:01:59 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Ignore the idiots
Message-Id: <x3yogdvbj20.fsf@tigre.matrox.com>
"Nolen Johnson" <nolenj@worldnet.att.net> writes:
> Is Abigail a "he"?
No body knows for sure, the subject is highly open to debate. Some
theories indicate that Abigail is an alien from Venus. I personally am
convinced that Abigail is a really cool robot.
--Ala
------------------------------
Date: Tue, 19 Oct 1999 16:52:59 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: in the array or not?
Message-Id: <s0p8fb5r0140@corp.supernews.com>
Tom Briles (sariq@texas.net) wrote:
: Joe Zelwietro wrote:
: > print OUTPUT @allCheckouts." hi there\n";
:
: You are accessing the array in scalar context. See the docs for more
: info.
Oh, *nice* catch! I'd been reading that period as a comma all through
this thread.
--
| Craig Berry - cberry@cinenet.net
--*-- http://www.cinenet.net/users/cberry/home.html
| "They do not preach that their God will rouse them
a little before the nuts work loose." - Kipling
------------------------------
Date: Tue, 19 Oct 1999 18:31:23 +0100
From: Tobias Byron Carlsson <Tobias.Byron-Carlsson@ivf.se>
Subject: Insolvable Timeout problem?
Message-Id: <380CAAEB.307B4CDB@ivf.se>
I've got a timeout problem when a script that takes a long time get
abrupted with a timeout and in turn do not give results to a browser
(script works perfectly with telnet).
I've searched for hours on Internet and at
http://www.cpan.org/modules/by-module/XML/MSERGEANT/PSIntro.html#43ScriptTimeout
Property
I found this:
$Server->{ScriptTimeout} = $secs;
I do not know where or exactly how to write this or if I am allowed to
change it.
Can I just write a line in my script? How should it look like?
Anyone got an answer?
I'm in great need of help!
/Byron
------------------------------
Date: Tue, 19 Oct 1999 11:04:29 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: making a directory
Message-Id: <380C968D.E7BF1408@texas.net>
Jimtaylor5 wrote:
>
> I've been trying to make a directory with perl to no avail. I've read the perl
> FAQ and tried all these variations but no directory is created. Anyone know
> what I am doing wrong?
>
> #While in dir I tried this way
> mkdir (newone,077);
First, read perldoc -f mkdir.
Then find out what's in $!.
- Tom
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 1117
**************************************