Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

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

In reply to Re^3: Parsing a Hash by davorg
in thread Parsing a Hash by northwestdev

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    [1nickt]: How old are your sprogs marto?
    [marto]: 4, if they're good they#ll make it to 5 :P
    [1nickt]: Mpph didn;t have twins bu I remember thinking that the "terrible twos" was a misnomer as age 4 seemed to be much more difficult.

    How do I use this? | Other CB clients
    Other Users?
    Others having an uproarious good time at the Monastery: (9)
    As of 2017-11-18 18:43 GMT
    Find Nodes?
      Voting Booth?
      In order to be able to say "I know Perl", you must have:

      Results (277 votes). Check out past polls.