From: Wolfram Schneider Date: Wed, 14 Apr 2010 13:24:13 +0000 (+0000) Subject: add wrapper to read the IRSpy database name from environment variable / apache config X-Git-Tag: CPAN-v1.02~54^2~84 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=922431d5c98a82b37bba080d09ecde4fcbc0202e;p=irspy-moved-to-github.git add wrapper to read the IRSpy database name from environment variable / apache config --- 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' );