Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: Perl Module ending without 1;

by linuxer (Curate)
on Jul 18, 2009 at 12:48 UTC ( #781322=note: print w/ replies, xml ) Need Help??

in reply to Perl Module ending without 1;

A module file must end return with a true value. And adding the 1; at the end is the easiest way to accomplish this.

If you don't do it, you have to hope, that your module code will always end with return a true return value... (Please don't hope... and please don't think, "my module will always do this...")

update: s/end/return/; sorry, used the wrong word for this... Thanks JavaFan

Comment on Re: Perl Module ending without 1;
Download Code
Replies are listed 'Best First'.
Re^2: Perl Module ending without 1;
by JavaFan (Canon) on Jul 18, 2009 at 19:36 UTC
    A module file must end with a true value.
    No, a module must return a true value. Many people don't realize that when a module is loaded with use, its code is actually run. Of course, if the module just contains subs, little code is run; but most modules assign a version number, set @ISA or @EXPORT/@EXPORT_OK. All these assignments wouldn't happen if the code in the module wasn't run.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2015-11-27 00:30 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (710 votes), past polls