aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@devlet.com.br>2010-07-23 17:53:51 -0300
committerSilvio <silvio@devlet.com.br>2010-07-23 17:53:51 -0300
commit770b3c7364dcea139eb5a2204b3648c4825e3f69 (patch)
tree6a4fd3a4e443ee1cae7ed1b21d9e99833abf2c58
parentf4243f1d6d01e05c374dfaf78a0ff96f95e33765 (diff)
downloadcinisis-770b3c7364dcea139eb5a2204b3648c4825e3f69.tar.gz
cinisis-770b3c7364dcea139eb5a2204b3648c4825e3f69.tar.bz2
Adding a perl singleton
-rw-r--r--classes/BiblioIsisDb.php3
-rw-r--r--classes/PerlSingleton.php17
2 files changed, 19 insertions, 1 deletions
diff --git a/classes/BiblioIsisDb.php b/classes/BiblioIsisDb.php
index 22586ed..ee3441c 100644
--- a/classes/BiblioIsisDb.php
+++ b/classes/BiblioIsisDb.php
@@ -42,7 +42,8 @@ class BiblioIsisDb implements IsisDb {
}
// Create a perl instance.
- $this->perl = new Perl();
+ //$this->perl = new Perl();
+ $this->perl = PerlSingleton::getInstance();
}
/**
diff --git a/classes/PerlSingleton.php b/classes/PerlSingleton.php
new file mode 100644
index 0000000..c606cfe
--- /dev/null
+++ b/classes/PerlSingleton.php
@@ -0,0 +1,17 @@
+<?php
+
+class PerlSingleton {
+ private static $instance = null;
+
+ private function __construct() {
+ $this->perl = new Perl();
+ }
+
+ public static function getInstance() {
+ if(self::$instance == null) {
+ self::$instance = new self;
+ }
+
+ return self::$instance->perl;
+ }
+}