unroll arrays of hashes for indexing
[angular-mojolicious.git] / trigger / shell.pm
1 sub filter {
2         my $change = shift;
3         return 1 if $change->{doc}->{trigger}->{command};
4 }
5
6
7 sub trigger {
8         my $change = shift;
9         my $trigger = $change->{doc}->{trigger};
10         if ( my $command = $trigger->{command} ) {
11                 # FIXME SECURITY HOLE
12                 my $output = $trigger->{output} = `$command`;
13
14                 $trigger->{output} =
15                         [ map { [ split (/\s+/,$_) ] } split(/\n/,$output) ]
16                         if $trigger->{format} =~ m/table/i;
17         }
18 }
19
20 1;