blob: 67c7f278d4bdb234ff35b6da031158786f35d45f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
priority -50
###########################################################################
# TextMate Snippets #
###########################################################################
snippet ife "Conditional if..else (ife)"
if ($1) {
${2:# body...}
}
else {
${3:# else...}
}
endsnippet
snippet ifee "Conditional if..elsif..else (ifee)"
if ($1) {
${2:# body...}
}
elsif ($3) {
${4:# elsif...}
}
else {
${5:# else...}
}
endsnippet
snippet xunless "Conditional one-line (unless)"
${1:expression} unless ${2:condition};
endsnippet
snippet xif "Conditional one-line (xif)"
${1:expression} if ${2:condition};
endsnippet
snippet sub "Function (sub)"
sub ${1:function_name} {
${2:# body...}
}
endsnippet
snippet xfore "Loop one-line (xforeach)"
${1:expression} foreach @${2:array};
endsnippet
snippet xwhile "Loop one-line (xwhile)"
${1:expression} while ${2:condition};
endsnippet
snippet test "Test"
#!/usr/bin/env perl -w
use strict;
use Test::More tests => ${1:1};
use ${2:ModuleName};
ok(${3:assertion});
endsnippet
snippet class "class"
package ${1:ClassName};
${2:use parent qw(${3:ParentClass});}${2/.+/\n\n/}sub new {
my $class = shift;
$class = ref $class if ref $class;
my $self = bless {}, $class;
$self;
}
1;
endsnippet
snippet eval "eval"
local $@;
eval {
${1:# do something risky...}
};
if (my $${2:exception} = $@) {
${3:# handle failure...}
}
endsnippet
snippet for "for"
for (my $${1:var} = 0; $$1 < ${2:expression}; $$1++) {
${3:# body...}
}
endsnippet
snippet fore "foreach"
foreach ${1:my $${2:x}} (@${3:array}) {
${4:# body...}
}
endsnippet
snippet if "if"
if ($1) {
${2:# body...}
}
endsnippet
snippet slurp "slurp"
my $${1:var} = do { local $/ = undef; open my $fh, '<', ${2:$file}; <$fh> };
endsnippet
snippet unless "unless"
unless ($1) {
${2:# body...}
}
endsnippet
snippet while "while"
while ($1) {
${2:# body...}
}
endsnippet
snippet until "until"
until ($1) {
${2:# body...}
}
endsnippet
# vim:ft=snippets:
|