in reply to Cannot subclass Gearman::XS::Client

I would guess that this line in Client.xs has something to do with it. It is explicitly setting the class to the package name.

As much as I dislike reblessing, perhaps implementing a new() method that calls SUPER::new with the passed parameters and then reblesses it into your class would work.

You could also use delegation, and store the G::XS::C object on your object and call it when needed. One benefit that this could give is that you can change out the underlying implementation and leave your API the same.

--MidLifeXis

Replies are listed 'Best First'.
Re^2: Cannot subclass Gearman::XS::Client
by incubusaurus (Initiate) on Jul 24, 2014 at 20:21 UTC
    Thanks. It looks as though you are right. Reblessing the object works, but I'll experiment with delegation too.