mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-04 21:01:27 -05:00
1 line
5.4 KiB
JavaScript
1 line
5.4 KiB
JavaScript
|
ace.define("ace/snippets/perl",["require","exports","module"],function(e,t,n){t.snippetText="# #!/usr/bin/perl\nsnippet #!\n #!/usr/bin/env perl\n\n# Hash Pointer\nsnippet .\n =>\n# Function\nsnippet sub\n sub ${1:function_name} {\n ${2:#body ...}\n }\n# Conditional\nsnippet if\n if (${1}) {\n ${2:# body...}\n }\n# Conditional if..else\nsnippet ife\n if (${1}) {\n ${2:# body...}\n }\n else {\n ${3:# else...}\n }\n# Conditional if..elsif..else\nsnippet ifee\n if (${1}) {\n ${2:# body...}\n }\n elsif (${3}) {\n ${4:# elsif...}\n }\n else {\n ${5:# else...}\n }\n# Conditional One-line\nsnippet xif\n ${1:expression} if ${2:condition};${3}\n# Unless conditional\nsnippet unless\n unless (${1}) {\n ${2:# body...}\n }\n# Unless conditional One-line\nsnippet xunless\n ${1:expression} unless ${2:condition};${3}\n# Try/Except\nsnippet eval\n local $@;\n eval {\n ${1:# do something risky...}\n };\n if (my $e = $@) {\n ${2:# handle failure...}\n }\n# While Loop\nsnippet wh\n while (${1}) {\n ${2:# body...}\n }\n# While Loop One-line\nsnippet xwh\n ${1:expression} while ${2:condition};${3}\n# C-style For Loop\nsnippet cfor\n for (my $${2:var} = 0; $$2 < ${1:count}; $$2${3:++}) {\n ${4:# body...}\n }\n# For loop one-line\nsnippet xfor\n ${1:expression} for @${2:array};${3}\n# Foreach Loop\nsnippet for\n foreach my $${1:x} (@${2:array}) {\n ${3:# body...}\n }\n# Foreach Loop One-line\nsnippet fore\n ${1:expression} foreach @${2:array};${3}\n# Package\nsnippet package\n package ${1:`substitute(Filename('', 'Page Title'), '^.', '\\u&', '')`};\n\n ${2}\n\n 1;\n\n __END__\n# Package syntax perl >= 5.14\nsnippet packagev514\n package ${1:`substitute(Filename('', 'Page Title'), '^.', '\\u&', '')`} ${2:0.99};\n\n ${3}\n\n 1;\n\n __END__\n#moose\nsnippet moose\n use Moose;\n use namespace::autoclean;\n ${1:#}BEGIN {extends '${2:ParentClass}'};\n\n ${3}\n# parent\nsnippet parent\n use parent qw(${1:Parent Class});\n# Read File\nsnippet slurp\n my $${1:var} = do { local $/; open my $file, '<', \"${2:file}\"; <$file> };\n ${3}\n# strict warnings\nsnippet strwar\n use strict;\n use warnings;\n# older versioning with perlcritic bypass\nsnippet vers\n ## no critic\n our $VERSION = '${1:version}';\n eval $VERSION;\n ## use critic\n# new 'switch' like feature\nsnippet switch\n use feature 'switch';\n\n# Anonymous subroutine\nsnippet asub\n sub {\n ${1:# body }\n }\n\n\n\n# Begin block\nsnippet begin\n BEGIN {\n ${1:# begin body}\n }\n\n# call package function with some parameter\nsnippet pkgmv\n __PACKAGE__->${1:package_method}(${2:var})\n\n# call package function without a parameter\nsnippet pkgm\n __PACKAGE__->${1:package_method}()\n\n# call package \"get_\" function without a parameter\nsnippet pkget\n __PACKAGE__->get_${1:package_method}()\n\n# call package function with a parameter\nsnippet pkgetv\n __PACKAGE__->get_${1:package_method}(${2:var})\n\n# complex regex\nsnippet qrx\n qr/\n ${1:regex}\n /xms\n\n#simpler regex\nsnippet qr/\n qr/${1:regex}/x\n\n#given\nsnippet given\n given ($${1:var}) {\n ${2:# cases}\n ${3:# default}\n }\n\n# switch-like case\nsnippet when\n when (${1:case}) {\n ${2:# body}\n }\n\n# hash slice\nsnippet hslice\n @{ ${1:hash} }{ ${2:array} }\n\n\n# map\nsnippet map\n map { ${2: body } } ${1: @array } ;\n\n\n\n# Pod stub\nsnippet ppod\n =head1 NAME\n\n ${1:ClassName} - ${2:ShortDesc}\n\n =head1 SYNOPSIS\n\n use $1;\n\n ${3:# synopsis...}\n\n =head1 DESCRIPTION\n\n ${4:# longer description...}\n\n\n =head1 INTERFACE\n\n\n =head1 DEPENDENCIES\n\n\n =head1 SEE ALSO\n\n\n# Heading for a subroutine stub\nsnippet psub\n =head2 ${1:MethodName}\n\n ${2:Summary....}\n\n# Heading for inline subroutine pod\nsnippet psubi\n =head2 ${1:MethodName}\n\n ${2:Summary...}\n\n\n =cut\n# inline documented subroutine\nsnippet subpod\n =head2 $1\n\n Summary of $1\n\n =cut\n\n sub ${1:subroutine_name} {\n ${2:# body...}\n }\n# Subroutine signature\nsnippet parg\n =over 2\n\n =item\n Arguments\n\n\n =over 3\n\n =item\n C<${1:DataStructure}>\n\n ${2:Sample}\n\n\n =back\n\n\n =item\n Return\n\n =over 3\n\n\n =
|