----- Original Message ----- From: "Erik Hollensbe" <[EMAIL PROTECTED]>
.
.
I never use
autosplit/AutoLoader in modules I write.. Hence the error was fairly cryptic
to me.

I'd call it "nonsensical" rather than "cryptic" :-)

Not sure where that "autosplit" error originates, but here's a fairly straightforward demo of the '.al' error and how to avoid it:

----------------------------
C:\_32\pscrpt>perl -MDigest::MD5 -e "Digest::MD5::rubbish(1)"
Undefined subroutine &Digest::MD5::rubbish called at -e line 1.

C:\_32\pscrpt>perl -MDigest::SHA -e "Digest::SHA::rubbish(1)"
Can't locate auto/Digest/SHA/rubbish.al in @INC (@INC contains: C:/perl58_M/lib
C:/perl58_M/site/lib .) at -e line 1
----------------------------

I'm not sure of the details relating to the explanation of the above difference - but it's related to the fact that SHA.pm assigns "Exporter" to @ISA, whereas MD5.pm does not. Consequently Digest::MD5 produced a sane error message, whereas Digest::SHA did not.

In my own modules, I now make sure that instead of doing:
------------------------------
require Exporter;
require DynaLoader;
@ISA = qw(Exporter DynaLoader);
------------------------------
I code it as:
------------------------------
require Exporter;
*import = \&Exporter::import;
require DynaLoader;
sub dl_load_flags {0} # Prevent DynaLoader from complaining and croaking
------------------------------

That way, the ridiculous error about a missing '.al' file won't crop up.

You'll see that SHA.pm uses the former approach, whereas MD5.pm uses the latter approach (though MD5.pm uses XSLoader instead of DynaLoader). Hence the difference in the error message.

Cheers,
Rob

Reply via email to