p-alik / perl-Gearman

9 stars 10 forks source link

Allow subclassing of Gearman::Client #3

Closed DarthEd77 closed 7 years ago

DarthEd77 commented 8 years ago

I'm an old school object-oriented programmer that still uses inheritance, so I subclassed Gearman::Client to make my own client that provides default settings for my project. Unfortunately, there's a line in Taskset.pm (in both the master and ssl branches) that requires the client object to be a reference to a Gearman::Client object and nothing else.

The fix is rather simple, of course. I changed

ref($client) eq "Gearman::Client"

to

(Scalar::Util::blessed($client) && $client->isa("Gearman::Client"))

Once I made that change in Taskset.pm, my Client subclass worked fine.

There might be other cases of 'ref($object) eq "Gearman::whatever"' in the code, but I am mainly interested in subclassing Gearman::Client.

p-alik commented 8 years ago

it's done as requested in https://github.com/p-alik/perl-Gearman/commit/ae7b18124cc9e1f2b897b55e8aa346872d32a62d in upstream.

p-alik commented 7 years ago

2.001.001-TRIAL should satisfy subclassing.

p-alik commented 7 years ago

the issue is done