[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Very simple question



On Sat, Mar 11, 2000 at 12:58:39AM -0500, Paul N. Schatz wrote:
> 	I want to put a subroutine in a library which I create.  I create a
> file 'ill.pm' which I put in a folder named 'myMacPerl_library'. The file
> 'ill.pm' contains:
> package ill;
> sub say_hello {
>    print "hello world!\n";
> }
> 
> 	I add the path to the folder 'myMacPerl_library' to the paths to
> search for library modules.
> 
> 	I then try to access 'say_hello()' from a new Perl script.  It
> should be easy, but I can't seem to do it.  I tried a number of things
> without success.  For example,
> 
> 'use myMacPerl_library::ill();'
> 
> 	This gives the syntax error, "myMacPerl_library/ill.pm did not
> return a true value".
> 
> 	What is the correct way to go about this?


The magic 8-ball says:

Make ill.pm return a true value.


perldiag:

       %s did not return a true value
           (F) A required (or used) file must return a true value
           to indicate that it compiled correctly and ran its
           initialization code correctly.  It's traditional to
           end such a file with a "1;", though any true value
           would do.  See the require entry in the perlfunc
           manpage.


Ronald

P.S.  By convention, a module's name should start with a capital letter,
unless it's a pragma.

P.P.S.  'use diagnostics;' is often a useful pragma.

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org