Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
metamod:perl_code_style [2011-02-10 08:22:41] oysteint Added basic module template |
metamod:perl_code_style [2022-05-31 09:29:32] (current) |
||
---|---|---|---|
Line 54: | Line 54: | ||
===== Perl Template ===== | ===== Perl Template ===== | ||
- | |||
- | The following templates follows Eclipse template syntax. All expression on the form '' | ||
==== Basic module template ==== | ==== Basic module template ==== | ||
Line 61: | Line 59: | ||
This is a template for basic module. | This is a template for basic module. | ||
<code perl> | <code perl> | ||
- | package | + | package |
=begin LICENSE | =begin LICENSE | ||
Line 88: | Line 86: | ||
=head1 NAME | =head1 NAME | ||
- | ${name} - ${description} | + | < |
=head1 SYNOPSIS | =head1 SYNOPSIS | ||
Line 98: | Line 96: | ||
=cut | =cut | ||
- | ${code} | + | < |
=head1 LICENSE | =head1 LICENSE | ||
Line 105: | Line 103: | ||
=cut | =cut | ||
+ | 1; | ||
+ | </ | ||
+ | |||
+ | ==== Catalyst controller template ==== | ||
+ | |||
+ | This template can be used for new Catalyst controllers. | ||
+ | |||
+ | <code perl> | ||
+ | package <package name>; | ||
+ | |||
+ | =begin LICENSE | ||
+ | |||
+ | METAMOD is free software; you can redistribute it and/or modify | ||
+ | it under the terms of the GNU General Public License as published by | ||
+ | the Free Software Foundation; either version 2 of the License, or | ||
+ | (at your option) any later version. | ||
+ | |||
+ | METAMOD is distributed in the hope that it will be useful, | ||
+ | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
+ | GNU General Public License for more details. | ||
+ | |||
+ | You should have received a copy of the GNU General Public License | ||
+ | along with METAMOD; if not, write to the Free Software | ||
+ | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 | ||
+ | |||
+ | =end LICENSE | ||
+ | |||
+ | =cut | ||
+ | |||
+ | BEGIN {extends ' | ||
+ | |||
+ | =head1 NAME | ||
+ | |||
+ | <package name> - < | ||
+ | |||
+ | =head1 DESCRIPTION | ||
+ | |||
+ | =head1 METHODS | ||
+ | |||
+ | =cut | ||
+ | |||
+ | =head2 auto | ||
+ | |||
+ | =cut | ||
+ | |||
+ | sub auto :Private { | ||
+ | my ( $self, $c ) = @_; | ||
+ | |||
+ | # Controller specific initialisation for each request. | ||
+ | } | ||
+ | |||
+ | =head2 index | ||
+ | |||
+ | |||
+ | =cut | ||
+ | sub index : Path(" | ||
+ | my ( $self, $c ) = @_; | ||
+ | |||
+ | } | ||
+ | |||
+ | |||
+ | # | ||
+ | # Remove comment if you want a controller specific begin(). This | ||
+ | # will override the less specific begin() | ||
+ | # | ||
+ | #sub begin { | ||
+ | # my ( $self, $c ) = @_; | ||
+ | #} | ||
+ | |||
+ | # | ||
+ | # Remove comment if you want a controller specific end(). This | ||
+ | # will override the less specific end() | ||
+ | # | ||
+ | #sub end { | ||
+ | # my ( $self, $c ) = @_; | ||
+ | #} | ||
+ | |||
+ | |||
+ | __PACKAGE__-> | ||
+ | |||
+ | =head1 LICENSE | ||
+ | |||
+ | GPLv2 L< | ||
+ | |||
+ | =cut | ||
+ | |||
1; | 1; | ||
</ | </ |