snippet try try { ${1} } catch { ${2} }; snippet st map { $_->[0] } sort { $a->[1] ${3:cmp} $b->[1] } map { [$_, ${2:function}] } ${1:list} snippet tbl local $Test::Builder::Level = $Test::Builder::Level + 1; snippet ccl local $Carp::CarpLevel = $Carp::CarpLevel + 1; snippet linc local $${1:a} = $$1 + ${2:1}; ${3} snippet script #!/usr/bin/env perl use strict; use warnings; snippet test #!/usr/bin/env perl use strict; use warnings; use Test::More; ${1} done_testing; snippet nac use namespace::autoclean; snippet wd use Data::Dump; ddx(${1}); snippet wdd use Data::Dump; push @Data::Dump::FILTERS, sub { return {dump => "$_[1]"} if $_[0]->depth > ${1:1} }; ddx(${2}); snippet package package ${1:`substitute(matchstr(expand("%"), '^lib/\zs.*\ze\.pm'), '/', '::', 'g')`}; use strict; use warnings; ${2} 1; snippet test_psgi test_psgi app => ${1:MyApp}->new->to_app, client => sub { my $cb = shift; { ${2} } }; # # Moose # snippet class package ${1:`substitute(matchstr(expand("%"), '^lib/\zs.*\ze\.pm'), '/', '::', 'g')`}; use Moose; ${2} __PACKAGE__->meta->make_immutable; no Moose; 1; # XXX: ideally, this would be merged with the one above, but we need posthooks # for that to happen. also, some way to get the extends line to update with # the package line would be nice, maybe? snippet subclass package ${1:`substitute(matchstr(expand("%"), '^lib/\zs.*\ze\.pm'), '/', '::', 'g')`}; use Moose; extends '${2:`matchstr(substitute(matchstr(expand("%"), '^lib/\zs.*\ze\.pm'), '/', '::', 'g'), '.*\ze::.*')`}'; ${3} __PACKAGE__->meta->make_immutable; no Moose; 1; snippet role package ${1:`substitute(matchstr(expand("%"), '^lib/\zs.*\ze\.pm'), '/', '::', 'g')`}; use Moose::Role; ${2} no Moose::Role; 1; snippet has has ${1:attr} => ( is => '${2:ro}', isa => '${3:Str}',${4} ); snippet hasl has ${1:attr} => ( is => '${2:ro}', isa => '${3:Str}', lazy_build => 1,${4} ); sub _build_$1 { my $self = shift; ${5} } snippet m sub ${1:foo} { my $self = shift; ${2} } snippet around around ${1:foo} => sub { my $orig = shift; my $self = shift; ${2} }; snippet after after ${1:foo} => sub { my $self = shift; ${2} }; snippet before before ${1:foo} => sub { my $self = shift; ${2} };