I don't have the backend to really test this on at the moment, but a quick thought... try printing out your data before you get into the whole unless() thing:

# at the top of the script use Data::Dumper; ... # later print Dumper $input; # or, sometimes more effective to ensure # that each var doesn't have newlines or other # nonsense for (qw(to from body)){ print "\n\n>$input->{$_}<\n\n"; } unless (($input->{to}) && ($input->{from}) && ($input->{body}) && ($in +put->{id})) {

...that'll show the specific var with a '>' before the text, and a '<' immediately after it. Say $input->{to} was steveb@cpan.org, it would (ie. should) show:

>steveb@cpan.org<

If you get no output because it's a webapp, open a file and dump the info:

open my $wfh, '>', '/home/user/debug.txt' or die $!; for (qw(to from body)){ print $wfh "\n\n>$input->{$_}<\n\n"; }

Rule 1: always ensure that the data you're using is exactly as you expect to be.

Also, when dealing with a web server, check the server's error logs; they often have valuable info for wtf went sideways.


In reply to Re: using json post in mysql stored procedure by stevieb
in thread using json post in mysql stored procedure by mhanna2755

Title:
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, details, 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, summary, 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.