in reply to Re: Question regarding "require" or "use"
in thread Question regarding "require" or "use"
While that's true, that bit of the Camel refers to require Module;, not require "FileName";. In the first case, Perl will resolve a module name to a file path. In the second case, Perl will treat the string as a file path and attempt to resolve it accordingly. (I don't have the source in front of me, so I'll wave my hands over some DWIMmery — there may be a Perl_looks_like_plain_module_name() macro in play there.
To solve the original poster's problem, either solution one or two will work:
# solution 1 use lib '/path/to/bar/parent/directory'; use Bar; # solution 1b use lib '/path/to/bar/parent/directory'; BEGIN { require Bar; Bar->import(); } # solution 2 BEGIN { require "/path/to/bar/parent/directory/Bar.pm"; Bar->import(); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Question regarding "require" or "use"
by freddo411 (Chaplain) on Oct 02, 2003 at 21:30 UTC |