scripts/dbupgrade2_tool.pl: bei --create --type pl auch package stub anlegen
authorSven Schöling <s.schoeling@linet-services.de>
Thu, 22 May 2014 13:04:12 +0000 (15:04 +0200)
committerSven Schöling <s.schoeling@linet-services.de>
Thu, 22 May 2014 13:04:12 +0000 (15:04 +0200)
scripts/dbupgrade2_tool.pl

index 5ed9c27..7b614a8 100755 (executable)
@@ -299,6 +299,23 @@ sub create_upgrade {
   print $fh "$comment \@description: $description\n";
   print $fh "$comment \@depends: @depends\n";
   print $fh "$comment \@encoding: $encoding\n";
+
+  if ($type eq 'pl') {
+    print $fh "package SL::DBUpgrade2::$filename;\n";
+    print $fh "\n";
+    print $fh "use strict;\n";
+    print $fh "use utf8;\n" if $encoding =~ /utf.?8/i;
+    print $fh "\n";
+    print $fh "use parent qw(SL::DBUpgrade2::Base);\n";
+    print $fh "\n";
+    print $fh "sub run {\n";
+    print $fh "  my (\$self) = \@_;\n";
+    print $fh "\n";
+    print $fh "}\n";
+    print $fh "\n";
+    print $fh "1;\n";
+  }
+
   close $fh;
 
   print "File $full_filename created.\n";