Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: Parsing a Hash

by davorg (Chancellor)
on Jul 22, 2009 at 08:05 UTC ( [id://782209]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Parsing a Hash
in thread Parsing a Hash

Well, I explained in the other thread what the problem is. The example code treats $results as an array ref but the show_user method returns a hash ref. You should get the (to my mind, really very clear) warning "Not an ARRAY reference".

Which leaves us wondering why you're not seeing this warning when you clearly have use warnings in your code. My suspicion is that you're looking in the wrong place. All of the CGI scaffolding in your code makes me think that you're running this as a CGI program. Depending on which web server you're using and how it is configured several things can happen to warnings from CGI programs. The most common effect is that they are written to the web server error log. Did you look in there?

You can force warnings and errors to be written to the browser by adding the following line to your code:

use CGI::Carp qw(fatalsToBrowser warningsToBrowser);

But remember to remove it again before putting the program into production.

It's also worth pointing out that just because your code is a CGI program, there's no reason why you shouldn't run it from your command line in order to try it out. I never put a CGI program onto a web server without running it from the command line first.

--

See the Copyright notice on my home node.

Perl training courses

Replies are listed 'Best First'.
Re^4: Parsing a Hash
by northwestdev (Acolyte) on Jul 22, 2009 at 12:04 UTC
    Thank you. Your post in the other thread, came a couple of hours after I started this one. I am running it as a CGI program. I have no access to the server error logs, so I will try forcing the fatal erros using CGI::Carp
      I have no access to the server error logs

      If people expect you to do serious development, then they need to give you a sensible development environment.

      Why not set up a web server on your local machine?

      I will try forcing the fatal erros using CGI::Carp

      It's not fatal errors we're talking about. It's warnings.

      --

      See the Copyright notice on my home node.

      Perl training courses

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://782209]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (1)
As of 2024-04-24 14:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found