View Single Post
  #10  
Old 01-10-2010, 05:24 AM
Derision
Developer
 
Join Date: Feb 2004
Location: UK
Posts: 1,540
Default

require does work.

If I put this in /tmp/myfunc.pl
Code:
sub MyFunc {
        quest::say("This is MyFunc().");
}

return 1;
And this in Guard_Bixby.pl

Code:
require ("/tmp/myfunc.pl");

sub EVENT_SAY {
        quest::say("Before call to MyFunc().");
        MyFunc();
        quest::say("After call to MyFunc().");
}
It works fine. Apparently you need the 'return 1' at the end of the required .pl file to tell Perl any initialisation code in that file executed OK, otherwise it returns this error:

Code:
/tmp/myfunc.pl did not return a true value at Guard_Bixby.pl line 1.
Reply With Quote