Skip Menu |

This queue is for tickets about the Net-LibLO CPAN distribution.

Report information
The Basics
Id: 43454
Status: open
Priority: 0/
Queue: Net-LibLO

People
Owner: Nobody in particular
Requestors: karl.yerkes [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: add_method (undef, ...)
Date: Thu, 19 Feb 2009 19:58:02 -0800
To: bug-Net-LibLO [...] rt.cpan.org
From: Karl Yerkes <karl.yerkes [...] gmail.com>
The documentation states: "path is the OSC path to register the method to. If undef is passed the method will match all paths." However, in the code below, passing undef to add_method does not result in the method matching all paths. Also, your module tests do not test this. Could you check on this? I know you must be busy, but it would really help me out. -- karl #!/usr/bin/perl use warnings; use strict; use Net::LibLO; my $oscd = new Net::LibLO('7778'); $oscd->add_method(undef, undef, \&oscd); while(1) { my $bytes = $oscd->recv(); print "Recieved $bytes byte message.\n"; } sub oscd { print "called..\n"; }
RT-Send-CC: njh [...] aelius.com
I had the same issue but after a bit of digging around on the net I've managed to patch the XS code and module, the below patch will fix the issue. Hopefully Nicholas can add it into the code when he gets a chance. I looked at Net::OpenSoundControl first, but that seemed a lot slower, I assume it's written entirely in Perl, rather than the C of Net::LibLO. Anyway it's a very nice module, hopefully this patch will improve it further. I've not dealt with test scripts before, so I'll leave that to Nicholas or someone else. PN diff -urpN Net-LibLO-0.06/lib/Net/LibLO.pm Net-LibLO-Global/lib/Net/LibLO.pm --- Net-LibLO-0.06/lib/Net/LibLO.pm 2007-03-09 21:00:50.000000000 +0000 +++ Net-LibLO-Global/lib/Net/LibLO.pm 2011-08-23 20:34:49.000000000 +0100 @@ -103,7 +103,7 @@ sub add_method { # Check parameters carp "Missing typespec parameter" unless (defined $typespec); - carp "Missing path parameter" unless (defined $path); + #carp "Missing path parameter" unless (defined $path); #Allow undef for the global matchall carp "Missing handler parameter" unless (defined $handler); carp "Handler parameter isn't a code reference" unless (ref($handler) eq 'CODE'); #carp "Handle parameter isn't subroutine reference" unless (ref diff -urpN Net-LibLO-0.06/lib/Net/LibLO.xs Net-LibLO-Global/lib/Net/LibLO.xs --- Net-LibLO-0.06/lib/Net/LibLO.xs 2007-03-09 21:00:50.000000000 +0000 +++ Net-LibLO-Global/lib/Net/LibLO.xs 2011-08-23 20:30:49.000000000 +0100 @@ -353,11 +353,12 @@ lo_server_get_url( server ) lo_method lo_server_add_method( server, path, typespec, userdata ) lo_server server - const char* path + SV* path const char* typespec SV* userdata CODE: - RETVAL = lo_server_add_method( server, path, typespec, xs_liblo_handler, newSVsv(userdata) ); + path = SvOK(ST(1)) ? ((SV*)SvPV_nolen(ST(1))) : NULL; + RETVAL = lo_server_add_method( server, (const char*)path, typespec, xs_liblo_handler, newSVsv(userdata) ); OUTPUT: RETVAL