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

Dear Monks, perhaps you could help me with a problem I'm experiencing. I've broken up one of my modules using autosplit. All the proper .al and .ix seem to have been generated properly. When I use my module, I can access all the "preloaded" sub with no problem, but when I try to access one of the autoloaded ones, I get the dreaded "Undefined subroutine &My::Sub called at...". I can see the auto/My/Sub.al file, and it's in the autosplit.ix.

So what am I doing wrong? How can I even debug this? Am I supposed to add the auto directory to @INC? The POD didn't seem to suggest that, and I did not have to do this for a different module that was split in the exact same way...

TIA!

-- zigdon

Replies are listed 'Best First'.
Re: (z) Debugging AutoSplit and AutoLoader
by ysth (Canon) on Dec 02, 2003 at 23:10 UTC
    Can we see at least the header of your module? Are you correctly using AutoLoader::AUTOLOAD, either by importing it or by subclassing AutoLoader?

      Problem solved!

      Thanks ysth for making me look at the order of statements in the header (even if that wasn't what you had in mind). The problem was that the use AutoLoader line was before the Package statement. Once those were switched, everything started working!

      Thanks again!

      -- zigdon

Re: (z) Debugging AutoSplit and AutoLoader
by liz (Monsignor) on Dec 03, 2003 at 10:40 UTC
    <shameless plug>
    You might want to have a look at the load module, which has the same functionality as AutoLoader, without having to go through the rigamerole of AutoSplit and storing seperate files on disk.
    </shameless plug>

    Liz