Reputation: 1
What is the difference between json and json::PP in Perl?
I meet this error when use Json and Json:PP when writing perl script in opensips
ERROR:core:XS_OpenSIPS__Message_log:
perl warning: Prototype mismatch: sub main::decode_json ($) vs none.
I have problem with these codes:
my %postObject = ("callId" => $callID);
$postObject{'endTime'} = time() . "";
$postObject{'key'} = "12345@qwerty";
my $post_data = encode_json \%postObject;
Upvotes: 0
Views: 124
Reputation: 3013
The "Prototype mismatch" warning typically means that you've defined a sub
twice in some way, and the two definitions' prototypes don't match.
Do you have a sub decode_json ($)
in your main code somewhere? If you do, I'd suggest removing or renaming it, because it is conflicting with decode_json
from one of the JSON
modules. If you don't, then you may be getting a second decode_json
from another module you are loading, in which case you'd have to track that down, or provide us with a Minimal, Complete, and Verifiable example.
I'd strongly recommend turning on warnings
, because then you will additionally get "Subroutine redefined" warnings to help you track the issue down.
Upvotes: 2