Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: How to creater your own Perl modules/libraries?

by JadeNB (Chaplain)
on Nov 21, 2009 at 17:29 UTC ( #808605=note: print w/replies, xml ) Need Help??


in reply to Re: How to creater your own Perl modules/libraries?
in thread How to creater your own Perl modules/libraries?

This was an excellent post, but there's one caveat:

# Don't forget this: 1;
Note that this is not necessary. :-)

UPDATE: If you don't already know that this is a joke, then please ignore it, or your module-writing life will be harder than it needs to be. If you don't want to ignore it, then at least read perlmod and the linked page carefully to see why it's a joke.

Replies are listed 'Best First'.
Re^3: How to creater your own Perl modules/libraries?
by newbie01.perl (Sexton) on Nov 23, 2009 at 10:36 UTC

    Hi,

    Just want to confirm that the 1; is not necessary?

      I probably should have been more careful. It is necessary that your module return something true, and the easiest way to make sure that it does is to put 1; at the end of the source file *. All that I was saying was that what is actually returned may be anything true, including 1, "I'm a true string", or [ qw/references are always true/ ].

      To put it briefly: don't leave off the 1; at the end without a good reason (although the good reason may be “I thought of something funnier”). If you do leave it off, then do a simple test import of your module just to make sure that it can be done.

      * To be precise, this requires that you haven't done something tricky earlier, like returning earlier in the source file.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (1)
As of 2021-05-12 05:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (124 votes). Check out past polls.

    Notices?