Skip to content

Commit

Permalink
changed perl snippets to match perl preferred practises (issue#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
msanders committed Dec 28, 2009
1 parent 1b26123 commit 9fe9170
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions snippets/perl.snippets
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# #!/usr/bin/env perl
# #!/usr/bin/perl
snippet #!
#!/usr/bin/env perl
#!/usr/bin/perl

# Hash Pointer
snippet .
=>
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9fe9170

Please sign in to comment.