mherger wrote: 
> > Here is another funny use of the plugin:
> 
> Is this in some plugi of yours? You should probably share a little 
> information about what you're trying to do.
> 
> >      sub getAlbumMenu {
> >     my ($client, $cb, $params, $args) = @_;
> >     
> >     if ($params->{album}->{client}) { $client =
> $params->{album}->{client}; delete $params->{album}->{client}; } #Sven
> 2020-03-31
> 
> Why don't you send the $client reference as the first parameter (as 
> expected here), instead of putting it into $params? Problem solved, no 
> patching required, right?
> 
> > This changes the $client value.
> 
> It doesn't change it. It defines it. Which is required because you send
> 
> the "undef" value as $client.
> 
> -- 
> 
> Michael

>Is this in some plugi of yours?

It's my fork, feel free to try it.
https://github.com/Sveninndh/SqueezeboxQobuz

>Why don't you send the $client reference as the first parameter

Maybe I understand something fundamentally wrong with Perl.

Let me give you an example:

Take your code in Qobuz Plugin v2.1.0. *package Plugins::Qobuz::Plugin*
file *Plugin.pm* Line 414:

Code:
--------------------
    sub QobuzArtist {
        my ($client, $cb, $params, $args) = @_;
  
        Plugins::Qobuz::API->getArtist(sub {
                my $artist = shift;
  
                if ($artist->{status} && $artist->{status} =~ /error/i) {
                        $cb->();
                        return;
                }
--------------------


The first parameter is sub {}, this is the callback function right?

Now look in *package Plugins::Qobuz::API* file *API.pm* at line 136:


Code:
--------------------
    sub getArtist {
        my ($class, $cb, $artistId) = @_;
--------------------


$cb is the second parameter and you can verify that this is the first
parameter of the method call *Plugins::Qobuz::API->getArtist(sub {*

I thought that the first parameter always contained a pointer to the
object itself ($self, $class, $client ...) which is automatically
assigned by perl.


------------------------------------------------------------------------
sveninndh's Profile: http://forums.slimdevices.com/member.php?userid=69030
View this thread: http://forums.slimdevices.com/showthread.php?t=97146

_______________________________________________
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to