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}; ${0} snippet script #!/usr/bin/env perl use strict; use warnings; ${0} snippet test #!/usr/bin/env perl use strict; use warnings; use Test::More; ${0} done_testing; snippet sub sub ${1:foo} { ${0} } snippet wd use Data::Dump; ddx(${1}); ${0} snippet wdd use Data::Dump; push @Data::Dump::FILTERS, sub { return {dump => "$_[1]"} if $_[0]->depth > ${1:1} }; ddx(${2}); ${0} snippet package package ${1:`substitute(matchstr(expand("%"), '^lib/\zs.*\ze\.pm'), '/', '::', 'g')`}; use strict; use warnings; ${0} 1; snippet test_psgi test_psgi app => ${1:MyApp}->new->to_app, client => sub { my $cb = shift; { ${0} } }; # # Moose # snippet class package ${1:`substitute(matchstr(expand("%"), '^lib/\zs.*\ze\.pm'), '/', '::', 'g')`}; use Moose; ${0} __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::.*')`}'; ${0} __PACKAGE__->meta->make_immutable; no Moose; 1; snippet role package ${1:`substitute(matchstr(expand("%"), '^lib/\zs.*\ze\.pm'), '/', '::', 'g')`}; use Moose::Role; ${0} no Moose::Role; 1; snippet has has ${1:attr} => ( is => '${2:ro}', isa => '${3:Str}',${0} ); snippet hasl has ${1:attr} => ( is => '${2:ro}', isa => '${3:Str}', lazy_build => 1,${4} ); sub _build_$1 { my $self = shift; ${0} } snippet m sub ${1:foo} { my $self = shift; ${0} } snippet around around ${1:foo} => sub { my $orig = shift; my $self = shift; ${0} }; snippet after after ${1:foo} => sub { my $self = shift; ${0} }; snippet before before ${1:foo} => sub { my $self = shift; ${0} };