Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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

by nothingmuch (Priest)
on Dec 30, 2003 at 01:29 UTC ( [id://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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (10)
As of 2024-04-19 08:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found