in reply to require Math::XOR

Here are several solutions.

The ^ operator documented in perlop looks identical to xor_buf, so you don't need it at all.

Answering your original question, check whether this code to do a delayed use is cross-platform, but I think it should be:

unless ($INC{"Math/XOR.pm"}) { require Math::XOR; Math::XOR->import(); }
Or you can just live with the fact that require by itself doesn't do an import, and you can fully qualify the function name. Or you can do it manually as follows:
require Math::XOR; *xor_buf = \&Math::XOR::xor_buf unless defined &xor_buf;
Update: PodMaster is correct. I added the .pm that I was missing.

UPDATE 2: Gah. I missed :: to / as well. I swear I was thinking it as I typed it...

Replies are listed 'Best First'.
Re: Re: require Math::XOR
by PodMaster (Abbot) on Apr 09, 2004 at 06:30 UTC
    I think you mean
    unless($INC{'Math/XOR.pm'}) { ...
    (:

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.