Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Re: A simple example OO script for total beginners

by nothingmuch (Priest)
on Dec 30, 2003 at 01:29 UTC ( #317597=note: print w/ replies, xml ) Need Help??


in reply to Re: A simple example OO script for total beginners
in thread A simple example OO script for total beginners

The module has to return something to indicate success

I'd like to clarify. This is indeed not necessary for the class to work, but for perl to assume the inclusion of a file went well. When you do, use or require a file containing perl code, the value it returns to the caller is used to indicate proper loading, execution, or whatever the role of that code was. It is customary to end any perl code, especially that which is not a script pe se in a simple

1;

because this is not erroneous as using return is when there's nothing to return to (like in a simple script file), but does return truth when truth is needed, because in Perl the last value evaluated in some scope which returns (file, subroutine), is the return value.

In short, it's not necessary for the class to work, but it is necessary if the module which contains the class will be loaded via an external file inclusion, instead of being supplied in the same file.

-nuffin
zz zZ Z Z #!perl


Comment on Re: Re: A simple example OO script for total beginners
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2014-12-29 10:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (185 votes), past polls