in reply to WWW::Pusher - does not send a message

From your description of its behaviour and from the following part of the documentation
data can also be hash/arrayref. There should be no need to JSON encode your data.

it seems the module JSONizes the data structure for you. So, just specify a Perl structure:

my $response = $pusher->trigger( event => 'my_event', data => { message => 'Test message' +}, );
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: WWW::Pusher - does not send a message
by rkrasowski (Sexton) on Jun 14, 2015 at 19:13 UTC

    Thanks for help. No I understand what was the problem. Data was not correctly formatted in JSON. I corrected Pusher.pm module. It is not the most elegant way, but it works for me So far I checked simple data transfer, compex data - will do later.

    Corrected script: https://github.com/rkrasowski/pusher/

    Thanks like always for help Robert

      The source code of WWW::Pusher is on GitHub. You should have forked the repository and created a pull request to fix the problem.

      But I'm not sure you really fixed any issues. You replaced

      my $payload = to_json($args{data}, { allow_nonref => 1 });

      with

      my $message = "$args{data}"; my %rec_hash = ('message' => $message); my $payload = to_json (\%rec_hash, { allow_nonref => 1 });

      (with broken indentation). Which means, your version of the module can only send "message", while the original allows for any data to be sent (not knowing the module's purpose, I'm not sure it's desirable, though). The solution I provided does exactly the same.

      لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

        That is exactly the problem, I fixed enough to do what I want but problem is still there, therefore ,until I will fix it all it will be only in my git. Thanks for your help. Your suggestion helped. Robert