Skip to content

Commit e7f4b49

Browse files
author
coderswat
authored
perl snippets $ sign problem solved (#18)
1 parent 88e8514 commit e7f4b49

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

dist/snippets/perl.snippets

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ snippet eval
5151
eval {
5252
${1:# do something risky...}
5353
};
54-
if (my $e = $@) {
54+
if (my \$e = $@) {
5555
${2:# handle failure...}
5656
}
5757
# While Loop
@@ -64,7 +64,7 @@ snippet xwh
6464
${1:expression} while ${2:condition};${3}
6565
# C-style For Loop
6666
snippet cfor
67-
for (my $${2:var} = 0; $$2 < ${1:count}; $$2${3:++}) {
67+
for (my $${2:var} = 0; $\$2 < ${1:count}; $\$2${3:++}) {
6868
${4:# body...}
6969
}
7070
# For loop one-line
@@ -108,7 +108,7 @@ snippet parent
108108
use parent qw(${1:Parent Class});
109109
# Read File
110110
snippet slurp
111-
my $${1:var} = do { local $/; open my $file, '<', "${2:file}"; <$file> };
111+
my $${1:var} = do { local $/; open my \$file, '<', "${2:file}"; <\$file> };
112112
${3}
113113
# strict warnings
114114
snippet strwar
@@ -117,8 +117,8 @@ snippet strwar
117117
# older versioning with perlcritic bypass
118118
snippet vers
119119
## no critic
120-
our $VERSION = '${1:version}';
121-
eval $VERSION;
120+
our \$VERSION = '${1:version}';
121+
eval \$VERSION;
122122
## use critic
123123
# new 'switch' like feature
124124
snippet switch
@@ -196,7 +196,7 @@ snippet ppod
196196

197197
=head1 SYNOPSIS
198198

199-
use $1;
199+
use \$1;
200200

201201
${3:# synopsis...}
202202

@@ -230,9 +230,9 @@ snippet psubi
230230
=cut
231231
# inline documented subroutine
232232
snippet subpod
233-
=head2 $1
233+
=head2 \$1
234234

235-
Summary of $1
235+
Summary of \$1
236236

237237
=cut
238238

@@ -290,8 +290,8 @@ snippet has
290290
# override
291291
snippet override
292292
override ${1:attribute} => sub {
293-
${2:# my $self = shift;};
294-
${3:# my ($self, $args) = @_;};
293+
${2:# my \$self = shift;};
294+
${3:# my (\$self, \$args) = @_;};
295295
};
296296

297297

@@ -307,32 +307,32 @@ snippet tlib
307307

308308
#test methods
309309
snippet tmeths
310-
$ENV{TEST_METHOD} = '${1:regex}';
310+
\$ENV{TEST_METHOD} = '${1:regex}';
311311

312312
# runtestclass
313313
snippet trunner
314314
use ${1:test_class};
315-
$1->runtests();
315+
\$1->runtests();
316316

317317
# Test::Class-style test
318318
snippet tsub
319319
sub t${1:number}_${2:test_case} :Test(${3:num_of_tests}) {
320-
my $self = shift;
320+
my \$self = shift;
321321
${4:# body}
322322

323323
}
324324

325325
# Test::Routine-style test
326326
snippet trsub
327327
test ${1:test_name} => { description => '${2:Description of test.}'} => sub {
328-
my ($self) = @_;
328+
my (\$self) = @_;
329329
${3:# test code}
330330
};
331331

332332
#prep test method
333333
snippet tprep
334334
sub prep${1:number}_${2:test_case} :Test(startup) {
335-
my $self = shift;
335+
my \$self = shift;
336336
${4:# body}
337337
}
338338

@@ -341,7 +341,7 @@ snippet debug_trace
341341
use Carp; # 'verbose';
342342
# cloak "die"
343343
# warn "warning"
344-
$SIG{'__DIE__'} = sub {
344+
\$SIG{'__DIE__'} = sub {
345345
require Carp; Carp::confess
346346
};
347347

0 commit comments

Comments
 (0)