File Coverage

blib/lib/POE/Component/IRC/Plugin/BotCommand.pm
Criterion Covered Total %
statement 183 207 88.4
branch 80 134 59.7
condition 15 54 27.7
subroutine 20 20 100.0
pod 5 10 50.0
total 303 425 71.2


line stmt bran cond sub pod time code
1             package POE::Component::IRC::Plugin::BotCommand;
2             # vim: set expandtab ts=4 sw=4 ai:
3             $POE::Component::IRC::Plugin::BotCommand::VERSION = '6.95';
4 9     9   9285 use strict;
  9         23  
  9         509  
5 9     9   56 use warnings FATAL => 'all';
  9         18  
  9         771  
6 9     9   60 use Carp;
  9         17  
  9         1099  
7 9     9   63 use IRC::Utils qw( parse_user strip_color strip_formatting );
  9         18  
  9         868  
8 9     9   61 use POE::Component::IRC::Plugin qw( :ALL );
  9         21  
  9         19606  
9              
10             sub new {
11 8     8 1 6324 my ($package) = shift;
12 8 50       41 croak "$package requires an even number of arguments" if @_ & 1;
13 8         40 my %args = @_;
14              
15 8 50       61 $args{Method} = 'notice' if !defined $args{Method};
16              
17 8         20 for my $cmd (keys %{ $args{Commands} }) {
  8         35  
18 11 100       37 if (ref $args{Commands}->{$cmd} eq 'HASH') {
19             croak "$cmd: no info provided"
20 1 50       3 if !exists $args{Commands}->{$cmd}->{info} ;
21             $args{Commands}->{lc $cmd}->{handler} =
22             sprintf("irc_botcmd_%s", lc($cmd))
23 1 50       6 if !$args{Commands}->{lc $cmd}->{handler};
24             }
25 11         40 $args{Commands}->{lc $cmd} = delete $args{Commands}->{$cmd};
26             }
27 8         36 return bless \%args, $package;
28             }
29              
30             sub PCI_register {
31 8     8 0 972 my ($self, $irc) = splice @_, 0, 2;
32              
33 8 100       62 $self->{Addressed} = 1 if !defined $self->{Addressed};
34 8 100       36 $self->{Prefix} = '!' if !defined $self->{Prefix};
35 8 50       39 $self->{In_channels} = 1 if !defined $self->{In_channels};
36 8 50       56 $self->{In_private} = 1 if !defined $self->{In_private};
37 8         83 $self->{rx_cmd_args} = qr/^(\S+)(?:\s+(.+))?$/;
38 8         24 $self->{irc} = $irc;
39              
40 8         68 $irc->plugin_register( $self, 'SERVER', qw(msg public) );
41 8         414 return 1;
42             }
43              
44             sub PCI_unregister {
45 8     8 0 2105 return 1;
46             }
47              
48             sub S_msg {
49 2     2 0 116 my ($self, $irc) = splice @_, 0, 2;
50 2         4 my $who = ${ $_[0] };
  2         6  
51 2         12 my $where = parse_user($who);
52 2         210 my $what = ${ $_[2] };
  2         8  
53              
54 2 50       10 return PCI_EAT_NONE if !$self->{In_private};
55 2         9 $what = $self->_normalize($what);
56              
57 2 50       10 if (!$self->{Bare_private}) {
58 0 0       0 return PCI_EAT_NONE if $what !~ s/^\Q$self->{Prefix}\E//;
59             }
60              
61 2         5 my ($cmd, $args);
62 2 50       27 if (!(($cmd, $args) = $what =~ $self->{rx_cmd_args})) {
63 0         0 return PCI_EAT_NONE;
64             }
65              
66 2         12 $self->_handle_cmd($who, $where, $cmd, $args);
67 2 50       12 return $self->{Eat} ? PCI_EAT_PLUGIN : PCI_EAT_NONE;
68             }
69              
70             sub S_public {
71 16     16 0 856 my ($self, $irc) = splice @_, 0, 2;
72 16         42 my $who = ${ $_[0] };
  16         39  
73 16         33 my $where = ${ $_[1] }->[0];
  16         52  
74 16         28 my $what = ${ $_[2] };
  16         42  
75 16         87 my $me = $irc->nick_name();
76              
77 16 50       68 return PCI_EAT_NONE if !$self->{In_channels};
78 16         57 $what = $self->_normalize($what);
79              
80 16 100       63 if ($self->{Addressed}) {
81 10 50       382 return PCI_EAT_NONE if !(($what) = $what =~ m/^\s*\Q$me\E[:,;.!?~]?\s*(.*)$/);
82             }
83             else {
84 6 50       96 return PCI_EAT_NONE if $what !~ s/^\Q$self->{Prefix}\E//;
85             }
86              
87 16         48 my ($cmd, $args);
88 16 50       189 if (!(($cmd, $args) = $what =~ $self->{rx_cmd_args})) {
89 0         0 return PCI_EAT_NONE;
90             }
91              
92 16         77 $self->_handle_cmd($who, $where, $cmd, $args);
93 16 100       96 return $self->{Eat} ? PCI_EAT_PLUGIN : PCI_EAT_NONE;
94             }
95              
96             sub _normalize {
97 18     18   45 my ($self, $line) = @_;
98 18         86 $line = strip_color($line);
99 18         460 $line = strip_formatting($line);
100 18         381 return $line;
101             }
102              
103             sub _handle_cmd {
104 18     18   62 my ($self, $who, $where, $cmd, $args) = @_;
105 18         64 my $irc = $self->{irc};
106 18 50       47 my $chantypes = join('', @{ $irc->isupport('CHANTYPES') || ['#', '&']});
  18         106  
107 18 100       347 my $public = $where =~ /^[$chantypes]/ ? 1 : 0;
108 18         51 $cmd = lc $cmd;
109              
110 18         38 my $cmd_unresolved = $cmd;
111              
112 18 50       81 if((my $cmd_resolved = $self->resolve_alias($cmd)))
113             {
114 0         0 $cmd = $cmd_resolved;
115             }
116              
117              
118 18 100       87 if (defined $self->{Commands}->{$cmd}) {
119 11 100       43 if (ref $self->{Commands}->{$cmd} eq 'HASH') {
120 1 50       5 my @args_array = defined $args ? split /\s+/, $args : ();
121 1 50 33     9 if (defined($self->{Commands}->{$cmd}->{args}) &&
      33        
      33        
      33        
122             ref($self->{Commands}->{$cmd}->{args}) eq 'ARRAY' &&
123 1         4 @{ $self->{Commands}->{$cmd}->{args} } &&
124             (@args_array < @{ $self->{Commands}->{$cmd}->{args} } ||
125             (!defined $self->{Commands}->{$cmd}->{variable} &&
126             @args_array > @{ $self->{Commands}->{$cmd}->{args} }))
127             ) {
128 0         0 $irc->yield($self->{Method}, $where,
129             "Not enough or too many arguments. See help for $cmd");
130 0         0 return;
131             }
132              
133 1 50 0     4 if(defined $self->{Commands}->{$cmd}->{variable} ||
      0        
      33        
134             (defined($self->{Commands}->{$cmd}->{args}) &&
135             ref($self->{Commands}->{$cmd}->{args}) eq 'ARRAY' &&
136 0         0 @{ $self->{Commands}->{$cmd}->{args} }))
137             {
138 1         2 $args = {};
139 1 50 33     9 if( defined($self->{Commands}->{$cmd}->{args}) &&
      33        
140             ref($self->{Commands}->{$cmd}->{args}) eq 'ARRAY' &&
141 1         3 @{ $self->{Commands}->{$cmd}->{args} })
142             {
143 1         2 for (@{ $self->{Commands}->{$cmd}->{args} }) {
  1         4  
144 2         4 my $in_arg = shift @args_array;
145 2 100       5 if (ref $self->{Commands}->{$cmd}->{$_} eq 'ARRAY') {
146 1         2 my @values = @{ $self->{Commands}->{$cmd}->{$_} };
  1         3  
147 1         2 shift @values;
148              
149 9     9   110 use List::Util qw(none);
  9         20  
  9         22206  
150             # Check if argument has one of possible values
151 1 50   1   9 if (none { $_ eq $in_arg} @values) {
  1         4  
152 0         0 $irc->yield($self->{Method}, $where,
153             "$_ can be one of ".join '|', @values);
154 0         0 return;
155             }
156              
157             }
158 2         6 $args->{$_} = $in_arg;
159             }
160             }
161              
162             # Process remaining arguments if variable is set
163 1         2 my $arg_cnt = 0;
164 1 50       101 if (defined $self->{Commands}->{$cmd}->{variable}) {
165 1         3 for (@args_array) {
166 1         5 $args->{"opt".$arg_cnt++} = $_;
167             }
168             }
169             }
170             }
171             }
172              
173 18 100       134 if (ref $self->{Auth_sub} eq 'CODE') {
174 3         17 my ($authed, $errors) = $self->{Auth_sub}->($self->{irc}, $who, $where, $cmd, $args, $cmd_unresolved);
175              
176 3 100       25 if (!$authed) {
177 1 50       6 my @errors = ref $errors eq 'ARRAY'
178             ? @$errors
179             : 'You are not authorized to use this command.';
180 1 50       5 if (!$self->{Ignore_unauthorized}) {
181 1         4 for my $error (@errors) {
182 1         8 $irc->yield($self->{Method}, $where, $error);
183             }
184             }
185 1         162 return;
186             }
187             }
188              
189 17 100       94 if (defined $self->{Commands}->{$cmd}) {
    50          
    0          
190 11 100       49 my $handler = (ref($self->{Commands}->{$cmd}) eq 'HASH' ? $self->{Commands}->{$cmd}->{handler} : "irc_botcmd_$cmd");
191 11         167 $irc->send_event_next($handler => $who, $where, $args, $cmd, $cmd_unresolved);
192             }
193             elsif ($cmd =~ /^help$/i) {
194 6         22 my @help = $self->_get_help($args, $public);
195 6         47 $irc->yield($self->{Method} => $where => $_) for @help;
196             }
197             elsif (!$self->{Ignore_unknown}) {
198 0         0 my @help = $self->_get_help($cmd, $public);
199 0         0 $irc->yield($self->{Method} => $where => $_) for @help;
200             }
201              
202 17         2286 return;
203             }
204              
205             sub _get_help {
206 6     6   18 my ($self, $args, $public) = @_;
207 6         15 my $irc = $self->{irc};
208             my $p = $self->{Addressed} && $public
209             ? $irc->nick_name().': '
210 6 50 33     43 : $self->{Prefix};
211              
212 6         15 my @help;
213 6 100       22 if (defined $args) {
214 3         13 my $cmd = (split /\s+/, $args, 2)[0];
215              
216 3         10 $cmd = lc $cmd;
217              
218 3   33     32 my $cmd_resolved = $self->resolve_alias($cmd) || $cmd;
219              
220 3 100       14 if (exists $self->{Commands}->{$cmd_resolved}) {
221 1 50       7 if (ref $self->{Commands}->{$cmd_resolved} eq 'HASH') {
222             push @help, "Syntax: $p$cmd".
223             ( defined($self->{Commands}->{$cmd_resolved}->{args}) &&
224             ref($self->{Commands}->{$cmd_resolved}->{args}) eq 'ARRAY' ?
225 1         116 " ".join ' ', @{ $self->{Commands}->{$cmd_resolved}->{args} } :
226             "" ).
227             (defined $self->{Commands}->{$cmd_resolved}->{variable} ?
228 1 50 33     12 " ..." : "");
    50          
229             push @help, split /\015?\012/,
230 1         7 "Description: ".$self->{Commands}->{$cmd_resolved}->{info};
231 1 50 33     11 if( defined($self->{Commands}->{$cmd_resolved}->{args}) &&
      33        
232             ref($self->{Commands}->{$cmd_resolved}->{args}) eq 'ARRAY' &&
233 1         5 @{ $self->{Commands}->{$cmd_resolved}->{args} })
234             {
235 1         4 push @help, "Arguments:";
236              
237 1         3 for my $arg (@{ $self->{Commands}->{$cmd_resolved}->{args} }) {
  1         6  
238 2 50       7 next if not defined $self->{Commands}->{$cmd_resolved}->{$arg};
239 2 100       8 if (ref $self->{Commands}->{$cmd_resolved}->{$arg} eq 'ARRAY') {
240 1         2 my @arg_usage = @{$self->{Commands}->{$cmd_resolved}->{$arg}};
  1         5  
241 1         8 push @help, " $arg: ".$arg_usage[0].
242             " (".(join '|', @arg_usage[1..$#arg_usage]).")"
243             }
244             else {
245             push @help, " $arg: ".
246 1         6 $self->{Commands}->{$cmd_resolved}->{$arg};
247             }
248             }
249             }
250              
251             push @help, "Alias of: ${p}${cmd_resolved}" .
252             (ref($self->{Commands}->{$cmd_resolved}->{args}) eq 'ARRAY' ?
253 0         0 " ".join ' ', @{ $self->{Commands}->{$cmd_resolved}->{args} } :
254             "" ).
255             (defined $self->{Commands}->{$cmd_resolved}->{variable} ?
256 1 0       4 " ..." : "")
    0          
    50          
257             if $cmd_resolved ne $cmd;
258              
259 1         5 my @aliases = grep { $_ ne $cmd } $self->list_aliases($cmd_resolved);
  0         0  
260              
261 1 50       4 if($cmd_resolved ne $cmd)
262             {
263 0         0 push @aliases, $cmd_resolved;
264             }
265              
266 1 50       4 push @help, "Aliases: ".join( " ", @aliases) if scalar(@aliases);
267             }
268             else {
269 0         0 @help = split /\015?\012/, $self->{Commands}->{$cmd};
270             }
271             }
272             else {
273 2         32 push @help, "Unknown command: $cmd";
274 2         9 push @help, "To get a list of commands, use: ${p}help";
275             }
276             }
277             else {
278 3 100       6 if (keys %{ $self->{Commands} }) {
  3         14  
279 1         3 push @help, 'Commands: ' . join ', ', sort keys %{ $self->{Commands} };
  1         9  
280 1         3 push @help, "For more details, use: ${p}help ";
281             }
282             else {
283 2         17 push @help, 'No commands are defined';
284             }
285             }
286              
287 6 50       43 if(ref($self->{'Help_sub'}) eq 'CODE')
288             {
289 0 0       0 my ($cmd, $args) = (defined $args ? split /\s+/, $args, 2 : ('', ''));
290              
291 0   0     0 my $cmd_resolved = $self->resolve_alias($cmd) || $cmd;
292              
293 0         0 return $self->{'Help_sub'}->($self->{irc}, $cmd, $cmd_resolved, $args, @help);
294             }
295             else
296             {
297 6         26 return @help;
298             }
299             }
300              
301             sub add {
302 8     8 1 3314 my ($self, $cmd, $usage) = @_;
303 8         60 $cmd = lc $cmd;
304 8 50       51 return if exists $self->{Commands}->{$cmd};
305              
306 8 100       52 if (ref $usage eq 'HASH') {
307 1 50 33     7 return if !exists $usage->{info} || !@{ $usage->{args} };
  1         5  
308             }
309              
310 8         44 $self->{Commands}->{$cmd} = $usage;
311 8         58 return 1;
312             }
313              
314             sub remove {
315 5     5 1 17 my ($self, $cmd) = @_;
316 5         15 $cmd = lc $cmd;
317 5 50       26 return if !exists $self->{Commands}->{$cmd};
318 5         16 delete $self->{Commands}->{$cmd};
319 5         22 return 1;
320             }
321              
322             sub list {
323 26     26 1 63 my ($self) = @_;
324 26         53 return %{ $self->{Commands} };
  26         159  
325             }
326              
327             sub resolve_alias {
328 21     21 1 52 my ($self, $alias) = @_;
329            
330 21         76 my %cmds = $self->list();
331              
332             #TODO: refactor using smartmatch/Perl6::Junction if feasible
333 21         102 while(my ($cmd, $info) = each(%cmds))
334             {
335 32 100       147 next unless ref($info) eq 'HASH';
336 6 50 33     32 next unless $info->{aliases} && ref($info->{aliases}) eq 'ARRAY';
337 0         0 my @aliases = @{$info->{aliases}};
  0         0  
338            
339 0         0 foreach my $cmdalias (@aliases)
340             {
341 0 0       0 return $cmd if $alias eq $cmdalias;
342             }
343             }
344              
345 21         124 return undef;
346             }
347              
348             sub list_aliases
349             {
350 1     1 0 4 my ($self, $cmd) = @_;
351 1         3 $cmd = lc $cmd;
352 1 50       5 return if !exists $self->{Commands}->{$cmd};
353 1 50       4 return unless ref($self->{Commands}->{$cmd}) eq 'HASH';
354 1 50 33     8 return unless exists $self->{Commands}->{$cmd}->{aliases} && ref($self->{Commands}->{$cmd}->{aliases}) eq 'ARRAY';
355 0           return @{$self->{Commands}->{$cmd}->{aliases}};
  0            
356              
357             }
358              
359             1;
360              
361             =encoding utf8
362              
363             =head1 NAME
364              
365             POE::Component::IRC::Plugin::BotCommand - A PoCo-IRC plugin which handles
366             commands issued to your bot
367              
368             =head1 SYNOPSIS
369              
370             use POE;
371             use POE::Component::Client::DNS;
372             use POE::Component::IRC;
373             use POE::Component::IRC::Plugin::BotCommand;
374              
375             my @channels = ('#channel1', '#channel2');
376             my $dns = POE::Component::Client::DNS->spawn();
377             my $irc = POE::Component::IRC->spawn(
378             nick => 'YourBot',
379             server => 'some.irc.server',
380             );
381              
382             POE::Session->create(
383             package_states => [
384             main => [ qw(_start irc_001 irc_botcmd_slap irc_botcmd_lookup dns_response) ],
385             ],
386             );
387              
388             $poe_kernel->run();
389              
390             sub _start {
391             $irc->plugin_add('BotCommand', POE::Component::IRC::Plugin::BotCommand->new(
392             Commands => {
393             slap => 'Takes one argument: a nickname to slap.',
394             lookup => 'Takes two arguments: a record type (optional), and a host.',
395             }
396             ));
397             $irc->yield(register => qw(001 botcmd_slap botcmd_lookup));
398             $irc->yield(connect => { });
399             }
400              
401             # join some channels
402             sub irc_001 {
403             $irc->yield(join => $_) for @channels;
404             return;
405             }
406              
407             # the good old slap
408             sub irc_botcmd_slap {
409             my $nick = (split /!/, $_[ARG0])[0];
410             my ($where, $arg) = @_[ARG1, ARG2];
411             $irc->yield(ctcp => $where, "ACTION slaps $arg");
412             return;
413             }
414              
415             # non-blocking dns lookup
416             sub irc_botcmd_lookup {
417             my $nick = (split /!/, $_[ARG0])[0];
418             my ($where, $arg) = @_[ARG1, ARG2];
419             my ($type, $host) = $arg =~ /^(?:(\w+) )?(\S+)/;
420              
421             my $res = $dns->resolve(
422             event => 'dns_response',
423             host => $host,
424             type => $type,
425             context => {
426             where => $where,
427             nick => $nick,
428             },
429             );
430             $poe_kernel->yield(dns_response => $res) if $res;
431             return;
432             }
433              
434             sub dns_response {
435             my $res = $_[ARG0];
436             my @answers = map { $_->rdatastr } $res->{response}->answer() if $res->{response};
437              
438             $irc->yield(
439             'notice',
440             $res->{context}->{where},
441             $res->{context}->{nick} . (@answers
442             ? ": @answers"
443             : ': no answers for "' . $res->{host} . '"')
444             );
445              
446             return;
447             }
448              
449             =head1 DESCRIPTION
450              
451             POE::Component::IRC::Plugin::BotCommand is a
452             L plugin. It provides you with a
453             standard interface to define bot commands and lets you know when they are
454             issued. Commands are accepted as channel or private messages.
455              
456             The plugin will respond to the 'help' command by default, listing available
457             commands and information on how to use them. However, if you add a help
458             command yourself, that one will be used instead.
459              
460             =head1 METHODS
461              
462             =head2 C
463              
464             B<'Commands'>, a hash reference, with your commands as keys, and usage
465             information as values. If the usage string contains newlines, the plugin
466             will send one message for each line.
467              
468             If a command's value is a HASH ref like this:
469              
470             $irc->plugin_add('BotCommand', POE::Component::IRC::Plugin::BotCommand->new(
471             Commands => {
472             slap => {
473             info => 'Slap someone',
474             args => [qw(nickname)],
475             nickname => 'nickname to slap'
476             }
477             }
478             ));
479              
480             The args array reference is than used to validate number of arguments required
481             and to name arguments passed to event handler. Help is than generated from
482             C and other hash keys which represent arguments (they are optional).
483              
484             An optional C key can be specified inside the HASH ref to override the event handler.
485             The irc_botcmd_ prefix is not automatically prepended to the handler name when overriding it.
486              
487             An optional C key can be specified inside the HASH ref containing a array ref with alias names.
488             The aliases can be specified for help and to run the command.
489              
490             =head3 Accepting commands
491              
492             B<'In_channels'>, a boolean value indicating whether to accept commands in
493             channels. Default is true.
494              
495             B<'In_private'>, a boolean value indicating whether to accept commands in
496             private. Default is true.
497              
498             B<'Addressed'>, requires users to address the bot by name in order
499             to issue commands. Default is true.
500              
501             B<'Prefix'>, a string which all commands must be prefixed with (except in
502             channels when B<'Addressed'> is true). Default is '!'. You can set it to ''
503             to allow bare commands.
504              
505             B<'Bare_private'>, a boolean value indicating whether bare commands (without
506             the prefix) are allowed in private messages. Default is false.
507              
508             =head3 Authorization
509              
510             B<'Auth_sub'>, a subroutine reference which, if provided, will be called
511             for every command. The subroutine will be called in list context. If the
512             first value returned is true, the command will be processed as normal. If
513             the value is false, then no events will be generated, and an error message
514             will possibly be sent back to the user.
515              
516             You can override the default error message by returning a second value, an
517             array reference of (zero or more) strings. Each string will be sent as a
518             message to the user.
519              
520             Your subroutine will be called with the following arguments:
521              
522             =over 4
523              
524             =item 1. The IRC component object
525              
526             =item 2. The nick!user@host of the user
527              
528             =item 3. The place where the command was issued (the nickname of the user if
529             it was in private)
530              
531             =item 4. The name of the command
532              
533             =item 5. The command argument string
534              
535             =back
536              
537             B<'Ignore_unauthorized'>, if true, the plugin will ignore unauthorized
538             commands, rather than printing an error message upon receiving them. This is
539             only relevant if B<'Auth_sub'> is also supplied. Default is false.
540              
541             =head3 Help Command
542              
543             B<'Help_sub'>, a subroutine reference which, if provided, will be called upon
544             the end of the predefined help command. The subroutine will be called in list context.
545              
546             Your subroutine will be called with the following arguments:
547              
548             =over 4
549              
550             =item 1. The IRC component object
551              
552             =item 2. The command.
553              
554             =item 3. The resolved command(after alias processing).
555              
556             =item 4. The arguments.
557              
558             =item 5. The generated help text as array.
559              
560              
561             =back
562              
563              
564             =head3 Miscellaneous
565              
566             B<'Ignore_unknown'>, if true, the plugin will ignore undefined commands,
567             rather than printing a help message upon receiving them. Default is false.
568              
569             B<'Method'>, how you want help messages to be delivered. Valid options are
570             'notice' (the default) and 'privmsg'.
571              
572             B<'Eat'>, set to true to make the plugin hide
573             L|POE::Component::IRC/irc_public> events from other plugins
574             when they look like commands. Probably only useful when a B<'Prefix'> is
575             defined. Default is false.
576              
577             Returns a plugin object suitable for feeding to
578             L's C method.
579              
580             =head2 C
581              
582             Adds a new command. Takes two arguments, the name of the command, and a string
583             or hash reference containing its usage information (see C). Returns false
584             if the command has already been defined or no info or arguments are provided,
585             true otherwise.
586              
587             =head2 C
588              
589             Removes a command. Takes one argument, the name of the command. Returns false
590             if the command wasn't defined to begin with, true otherwise.
591              
592             =head2 C
593              
594             Takes no arguments. Returns a list of key/value pairs, the keys being the
595             command names and the values being the usage strings or hash references.
596              
597             =head2 C
598              
599             Takes one argument, a string to match against command aliases, if no matching
600             command can be found undef is returned.
601              
602             =head1 OUTPUT EVENTS
603              
604             =head2 C
605              
606             You will receive an event like this for every valid command issued. E.g. if
607             'slap' were a valid command, you would receive an C event
608             every time someone issued that command. It receives the following arguments:
609              
610             =over 4
611              
612             =item * C: the nick!hostmask of the user who issued the command.
613              
614             =item * C is the name of the channel in which the command was issued,
615             or the sender's nickname if this was a private message.
616              
617             =item * C: a string of arguments to the command, or hash reference with
618             arguments in case you defined command along with arguments, or undef if there
619             were no arguments
620              
621             =back
622              
623             =head1 AUTHOR
624              
625             Hinrik Ern SigurEsson, hinrik.sig@gmail.com
626              
627             =cut