modify with some updated features

This commit is contained in:
William Travis Holton 2011-06-27 22:32:23 +02:00
parent bfc34d3713
commit 1acd1e803a
3 changed files with 130 additions and 11 deletions

View File

@ -14,6 +14,11 @@ snippet vers
## use critic
# new 'switch' like feature
snippet switch
use feature 'switch';
# Anonymous subroutine
snippet asub
@ -22,16 +27,29 @@ snippet asub
}
# Begin block
snippet begin
BEGIN { #{{{
${1:# begin body}
} #}}}
# call package function
snippet pkgm
# call package function with some parameter
snippet pkgmv
__PACKAGE__->${1:package_method}(${2:var});
# call package function without a parameter
snippet pkgm
__PACKAGE__->${1:package_method}();
# call package "get_" function without a parameter
snippet pkget
__PACKAGE__->get_${1:package_method}();
# call package function with a parameter
snippet pkgetv
__PACKAGE__->get_${1:package_method}(${2:var});
# complex regex
snippet qrx
qr/
@ -42,17 +60,99 @@ snippet qrx
snippet qr/
qr/${1:regex}/x
#switch
snippet switch
switch ($${1:var}) { #{{{
#given
snippet given
given ($${1:var}) { #{{{
${2:# cases}
${3:# default}
} #}}}
# switch case
snippet case
case ${1:case} {
# switch-like case
snippet when
when (${1:case}) { #{{{
${2:# body}
}
} #}}}
# hash slice
snippet hslice
@{ ${1:hash} }{ ${2:array} }
# map
snippet map
map { ${2: body } } ${1: @array } ;
# Pod stub
snippet ppod
=head1 NAME
${1:ClassName} - ${2:ShortDesc}
=head1 SYNOPSIS
use $1;
${3:# synopsis...}
=head1 DESCRIPTION
${4:# longer description...}
=head1 INTERFACE
=head1 DEPENDENCIES
=head1 SEE ALSO
# Heading for a subroutine stub
snippet psub
=head2 ${1:MethodName}
${2:Summary....}
# Subroutine signature
snippet parg
=over 2
=item
Arguments
=over 3
=item
C<${1:DataStructure}>
${2:Sample}
=back
=item
Return
=over 3
=item
C<${3:...return data}>
=back
=back

View File

@ -9,7 +9,8 @@ snippet moosecl
${6:# body of class}
1;
"one, but we're not the same";
__END__
=head1 NAME
@ -35,3 +36,14 @@ snippet has
); #}}}
# override
snippet override
override ${1:attribute} => sub { #{{{
${2:# my $self = shift;};
${3:# my ($self,$args) = @_;};
}; #}}}

View File

@ -21,9 +21,16 @@ snippet trunner
#testclass
snippet tsub
sub t${1:number}_${2:test_case} Test:(${3:num_of_tests}) { #{{{
sub t${1:number}_${2:test_case} :Test(${3:num_of_tests}) { #{{{
my $self = shift;
${4:# body}
} #}}}
#prep test method
snippet tprep
sub prep${1:number}_${2:test_case} :Test(startup) { #{{{
my $self = shift;
${4:# body}
} #}}}