Integrating XS code into Moose Class definition files
I have written a XS based Perl module which provides access to functions in a C Library - lets call it MyLib_XS for now. I want开发者_C百科 to move ahead from here by using these functions for defining methods in a Moose class. Of course, I can just use MyLib_XS;
inside my Moose Class definition module and call functions in my Class methods - everything works. However, I want to know if I can do better
Is it possible to to integrate my .xs file with my Moose-based Class and call functions implemented in the XS file from methods inside Class without using the intermediate module MyLib_XS.pm?
Any pointers to modules on CPAN that do this would be great too. Thank you
I'd say that it'd be cleaner, tidier, easier to read, and easier to change, to keep the Moose module separate from the XS module. Otherwise you're violating the single responsibility principle - your moose class both defines program behaviour and the XS interface.
精彩评论