http://www.perlmonks.org?node_id=950998

david2008 has asked for the wisdom of the Perl Monks concerning the following question:

I am using the module XML::Easy::Text.
It writes that it has a c implementation with a pure perl backup.
How do i know on my machine if the module is using the c implementation or the pure perl backup?

  • Comment on how to identify if module is using the c interface

Replies are listed 'Best First'.
Re: how to identify if module is using the c interface
by Anonymous Monk on Jan 31, 2012 at 15:20 UTC

    Why would you care?

    You could check

    $ perl -MDDS -le " Dump\@DynaLoader::dl_modules " $ARRAY1 = [ 'B', 're', 'List::Util', 'B::Utils', 'Data::Dumper', 'IO', 'Fcntl', 'PadWalker', 'Data::Dump::Streamer', 'Hash::Util' ];
      $ perl -MDDS -le " print for grep /dll/i, %::" _<C:/perl/5.14.1/lib/MSWin32-x86-multi-thread/auto/B/B.dll *main::_<C:/perl/5.14.1/lib/MSWin32-x86-multi-thread/auto/B/B.dll _<C:/perl/site/5.14.1/lib/MSWin32-x86-multi-thread/auto/Data/Dump/Stre +amer/Streamer.dll *main::_<C:/perl/site/5.14.1/lib/MSWin32-x86-multi-thread/auto/Data/Du +mp/Streamer/Streamer.dll _<C:/perl/5.14.1/lib/MSWin32-x86-multi-thread/auto/Hash/Util/Util.dll *main::_<C:/perl/5.14.1/lib/MSWin32-x86-multi-thread/auto/Hash/Util/Ut +il.dll _<C:/perl/5.14.1/lib/MSWin32-x86-multi-thread/auto/Fcntl/Fcntl.dll *main::_<C:/perl/5.14.1/lib/MSWin32-x86-multi-thread/auto/Fcntl/Fcntl. +dll _<C:/perl/5.14.1/lib/MSWin32-x86-multi-thread/auto/Data/Dumper/Dumper. +dll *main::_<C:/perl/5.14.1/lib/MSWin32-x86-multi-thread/auto/Data/Dumper/ +Dumper.dll _<C:/perl/5.14.1/lib/MSWin32-x86-multi-thread/auto/IO/IO.dll *main::_<C:/perl/5.14.1/lib/MSWin32-x86-multi-thread/auto/IO/IO.dll _<C:/perl/site/5.14.1/lib/MSWin32-x86-multi-thread/auto/PadWalker/PadW +alker.dll *main::_<C:/perl/site/5.14.1/lib/MSWin32-x86-multi-thread/auto/PadWalk +er/PadWalker.dll _<C:/perl/5.14.1/lib/MSWin32-x86-multi-thread/auto/re/re.dll *main::_<C:/perl/5.14.1/lib/MSWin32-x86-multi-thread/auto/re/re.dll _<C:/perl/5.14.1/lib/MSWin32-x86-multi-thread/auto/List/Util/Util.dll *main::_<C:/perl/5.14.1/lib/MSWin32-x86-multi-thread/auto/List/Util/Ut +il.dll _<C:/perl/site/5.14.1/lib/MSWin32-x86-multi-thread/auto/B/Utils/Utils. +dll *main::_<C:/perl/site/5.14.1/lib/MSWin32-x86-multi-thread/auto/B/Utils +/Utils.dll
        Where can i find the DDS module?
        I don't find it in cpan
Re: how to identify if module is using the c interface
by ikegami (Patriarch) on Jan 31, 2012 at 21:36 UTC

    Module of this kind sometimes provide a function that indicates which version was loaded. That does not appear to the be the case here.

    Module of this kind usually split the PP and XS components into different modules. For these, you could test %INC for the XS version of the module. That's not the case here.

    So that leaves checking if the binary component of the module was loaded.

    use DynaLoader qw( ); use XML::Easy qw( ); warn "You may experience poor performance due to " . "the use of a Pure Perl build of XML-Easy.\n" if !grep $_ eq 'XML::Easy', @DynaLoader::dl_modules;