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

Hello Monks,

I have written an XSUB method (and all of the bits around it) which works well when called from perl (as long as the path is specified using -I)

The reason that I wrote it was to use its functionality from catalyst. When I call it from catalyst, I'm informed that I have called an ``Undefined subroutine''. I am using exactly the same use and calling statement in both the test script and the Catalyst Controller.

Thanks for your time!

Replies are listed 'Best First'.
Re: Calling an XSUB method from Catalyst
by jettero (Monsignor) on Jun 02, 2009 at 15:22 UTC
    It's probably a perms issue. How did you install it? Where is it located? Can you build a module out of it to let ExtUtils::MakeMaker (or M::B, or M::I, or whatever) install it?

    UPDATE: The fact remains that Catalyst is just a bunch of perl modules, therefore, what works for your short script works for Catalyst. It's either a relative path issue or perms. There just aren't many other choices. There are obscure things like confusingly persistent scopes in mod_perl, but I doubt that's what's happening here.

    -Paul

      Thank you for your reply

      I'm not sure that it is a permissions issue. I'll be delighted if I am wrong though!

      I installed it using the Makefile rule make install_site having run perl Makefile.PL. I did adjust the output directories to exist in a known place in an SVN repository off my home directory - this was deliberate as the people working on this do not all have root access on their respective machines. The location is correctly given to perl in the -I argument. Removing the -I prevents the code from running at all, where as including it satisfies the interpreter, until the function is called.

      The permissions on the .so are 555. and the .ix and .bs are 444. I'm not sure what the purpose of the .ix and .bs are though.

      Everything else is a mix of 444 and 644 for the files; all of the directories are 755. Everything is owned by me:me all the way up and down the directory tree (until I get to /home).

      Thank you again for your time

        So the use statement in the catalyst program succeeds? Then its your code. You did somethingcatalyst->foo but you wanted myfooxswbar->foo.