Ignore:
Timestamp:
2015-01-07T12:20:21+13:00 (9 years ago)
Author:
Jeremy Symon
Message:

Added command to remove a servlet by name

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/package-kits/linux/files/servlet.pl

    r29668 r29669  
    212212    ],
    213213    debug => [
    214         'Dumps the current state to stdout',
     214        'Dumps the current internal state to stdout',
    215215        sub {
    216216            print Dumper $hash;
     
    218218    ],
    219219    count => [
    220         'Returns the number of servlets in the internal state',
     220        'Returns the number of servlets in the current internal state',
    221221        sub {
    222222            my $count = 0;
     
    247247            }
    248248        },
     249    ],
     250    remove => [
     251        'Removes a servlet from the current internal state',
     252        sub {
     253            my $name = shift @ARGV;
     254            if (defined $hash->{servlet}) {
     255                my $servlets = $hash->{servlet};
     256                if (ref $servlets eq 'ARRAY') {
     257                    my @array = grep { $_->{'servlet-name'} ne $name } @$servlets;
     258                    $hash->{servlet} = \@array;
     259                } elsif ($servlets->{'servlet-name'} eq $name) {
     260                    delete $hash->{servlet};
     261                }
     262            }
     263        },
     264        1,
    249265    ],
    250266);
Note: See TracChangeset for help on using the changeset viewer.