changed use of Spreadsheet::ParseExcel and MARC to require/import so that
authorDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 8 Mar 2004 21:10:02 +0000 (21:10 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 8 Mar 2004 21:10:02 +0000 (21:10 +0000)
dependency on those modules can be resolved in runtime.

git-svn-id: file:///home/dpavlin/private/svn/webpac/branches/hidra@249 13eb9ef6-21d5-0310-b721-a9d68796d827

all2xml.pl

index 8c3c1f7..1edd247 100755 (executable)
@@ -211,7 +211,7 @@ sub data2xml {
                        # placeholder for all repeatable entries for index
 
                        sub chk_eval($) {
-                               my $data = shift || return;
+                               my $data = shift;
                                if ($data =~ s/eval{([^}]+)}//) {
                                        if (eval "$1") {
                                                return $data;
@@ -291,17 +291,16 @@ sub data2xml {
                                }
                                # type="swish" ; field for swish
                                if ($swish) {
-                                       my $tmp;
                                        if ($filter && ($s || $se)) {
                                                no strict 'refs';
                                                my $tmp = join(" ",&$filter($swish)) if ($s || $se);
+                                               $swish_data .= $tmp if ($s);
+                                               $swish_exact_data .= "xxbxx $tmp xxexx " if ($se && $tmp ne "");
+
                                        } else {
-                                               $tmp = $swish;
+                                               $swish_data .= $swish if ($s);
+                                               $swish_exact_data .= "xxbxx $swish xxexx " if ($se && $swish ne "");
                                        }
-
-                                       $tmp = chk_eval($tmp);
-                                       $swish_data .= $tmp if ($s);
-                                       $swish_exact_data .= "xxbxx $tmp xxexx " if ($se && $tmp ne "");
                                }
 
                                # type="display" ; field for display
@@ -741,8 +740,9 @@ print STDERR "using: $type...\n";
                print STDERR "\n";
 
        } elsif ($type_base eq "excel") {
-               use Spreadsheet::ParseExcel;
-               use Spreadsheet::ParseExcel::Utility qw(int2col);
+               require Spreadsheet::ParseExcel;
+               require Spreadsheet::ParseExcel::Utility;
+               import Spreadsheet::ParseExcel::Utility qw(int2col);
                
                $import2cp = Text::Iconv->new($config->{excel_codepage},$codepage);
                my $excel_file = $cfg -> val($database, 'excel_file') || die "$database doesn't have 'excel_file' defined!";
@@ -796,7 +796,7 @@ print STDERR "using: $type...\n";
                }
        } elsif ($type_base eq "marc") {
 
-               use MARC;
+               require MARC;
                
                $import2cp = Text::Iconv->new($config->{marc_codepage},$codepage);
                my $marc_file = $cfg -> val($database, 'marc_file') || die "$database doesn't have 'marc_file' defined!";