Re: Need help with a simple (I think) Perl script



On May 29, 7:16 pm, Gunnar Hjalmarsson <nore...@xxxxxxxxx> wrote:
Bill H wrote:
I have noticed in my few years of reading this
group on a daily basis that a majority (whether large or slim) of the
questions seem to be concerning using perl in a cgi environment, but a
many of the answers to these questions seem to present solutions that
will not work in a cgi environment. For example the simple "die"
statement. If you use that in a cgi and call the perl from a web
browser you will get (or it has at least been my experience, I could
be wrong (and probably am)) a 500 internal server error.

While I agree that questions on programs aimed to run as CGI programs
are often and unnecessarily twisted by some regulars, the example you
give is not a good one. If you develop a Perl program in a CGI
environment, you'd better make it a habit to

     use CGI::Carp 'fatalsToBrowser';

It will make the browser display more meaningful error messages.

Gunar you are absolutly right on this. While I was typing the above I
wanted to type in "unless you use the CGI::Carp" but since I didnt
have the proper sytnax at hand I didnt want to type in the wrong
information (hence my "I could be wrong (and probably am)" :)


The other suggestion of installing this or using that module, not
everyone who is programming in perl for cgi has their own server or
has the ability of adding new modules to the server (fortunatly I do)
and have to work within the capabilities of the system they are
running on. So if they post a problem and there is a solution that
wouldn't require them installing a module, recommend it, instead of
just saying use blah::blah.

Sometimes when people say "can't" install this or that module, they
actually mean "don't know how to". For instance, I have never heard of a
situation when a pure Perl module can't be installed, in one way or
another. So encouraging people to learn how to make use of modules is
usually the right thing to do.

I am sure that is the case many times. Personal experience on my end,
working with a clients hosting provider (network solutions) we needed
to install a simple Perl API from their merchant gateway to calculate
sales tax. Since the client was in a shared hosting environment they
couldn't do it, the only solution provided by netsol was to upgrade to
a virtual server environment. I ended up just writing the code in
their Perl order processor to replicate the API's function.

Bill H


--
Gunnar Hjalmarsson
Email:http://www.gunnar.cc/cgi-bin/contact.pl

.