Alister West

home is where your code is ...

Perl Module Template Tips

These are here to remind me.

Boilerplate

# Put a standard block at the top of each file and test for it.

# ============================================
#   Copyright (c) 2010  -  Alister West
# ============================================

Version line

# Prefered (note: find link to article on this)

# 'version' pod says to keep this all on one line
use version 0.77; our $VERSION = qv("v0.1");

# Acceptable
our $VERSION = '0.01';
$VERSION = eval $VERSION;

# Not advised
our $VERSION = 0.01;

Return True

Modules just want a true return value at the end.

# Boring    
return 1;
__END__

# Better?
return 'Better!';
__END__

Pod

# Put POD after __END__ 

__END__

# Always include NAME and SYNOPSIS blocks as these 
# are useful for pod2usage. 
=head1 NAME

    My::Module

=head1 SYNOPSIS

    print My::Module::rocks('the party!');

=cut
By Alister West