Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Perl Module returning a not true value

by jjdraco (Scribe)
on Sep 04, 2002 at 05:30 UTC ( #194983=perlquestion: print w/replies, xml ) Need Help??

jjdraco has asked for the wisdom of the Perl Monks concerning the following question:

in my quest to learn perl, i've gone to the code section of this site and have read through some of the programs there in hopes to gain a better understanding of how real perl programs are written, in won such visit i came across a gameAI written by Falkkin. I thought that it was a really cool program and downloaded it so i could play with it. but to my disappointment it didn't work. woe is me :( i got a compile time error saying the module returned a not true value. i've looked at the code over and over again and i can't find any reason why it would do such a thing. my only conclusion is it has to be my system or the perl interpretor causing the error. I'm running Win2000 and ActivePerl

Thanks for any help offered


Replies are listed 'Best First'.
Re: Perl Module returning a not true value
by Zaxo (Archbishop) on Sep 04, 2002 at 05:45 UTC

    The true value the module is expected to return is on line 374 of the listing at A simple game AI that learns. The remainder of the file is a demo program which may either be clipped to a separate file or have package main; added to it where it stands. How have you installed the program and modules?

    The way the demo is written, the Modules should each be clippeed and saved as in the same directory as the demo (assuming ActivePerl has . in the lib search path). Each should end with the 1; as the last line of perl in the file.

    After Compline,

Re: Perl Module returning a not true value
by sauoq (Abbot) on Sep 04, 2002 at 05:47 UTC

    Check to be sure that you properly copied Make sure your copy ends with the line:


    "My two cents aren't worth a dime.";
      ok i see, i deleted that line thinking it was nothing. so all that line does is return a true value? Is that line always in a module?


        so all that line does is return a true value?


        Is that line always in a module?

        Almost always. As you discovered, the module has to return a true value when it is loaded. By convention, modules are usually ended with a "1;" to ensure that the required true value is returned. Any true value will do though.

        "My two cents aren't worth a dime.";
Re: Perl Module returning a not true value
by greenFox (Vicar) on Sep 04, 2002 at 08:04 UTC

    Zaxo and sauog have covered how to get gameAI going, if you want to find out some more about modules see tachyon's excellent Simple Module Tutorial

    Yeah I've been reffering to this tutorial a bit lately :)

    Until you've lost your reputation, you never realize what a burden it was or what freedom really is. -Margaret Mitchell

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://194983]
Approved by tadman
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (10)
As of 2021-01-22 14:11 GMT
Find Nodes?
    Voting Booth?