OK. Thanks, people. It works fine now :)
Tryst
-----Original Message-----
From: $Bill Luebkert [mailto:[EMAIL PROTECTED]
Sent: Wed 15/06/2005 11:00
To: Hughes, Trystan
Cc: [email protected]
Subject: Re: Issues with 'require' statement.
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?
You need to terminate your module with a true stmt - usually that means
adding a line at the end :
1;
You could also fix the front up a bit with something like:
use strict;
package main;
use Exporter();
our @ISA = qw(Exporter);
our @EXPORT = qw(sub0 sub1); # you can put the most frequent
subs here
our @EXPORT_OK = qw(sub2 sub3); # the rest here where you
explicitly have to include them
our %EXPORT_TAGS = (all => [EMAIL PROTECTED], @EXPORT_OK]); # you
can group subs here
our $VERSION = 0.01;
--
,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED]
(_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED]
/ ) /--< o // // Castle of Medieval Myth & Magic
http://www.todbe.com/
-/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
The views expressed in this e-mail are not necessarily the views of AssetCo
Group Limited,
its directors, officers or employees make no representation or accept any
liability for its accuracy or completeness unless expressly stated to the
contrary.
This e-mail, and any attachments are strictly confidential and intended for the
addressee(s) only.
The content may also contain legal, professional or other privileged
information. Unless expressly
stated to the contrary, no contracts may be concluded on behalf of AssetCo
Group Limited by means of
e-mail communication. You may report the matter by calling us on +44 (0)118 906
8000.
Please ensure you have adequate virus protection before you open or detach any
documents from this
transmission. AssetCo Group Limited does not accept any liability for viruses.
AssetCo Group Limited
is registered in England: Company number: 4450947
Registered Office: Davidson House, Forbury Square, Reading, Berkshire RG1 3GA
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs