[za-pm] perl highlight mode in gedit & Vim

James E Keenan jkeen at verizon.net
Wed Sep 29 19:14:35 PDT 2010


On Sep 29, 2010, at 3:22 PM, Anne Wainwright wrote:

> end of ever so much more perl code
> 1;
> __END__
>
> =head1 HEADING
>
> final pod comments
> more final pod comments
>


The __END__ is not needed in this example because there is no code  
following the __END__ which you might want to hide from the Perl  
Parser.  When the parser reaches '=head1', it knows it has reached  
POD and deals with it accordingly.

The simplest explanation of __END__ I could find is here:
http://www.platypiventures.com/perl/present/MakeModule/013.html

Depending on circumstances, the '1;' may not be needed, either.

The '1;' is merely the prototypical case of ending a file with a  
statement that Perl evaluates as true.  You could just as easily  
follow Mark-Jason Dominus' practice of ending a module with:

'cogito ergo sum';

You need to end the file with a statement that evaluates to true if  
and only if the file is going to be imported by 'use', 'require' or  
'do' into some other Perl program.  A '.pm' module you will download  
from CPAN typically ends with '1;' for this reason.  But a standalone  
Perl script doesn't need it.

Whether your file needs to end in a true statement or not, you can  
write POD following the final code statement.

Thank you very much.
Jim Keenan




More information about the Za-pm mailing list