Ignore:
Timestamp:
1999-08-04T17:23:41+12:00 (25 years ago)
Author:
sjboddie
Message:

added gzip option to import.pl

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/plugins/GMLPlug.pm

    r317 r433  
    4747
    4848    # see if this is a gml book
    49     return undef unless (-f $fullname && $fullname =~ /\.gml$/i);
     49    return undef unless (-f $fullname && $fullname =~ /\.gml(\.gz)?$/i);
    5050
    51     my ($parent_dir) = $fullname =~ /^(.*)\/[^\/]+.gml$/;
     51    my ($parent_dir, $gz) = $fullname =~ /^(.*)\/[^\/]+.gml(\.gz)?$/i;
     52
     53    if (defined $gz && $gz =~ /\.gz/i) {
     54    $gz = 1;
     55    } else {
     56    $gz = 0;
     57    }
    5258
    5359    # create a new document
     
    6066    my $gml = "";
    6167    my $line = "";
    62     if (!open (INFILE, $fullname)) {
    63     print STDERR "GMLPlug::read - couldn't read $fullname\n";
    64     return undef;
     68
     69    if ($gz) {
     70    if (!open (INFILE, "zcat $fullname |")) {
     71        print STDERR "GMLPlug::read - zcat couldn't read $fullname\n";
     72        return undef;
     73    }
     74    } else {
     75    if (!open (INFILE, $fullname)) {
     76        print STDERR "GMLPlug::read - couldn't read $fullname\n";
     77        return undef;
     78    }
    6579    }
     80
    6681    while (defined ($line = <INFILE>)) {
    6782    $gml .= $line;
Note: See TracChangeset for help on using the changeset viewer.