Browse files

changed perl snippets to match perl preferred practises (issue#72)

  • Loading branch information...
1 parent 1b26123 commit 9fe9170564c4f1c68b5be49ce7da64076e0a18ed msanders committed Dec 28, 2009
Showing with 19 additions and 13 deletions.
  1. +19 −13 snippets/perl.snippets
View
32 snippets/perl.snippets
@@ -1,7 +1,7 @@
-# #!/usr/bin/env perl
+# #!/usr/bin/perl
snippet #!
- #!/usr/bin/env perl
-
+ #!/usr/bin/perl
+
# Hash Pointer
snippet .
=>
@@ -19,16 +19,19 @@ snippet if
snippet ife
if (${1}) {
${2:# body...}
- } else {
+ }
+ else {
${3:# else...}
}
# Conditional if..elsif..else
snippet ifee
if (${1}) {
${2:# body...}
- } elsif (${3}) {
+ }
+ elsif (${3}) {
${4:# elsif...}
- } else {
+ }
+ else {
${5:# else...}
}
# Conditional One-line
@@ -58,32 +61,35 @@ snippet wh
# While Loop One-line
snippet xwh
${1:expression} while ${2:condition};${3}
-# For Loop
-snippet for
+# C-style For Loop
+snippet cfor
for (my $${2:var} = 0; $$2 < ${1:count}; $$2${3:++}) {
${4:# body...}
}
+# For loop one-line
+snippet xfor
+ ${1:expression} for @${2:array};${3}
# Foreach Loop
-snippet fore
+snippet for
foreach my $${1:x} (@${2:array}) {
${3:# body...}
}
# Foreach Loop One-line
-snippet xfore
+snippet fore
${1:expression} foreach @${2:array};${3}
# Package
snippet cl
package ${1:ClassName};
-
+
use base qw(${2:ParentClass});
-
+
sub new {
my $class = shift;
$class = ref $class if ref $class;
my $self = bless {}, $class;
$self;
}
-
+
1;${3}
# Read File
snippet slurp

0 comments on commit 9fe9170

Please sign in to comment.