|P is for Practical|
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
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.
zz zZ Z Z #!perl
In reply to Re: Re: A simple example OO script for total beginners