Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

(crazyinsomniac) Re: is 1; at the end of a PM still necessary in 5.6.1 ?

by crazyinsomniac (Prior)
on Jul 22, 2001 at 09:15 UTC ( [id://98765]=note: print w/replies, xml ) Need Help??


in reply to is 1; at the end of a PM still necessary in 5.6.1 ?

From permod it says:
"1;  # don't forget to return a true value from the file"
a subroutine is a true value ;-)

I don't remember this not working in prior versions.

What exactly is the value of a subroutine?it's always true, i know that much ;)

My test code worked on all my ActivePerl and IndigoPerl installations, as well as, jcwren's machine.

package test2; require Exporter; use vars qw/@ISA/; @ISA = qw(Exporter); sub new { my $me = shift; return bless {},$me; } sub Ed_Guine { return -reverse oy}; __END__
and the test line: perl -Mtest2 -e"$_=new test2;print $_->Ed_Guine;"

update:
Apparently, what is happening is the return value is true, because @ISA = qw(Exporter); evaluates to true. I tested by inserting 0; in between the subs and such. MeowChow is right.

So, to avoid all this confusion, just make sure you have 1; before __DATA__ (or __END__ depending on what you use).

 
___crazyinsomniac_______________________________________
Disclaimer: Don't blame. It came from inside the void

perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;"

Replies are listed 'Best First'.
Re: (crazyinsomniac) Re: is 1; at the end of a PM still necessary in 5.6.1 ?
by John M. Dlugosz (Monsignor) on Jul 22, 2001 at 09:22 UTC
    So why did it work just fine when I did forget?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2024-04-19 09:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found