Changeset 9229


Ignore:
Timestamp:
2005-03-01T15:22:06+13:00 (19 years ago)
Author:
davidb
Message:

Added default_process_exp to ZIPPlug, so GLI can "see" that it likes
.tar files, (.tgz, ...)

File:
1 edited

Legend:

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

    r6408 r9229  
    5757}
    5858
     59my $arguments =
     60    [ { 'name' => "process_exp",
     61    'desc' => "{BasPlug.process_exp}",
     62    'type' => "string",
     63    'deft' => &get_default_process_exp(),
     64    'reqd' => "no" } ];
     65
    5966my $options = { 'name'     => "ZIPPlug",
    6067        'desc'     => "{ZIPPlug.desc}",
    6168        'abstract' => "no",
    62         'inherits' => "yes" };
     69        'inherits' => "yes",
     70        'args'     => $arguments };
    6371
    6472sub new {
    6573    my ($class) = @_;
    6674    my $self = new BasPlug ("ZIPPlug", @_);
     75    $self->{'plugin_type'} = "ZIPPlug";
    6776
    6877    # 14-05-02 To allow for proper inheritance of arguments - John Thompson
     
    7079    push( @{$option_list}, $options );
    7180
     81    if (!parsargv::parse(\@_,
     82             q^process_exp/.*/^, \$self->{'process_exp'},
     83             "allow_extra_options")) {
     84    print STDERR "\nIncorrect options passed to ZIPPlug, check your collect.cfg configuration file\n";
     85    $self->print_txt_usage("");  # Use default resource bundle
     86        die "\n";
     87    }
     88
     89    # BasPlug is explicitly set not to set process_exp if recursive plugin
     90    # Not sure of this reasoning.  Want it to be set in ZIPPlug, so explicitly
     91    # pass it in as default value
     92    if (!$self->{'process_exp'}) {
     93    $self->{'process_exp'} = get_default_process_exp();
     94    }
     95
    7296    return bless $self, $class;
    7397}
     
    78102
    79103    return 1;
     104}
     105
     106sub get_default_process_exp {
     107    return q^(?i)\.(gz|tgz|z|taz|bz|bz2|zip|jar|tar)$^;
    80108}
    81109
     
    88116    my $outhandle = $self->{'outhandle'};
    89117
    90     if ($file =~ /\.(gz|tgz|z|taz|bz|bz2|zip|jar|tar)$/i) {
     118    if ($file =~ /$self->{'process_exp'}/) {
    91119
    92120    my $filename = $file;
Note: See TracChangeset for help on using the changeset viewer.