From 922431d5c98a82b37bba080d09ecde4fcbc0202e Mon Sep 17 00:00:00 2001 From: Wolfram Schneider Date: Wed, 14 Apr 2010 13:24:13 +0000 Subject: [PATCH] add wrapper to read the IRSpy database name from environment variable / apache config --- lib/ZOOM/IRSpy.pm | 10 ++++++++++ t/ZOOM-IRSpy.t | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/ZOOM/IRSpy.pm b/lib/ZOOM/IRSpy.pm index 3e93b47..81fa911 100644 --- a/lib/ZOOM/IRSpy.pm +++ b/lib/ZOOM/IRSpy.pm @@ -116,6 +116,16 @@ sub new { return $this; } +# wrapper to read the IRSpy database name from environment variable / apache config +sub connect_to_registry { + my %args = @_; + + # XXX: we could also handle her: user, password, elementSetName + + my $database = $ENV{IRSpyDbName} || "localhost:8018/IR-Explain---1"; + + return $database; +} sub log { my $this = shift(); diff --git a/t/ZOOM-IRSpy.t b/t/ZOOM-IRSpy.t index e9bd612..0da4aa0 100644 --- a/t/ZOOM-IRSpy.t +++ b/t/ZOOM-IRSpy.t @@ -17,7 +17,7 @@ my $irspy_to_zeerex_xsl = 'xsl/irspy2zeerex.xsl'; $ZOOM::IRSpy::irspy_to_zeerex_xsl = $irspy_to_zeerex_xsl if $irspy_to_zeerex_xsl; -my $dbname = 'localhost:8018/IR-Explain---1'; +my $dbname = ZOOM::IRSpy::connect_to_registry(); my $spy = new ZOOM::IRSpy( $dbname, "admin", "fruitbat" ); isa_ok( $spy, 'ZOOM::IRSpy' ); -- 1.7.10.4