develooper Front page | perl.documentation | Postings from July 2011

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

Thread Previous | Thread Next
From:
brian d foy
Date:
July 2, 2011 07:55
Subject:
Re: new package syntax, where do I return true?
Message ID:
020720110756211630%brian.d.foy@gmail.com
[[ This message was both posted and mailed: see
   the "To," "Cc," and "Newsgroups" headers for details. ]]

In article <BANLkTikBYCOVX60JyEJNh27ETNYODUXT=w@mail.gmail.com>, Caleb
Cushing <xenoterracide@gmail.com> wrote:

> Having a little debate over this on a Perl::Critic ticket. I'm not
> sure anyone is sure and the docs don't say.
> 
> https://rt.cpan.org/Ticket/Display.html?id=69234
> 
> 
> is it package foo { ... 1; }  or package foo { ... }; 1; ? or what?
> and is it possible this could get clarified in the next edition of the
> docs?

You don't need to return true from a package. You need to return true
from a use-d or require-d file so that the last statement in the file
returns true and perl knows it successfully loaded the file. It's
nothing to do with packages. You still need that true value even if you
have no packages declared in that file.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About