perl-bea34895.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. import{g as o}from"./index-91b358e1.js";function $(s,i){for(var t=0;t<i.length;t++){const n=i[t];if(typeof n!="string"&&!Array.isArray(n)){for(const e in n)if(e!=="default"&&!(e in s)){const p=Object.getOwnPropertyDescriptor(n,e);p&&Object.defineProperty(s,e,p.get?p:{enumerable:!0,get:()=>n[e]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}var r={exports:{}};(function(s,i){ace.define("ace/snippets/perl.snippets",["require","exports","module"],function(t,n,e){e.exports=`# #!/usr/bin/perl
  2. snippet #!
  3. #!/usr/bin/env perl
  4. # Hash Pointer
  5. snippet .
  6. =>
  7. # Function
  8. snippet sub
  9. sub \${1:function_name} {
  10. \${2:#body ...}
  11. }
  12. # Conditional
  13. snippet if
  14. if (\${1}) {
  15. \${2:# body...}
  16. }
  17. # Conditional if..else
  18. snippet ife
  19. if (\${1}) {
  20. \${2:# body...}
  21. }
  22. else {
  23. \${3:# else...}
  24. }
  25. # Conditional if..elsif..else
  26. snippet ifee
  27. if (\${1}) {
  28. \${2:# body...}
  29. }
  30. elsif (\${3}) {
  31. \${4:# elsif...}
  32. }
  33. else {
  34. \${5:# else...}
  35. }
  36. # Conditional One-line
  37. snippet xif
  38. \${1:expression} if \${2:condition};\${3}
  39. # Unless conditional
  40. snippet unless
  41. unless (\${1}) {
  42. \${2:# body...}
  43. }
  44. # Unless conditional One-line
  45. snippet xunless
  46. \${1:expression} unless \${2:condition};\${3}
  47. # Try/Except
  48. snippet eval
  49. local $@;
  50. eval {
  51. \${1:# do something risky...}
  52. };
  53. if (my $e = $@) {
  54. \${2:# handle failure...}
  55. }
  56. # While Loop
  57. snippet wh
  58. while (\${1}) {
  59. \${2:# body...}
  60. }
  61. # While Loop One-line
  62. snippet xwh
  63. \${1:expression} while \${2:condition};\${3}
  64. # C-style For Loop
  65. snippet cfor
  66. for (my $\${2:var} = 0; $$2 < \${1:count}; $$2\${3:++}) {
  67. \${4:# body...}
  68. }
  69. # For loop one-line
  70. snippet xfor
  71. \${1:expression} for @\${2:array};\${3}
  72. # Foreach Loop
  73. snippet for
  74. foreach my $\${1:x} (@\${2:array}) {
  75. \${3:# body...}
  76. }
  77. # Foreach Loop One-line
  78. snippet fore
  79. \${1:expression} foreach @\${2:array};\${3}
  80. # Package
  81. snippet package
  82. package \${1:\`substitute(Filename('', 'Page Title'), '^.', '\\u&', '')\`};
  83. \${2}
  84. 1;
  85. __END__
  86. # Package syntax perl >= 5.14
  87. snippet packagev514
  88. package \${1:\`substitute(Filename('', 'Page Title'), '^.', '\\u&', '')\`} \${2:0.99};
  89. \${3}
  90. 1;
  91. __END__
  92. #moose
  93. snippet moose
  94. use Moose;
  95. use namespace::autoclean;
  96. \${1:#}BEGIN {extends '\${2:ParentClass}'};
  97. \${3}
  98. # parent
  99. snippet parent
  100. use parent qw(\${1:Parent Class});
  101. # Read File
  102. snippet slurp
  103. my $\${1:var} = do { local $/; open my $file, '<', "\${2:file}"; <$file> };
  104. \${3}
  105. # strict warnings
  106. snippet strwar
  107. use strict;
  108. use warnings;
  109. # older versioning with perlcritic bypass
  110. snippet vers
  111. ## no critic
  112. our $VERSION = '\${1:version}';
  113. eval $VERSION;
  114. ## use critic
  115. # new 'switch' like feature
  116. snippet switch
  117. use feature 'switch';
  118. # Anonymous subroutine
  119. snippet asub
  120. sub {
  121. \${1:# body }
  122. }
  123. # Begin block
  124. snippet begin
  125. BEGIN {
  126. \${1:# begin body}
  127. }
  128. # call package function with some parameter
  129. snippet pkgmv
  130. __PACKAGE__->\${1:package_method}(\${2:var})
  131. # call package function without a parameter
  132. snippet pkgm
  133. __PACKAGE__->\${1:package_method}()
  134. # call package "get_" function without a parameter
  135. snippet pkget
  136. __PACKAGE__->get_\${1:package_method}()
  137. # call package function with a parameter
  138. snippet pkgetv
  139. __PACKAGE__->get_\${1:package_method}(\${2:var})
  140. # complex regex
  141. snippet qrx
  142. qr/
  143. \${1:regex}
  144. /xms
  145. #simpler regex
  146. snippet qr/
  147. qr/\${1:regex}/x
  148. #given
  149. snippet given
  150. given ($\${1:var}) {
  151. \${2:# cases}
  152. \${3:# default}
  153. }
  154. # switch-like case
  155. snippet when
  156. when (\${1:case}) {
  157. \${2:# body}
  158. }
  159. # hash slice
  160. snippet hslice
  161. @{ \${1:hash} }{ \${2:array} }
  162. # map
  163. snippet map
  164. map { \${2: body } } \${1: @array } ;
  165. # Pod stub
  166. snippet ppod
  167. =head1 NAME
  168. \${1:ClassName} - \${2:ShortDesc}
  169. =head1 SYNOPSIS
  170. use $1;
  171. \${3:# synopsis...}
  172. =head1 DESCRIPTION
  173. \${4:# longer description...}
  174. =head1 INTERFACE
  175. =head1 DEPENDENCIES
  176. =head1 SEE ALSO
  177. # Heading for a subroutine stub
  178. snippet psub
  179. =head2 \${1:MethodName}
  180. \${2:Summary....}
  181. # Heading for inline subroutine pod
  182. snippet psubi
  183. =head2 \${1:MethodName}
  184. \${2:Summary...}
  185. =cut
  186. # inline documented subroutine
  187. snippet subpod
  188. =head2 $1
  189. Summary of $1
  190. =cut
  191. sub \${1:subroutine_name} {
  192. \${2:# body...}
  193. }
  194. # Subroutine signature
  195. snippet parg
  196. =over 2
  197. =item
  198. Arguments
  199. =over 3
  200. =item
  201. C<\${1:DataStructure}>
  202. \${2:Sample}
  203. =back
  204. =item
  205. Return
  206. =over 3
  207. =item
  208. C<\${3:...return data}>
  209. =back
  210. =back
  211. # Moose has
  212. snippet has
  213. has \${1:attribute} => (
  214. is => '\${2:ro|rw}',
  215. isa => '\${3:Str|Int|HashRef|ArrayRef|etc}',
  216. default => sub {
  217. \${4:defaultvalue}
  218. },
  219. \${5:# other attributes}
  220. );
  221. # override
  222. snippet override
  223. override \${1:attribute} => sub {
  224. \${2:# my $self = shift;};
  225. \${3:# my ($self, $args) = @_;};
  226. };
  227. # use test classes
  228. snippet tuse
  229. use Test::More;
  230. use Test::Deep; # (); # uncomment to stop prototype errors
  231. use Test::Exception;
  232. # local test lib
  233. snippet tlib
  234. use lib qw{ ./t/lib };
  235. #test methods
  236. snippet tmeths
  237. $ENV{TEST_METHOD} = '\${1:regex}';
  238. # runtestclass
  239. snippet trunner
  240. use \${1:test_class};
  241. $1->runtests();
  242. # Test::Class-style test
  243. snippet tsub
  244. sub t\${1:number}_\${2:test_case} :Test(\${3:num_of_tests}) {
  245. my $self = shift;
  246. \${4:# body}
  247. }
  248. # Test::Routine-style test
  249. snippet trsub
  250. test \${1:test_name} => { description => '\${2:Description of test.}'} => sub {
  251. my ($self) = @_;
  252. \${3:# test code}
  253. };
  254. #prep test method
  255. snippet tprep
  256. sub prep\${1:number}_\${2:test_case} :Test(startup) {
  257. my $self = shift;
  258. \${4:# body}
  259. }
  260. # cause failures to print stack trace
  261. snippet debug_trace
  262. use Carp; # 'verbose';
  263. # cloak "die"
  264. # warn "warning"
  265. $SIG{'__DIE__'} = sub {
  266. require Carp; Carp::confess
  267. };
  268. `}),ace.define("ace/snippets/perl",["require","exports","module","ace/snippets/perl.snippets"],function(t,n,e){n.snippetText=t("./perl.snippets"),n.scope="perl"}),function(){ace.require(["ace/snippets/perl"],function(t){s&&(s.exports=t)})}()})(r);var a=r.exports;const u=o(a),c=$({__proto__:null,default:u},[a]);export{c as p};
  269. //# sourceMappingURL=perl-bea34895.js.map