On 15 November 2015 at 09:02, Yonghua Peng <p...@cloud-china.org> wrote:
> There are ruby/java/python/go ports for librbd (ceph's rados block device, > see ceph.com), but there isn't perl's. > > For example, > > python's - > https://github.com/ceph/ceph/blob/v0.48.2argonaut/src/pybind/rbd.py > > ruby's - > https://github.com/ceph/ceph-ruby/blob/master/lib/ceph-ruby/lib/rbd.rb > > Can you show me how to ports that into perl language? I just want to create > a module called Ceph::Lib::Rbd. If you want to just do like that Python or Ruby does, you can use Perl modules like https://metacpan.org/pod/FFI https://metacpan.org/pod/FFI::Raw https://metacpan.org/pod/FFI::Platypus (I have never tried these modules, but I looked at the Ruby and Python code and wondered if the FFI thing was on CPAN, and found the above. It seems like the Raw and Platypus versions have several votes.) Perl XS is quite tricky since it requires understanding Perl internals like reference counting.