Hughes, Trystan wrote:
> Hi all,
> 
> I have a file that simply contains a common set of functions,
> and wish to include this file across many scripts. Now, I use
> the following statements to do this...
> 
> eval "require 'F:\\SVN\\Scripts\\function_list.pl'";
> print "Unable to include script: function_list.pl: $@" if $@;
> 
> ... now with this 'function_list.pl' file I have function
> called 'create_email'. I call this function from with the
> script that has the above 'require' code in it and it works
> fine (in that it creates and sends an email) but the 'print'
> command runs and the statement 'Unable to include script:
> function_list.pl, did not return a value at (eval 1).' which
> is the second line of my require call above.
> 
> Why is it getting to this message when the function_list.pl
> file seems to be included fine, and the function within this
> file is executed fine?

My guess would be that the file does not return a true value (see
'perldoc -f require'). If you fix that, you probably won't need to put
the require in an eval. Most included files have "1;" at the end.

Also, consider making a module for your useful functions. It isn't that
difficult, and provides better control. See 'perldoc Exporter'.

HTH

-- 
Brian Raven
 


-----------------------------------------------------------------------
The information contained in this e-mail is confidential and solely 
for the intended addressee(s). Unauthorised reproduction, disclosure, 
modification, and/or distribution of this email may be unlawful. If you 
have received this email in error, please notify the sender immediately 
and delete it from your system. The views expressed in this message 
do not necessarily reflect those of LIFFE Holdings Plc or any of its subsidiary 
companies.
-----------------------------------------------------------------------


_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to