Integrating XS code into Moose class definition files

I wrote an XS-based Perl module that provides access to functions in the C Library - MyLib_XS is now called. I want to move on using these functions to define methods in the 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 integrate my .xs file with my Moose-based class and call functions implemented in the XS file from methods inside the class without using the intermediate module MyLib_XS.pm?

Any pointers to CPAN modules that do this would be good too. Thanks you

+3
source share
1 answer

I would say that it would be cleaner, tidier, easier to read and easier to change so that the Moose module is separate from the XS module. Otherwise, you violate the principle of single responsibility - your moose class defines the behavior of the program and the XS interface.

+4
source

Source: https://habr.com/ru/post/1783403/


All Articles