Re: new package syntax, where do I return true?

[email protected] (Caleb Cushing) Sat, 2 Jul 2011 11:17:25 -0500
Newsgroups perl.documentation
Message-ID <CAAHKNREhM7bFPYCMCP-LgNqDYirUj5nz8frpq5ghQoLLz663Dg@mail.gmail.com>
On Sat, Jul 2, 2011 at 1:13 AM, Flavio Poletti <[email protected]> wrote:
> i.e. it advices you to return a true value from the *file*, not from the
> package. This seems to be confirmed by require's documentation:
>
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0 The file must return true as the last statement to indicate
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0 successful execution of any initialization code, so it's
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0 customary to end such a file with "1;" unless you're sure
> it'll
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0 return true otherwise.=C2=A0 But it's better just to put the "=
1;",
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0 in case you add more statements.
>
> Again, we're talking about the file, not any package inside.
>
> At this point, we could argue that putting the "1;" inside the block make=
s
> the whole code return a true value... but considering that the "1;" is
> file-related and that it seems difficult to handle properly in Perl::Crit=
ic,
> is this worth a crusade?

probably not, but I thought that this was the package that needed to
be returned true from and not the file. Now I understand. Thanks.

--=20
Caleb Cushing

http://xenoterracide.com