r971@llin: dpavlin | 2006-09-24 20:04:20 +0200
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 24 Sep 2006 18:52:31 +0000 (18:52 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 24 Sep 2006 18:52:31 +0000 (18:52 +0000)
 iterate_inputs now returns also database name and full database config [0.02]

git-svn-id: svn+ssh://mjesec/home/dpavlin/svn/webpac2/trunk@688 07558da8-63fa-0310-ba24-9fe276d99e06

lib/WebPAC/Config.pm
t/1-config.t

index 9e6f7af..efeb941 100644 (file)
@@ -14,11 +14,11 @@ WebPAC::Config - handle WebPAC configuration file
 
 =head1 VERSION
 
-Version 0.01
+Version 0.02
 
 =cut
 
-our $VERSION = '0.01';
+our $VERSION = '0.02';
 
 =head1 SYNOPSIS
 
@@ -136,7 +136,7 @@ sub webpac {
 =head2 iterate_inputs
 
   $config->iterate_inputs( sub {
-       my $input = shift;
+       my ($input, $database, $database_config_hash) = @_;
        # ... do something with input config hash
   } );
 
@@ -162,7 +162,7 @@ sub iterate_inputs {
 
                foreach my $input (@inputs) {
                        $log->debug("iterating over input ", dump($input));
-                       $code_ref->($input);
+                       $code_ref->($input, $database, $db_config);
                }
        }
 
index 3dcc7b0..650df47 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 
 use strict;
-use Test::More tests => 12;
+use Test::More tests => 24;
 use Test::Exception;
 use blib;
 
@@ -42,6 +42,8 @@ isa_ok(\@inputs, 'ARRAY', "inputs");
 cmp_ok(@inputs, '==', 2, "got 2 webpac inputs");
 
 $config->iterate_inputs(sub {
-       my $input = shift;
-       diag "input = ",dump($input);
+       my ($input,$database,$db_config) = @_;
+       isa_ok($input, 'HASH', 'input');
+       ok($database, 'database');
+       isa_ok($db_config, 'HASH', 'database config');
 });