Alois Mahdal 11 years ago
parent
commit
91b7fe20d2
1 changed files with 5 additions and 5 deletions
  1. 5
    5
      bin/mkexec.pl

+ 5
- 5
bin/mkexec.pl View File

12
 my $name = shift or usage;
12
 my $name = shift or usage;
13
 my $type = ($ARGV[0] ? shift : guesstype $name);
13
 my $type = ($ARGV[0] ? shift : guesstype $name);
14
 
14
 
15
-my $bang = {
15
+my $bangs = {
16
     pl   => `which perl`,
16
     pl   => `which perl`,
17
     sh   => `which sh`,
17
     sh   => `which sh`,
18
     py   => `which python`,
18
     py   => `which python`,
21
     bc   => `which bc`
21
     bc   => `which bc`
22
 };
22
 };
23
 
23
 
24
-my $template = {
24
+my $templates = {
25
     pl   => "use strict;\nuse warnings;\n",
25
     pl   => "use strict;\nuse warnings;\n",
26
     py   => "if __name__ == '__main__':\n"
26
     py   => "if __name__ == '__main__':\n"
27
 };
27
 };
34
 $cmds->{editor}->{run}  = "editor '%s'";
34
 $cmds->{editor}->{run}  = "editor '%s'";
35
 
35
 
36
 
36
 
37
-if (exists $bang->{$type}) {
37
+if (exists $bangs->{$type}) {
38
     -e $name || mkexec $name, mkbody($type);
38
     -e $name || mkexec $name, mkbody($type);
39
     chmod $DEFAULT_MODE, $name;
39
     chmod $DEFAULT_MODE, $name;
40
     launch_editor $name;
40
     launch_editor $name;
56
 sub mkbody {
56
 sub mkbody {
57
     my $type = shift;
57
     my $type = shift;
58
     my $tmpl = "";
58
     my $tmpl = "";
59
-    $tmpl .= $template->{$type} if exists $template->{$type};
60
-    return sprintf "#!%s\n%s\n", $bang->{$type}, $tmpl;
59
+    $tmpl .= $templates->{$type} if exists $templates->{$type};
60
+    return sprintf "#!%s\n%s\n", $bangs->{$type}, $tmpl;
61
 }
61
 }
62
 
62
 
63
 sub mkexec {
63
 sub mkexec {