Browse Source

More fixes and tune-ups for Perl

Stefan Geneshky 12 years ago
parent
commit
814ffe385b
9 changed files with 24 additions and 24 deletions
  1. 3 5
      dancer/app.pl
  2. 1 1
      dancer/benchmark_config
  3. 5 2
      dancer/setup.py
  4. 3 5
      kelp/app.pl
  5. 1 1
      kelp/benchmark_config
  6. 5 2
      kelp/setup.py
  7. 3 5
      mojolicious/app.pl
  8. 1 1
      mojolicious/benchmark_config
  9. 2 2
      mojolicious/setup.py

+ 3 - 5
dancer/app.pl

@@ -7,11 +7,9 @@ use DBI;
 
 set serializer => 'JSON';
 
-my $database = 'hello_world';
-my $host     = 'localhost';
-my $dsn      = "dbi:mysql:database=$database;host=$host;port=3306";
-my $dbh      = DBI->connect( $dsn, 'benchmarkdbuser', 'benchmarkdbpass', {} );
-my $sth      = $dbh->prepare("SELECT * FROM World where id = ?");
+my $dsn = "dbi:mysql:database=hello_world;host=localhost;port=3306";
+my $dbh = DBI->connect( $dsn, 'benchmarkdbuser', 'benchmarkdbpass', {} );
+my $sth = $dbh->prepare("SELECT * FROM World where id = ?");
 
 get '/json' => sub {
     { message => 'Hello, World!' }

+ 1 - 1
dancer/benchmark_config

@@ -6,7 +6,7 @@
       "json_url": "/json",
       "db_url": "/db",
       "query_url": "/db?queries=",
-      "port": 8080,
+      "port": 8081,
       "sort": 27
     }
   }]

+ 5 - 2
dancer/setup.py

@@ -1,14 +1,17 @@
 import subprocess
+import sys
+import os
+import setup_util
 
 def start(args):
   setup_util.replace_text("dancer/app.pl", "localhost", args.database_host)
-  subprocess.Popen("plackup -E deployment -s Starman -p 8080 dancer/app.pl".rsplit(" "))
+  subprocess.Popen("plackup -E deployment -s Starman -p 8081 dancer/app.pl".rsplit(" "))
   return 0
 def stop():
   p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
   out, err = p.communicate()
   for line in out.splitlines():
-    if 'plackup' in line:
+    if 'starman' in line:
       pid = int(line.split(None, 2)[1])
       os.kill(pid, 9)
   return 0

+ 3 - 5
kelp/app.pl

@@ -2,11 +2,9 @@
 use Kelp::Less;
 use DBI;
 
-my $database = 'hello_world';
-my $host     = 'localhost';
-my $dsn      = "dbi:mysql:database=$database;host=$host;port=3306";
-my $dbh      = DBI->connect( $dsn, 'benchmarkdbuser', 'benchmarkdbpass', {} );
-my $sth      = $dbh->prepare("SELECT * FROM World where id = ?");
+my $dsn = "dbi:mysql:database=hello_world;host=localhost;port=3306";
+my $dbh = DBI->connect( $dsn, 'benchmarkdbuser', 'benchmarkdbpass', {} );
+my $sth = $dbh->prepare("SELECT * FROM World where id = ?");
 
 get '/json' => sub {
     { message => 'Hello, World!' }

+ 1 - 1
kelp/benchmark_config

@@ -6,7 +6,7 @@
       "json_url": "/json",
       "db_url": "/db",
       "query_url": "/db?queries=",
-      "port": 8080,
+      "port": 8082,
       "sort": 27
     }
   }]

+ 5 - 2
kelp/setup.py

@@ -1,14 +1,17 @@
 import subprocess
+import sys
+import os
+import setup_util
 
 def start(args):
   setup_util.replace_text("kelp/app.pl", "localhost", args.database_host)
-  subprocess.Popen("plackup -E deployment -s Starman -p 8080 kelp/app.pl".rsplit(" "))
+  subprocess.Popen("plackup -E deployment -s Starman -p 8082 kelp/app.pl".rsplit(" "))
   return 0
 def stop():
   p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
   out, err = p.communicate()
   for line in out.splitlines():
-    if 'plackup' in line:
+    if 'starman' in line:
       pid = int(line.split(None, 2)[1])
       os.kill(pid, 9)
   return 0

+ 3 - 5
mojolicious/app.pl

@@ -2,11 +2,9 @@
 use Mojolicious::Lite;
 use DBI;
 
-my $database = 'hello_world';
-my $host     = 'localhost';
-my $dsn      = "dbi:mysql:database=$database;host=$host;port=3306";
-my $dbh      = DBI->connect( $dsn, 'root', '', {} );
-my $sth      = $dbh->prepare("SELECT * FROM World where id = ?");
+my $dsn = "dbi:mysql:database=hello_world;host=localhost;port=3306";
+my $dbh = DBI->connect( $dsn, 'benchmarkdbuser', 'benchmarkdbpass', {} );
+my $sth = $dbh->prepare("SELECT * FROM World where id = ?");
 
 get '/json' => sub {
     my $self = shift;

+ 1 - 1
mojolicious/benchmark_config

@@ -6,7 +6,7 @@
       "json_url": "/json",
       "db_url": "/db",
       "query_url": "/db?queries=",
-      "port": 8080,
+      "port": 8083,
       "sort": 27
     }
   }]

+ 2 - 2
mojolicious/setup.py

@@ -6,14 +6,14 @@ import setup_util
 def start(args):
   setup_util.replace_text("mojolicious/app.pl", "localhost", args.database_host)
   os.environ["MOJO_MODE"] = "production"
-  subprocess.Popen("hypnotoad -f mojolicious/app.pl".rsplit(" "))
+  subprocess.Popen("plackup -E deployment -s Starman -p 8083 app.pl".rsplit(" "))
   return 0
 
 def stop():
   p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
   out, err = p.communicate()
   for line in out.splitlines():
-    if 'hypnotoad' in line:
+    if 'starman' in line:
       pid = int(line.split(None, 2)[1])
       os.kill(pid, 9)
   return 0