Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Trying to load other perl scripts use() or require()

by gav^ (Curate)
on Jul 21, 2002 at 04:59 UTC ( #183777=note: print w/ replies, xml ) Need Help??


in reply to Trying to load other perl scripts use() or require()

Make sure your module returns a true value. The last line should be something like: 1;

gav^


Comment on Re: Trying to load other perl scripts use() or require()
Download Code
Re: Re: Trying to load other perl scripts use() or require()
by Anonymous Monk on Jul 21, 2002 at 05:11 UTC
    ty I dont remeber reading this in my book. so 1 is just like return(1);
Re: Re: Trying to load other perl scripts use() or require()
by dpuu (Chaplain) on Jul 21, 2002 at 05:16 UTC
    The value of any block in Perl is the result of the last statement in that block. If a block is a subroutine, then the result of the subroutine is the result of the block. You can use a "return" statement to exit the sub before the end; and at the end of the sub to be explicit about your intent. Modules are blocks. (Strangely, this doesn't apply to scripts: you have to use exit($value) to return a value from a script.) --Dave.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://183777]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2015-07-07 05:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (87 votes), past polls