Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: require Math::XOR

by tilly (Archbishop)
on Apr 08, 2004 at 23:32 UTC ( #343801=note: print w/replies, xml ) Need Help??

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/"}) { 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/'}) { ...

    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.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://343801]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2023-06-03 05:00 GMT
Find Nodes?
    Voting Booth?
    How often do you go to conferences?

    Results (7 votes). Check out past polls.