in reply to Re: More about module
in thread More about module

3 I may be missing something here, but I have never used, nor seen anyone else use, an include file in perl (one that wasn't a module, that is). I imagine you could do neat tricks with eval to include files in a script, though.

You are missing something:

require "c:/some_script.pl"; print some_func_from_some_script();

use Foo::Bar; is like BEGIN { require Foo::Bar } ie use is compile time, require is run time. You are just requiring in a file (the .pm is implicit as is the path which is assumed to be in @INC). See the docs.

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Replies are listed 'Best First'.
Re: Re: Re: More about module
by moodster (Hermit) on May 06, 2002 at 11:22 UTC
    Every day, you learn something new. :)

    But to be honest, I don't see why this should be better than putting your code in a proper module. It saves you the bother of messing around with Exporter, yes, but Exporter is your friend. Exporter wants to cuddle you and keep you safe from harm.

    Cheers,
    --Moodster

      Well, you could always define your subs in package main; :-)

      Joost -- ooh, i'm in an evil mood today :-)