File Coverage

blib/lib/DoitX/Example.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 1 3 33.3
total 22 24 91.6


line stmt bran cond sub pod time code
1             # -*- perl -*-
2              
3             #
4             # Author: Slaven Rezic
5             #
6             # Copyright (C) 2017,2018 Slaven Rezic. All rights reserved.
7             # This package is free software; you can redistribute it and/or
8             # modify it under the same terms as Perl itself.
9             #
10             # Mail: slaven@rezic.de
11             # WWW: http://www.rezic.de/eserte/
12             #
13              
14             package DoitX::Example;
15              
16 1     1   17 use strict;
  1         2  
  1         32  
17 1     1   6 use warnings;
  1         5  
  1         55  
18             our $VERSION = '0.011';
19              
20 1     1   5 use Doit::Log; # imports info, warning, error ...
  1         2  
  1         154  
21              
22             # Provide a constructor just creating a blessed DoitX::Example
23 1     1 0 10 sub new { bless {}, shift }
24              
25             # List all functions which should be available as Doit commands.
26             # Commands should have a distinct prefix (here: "example_"), to
27             # avoid clashes with other Doit component commands. As a convention,
28             # use the 2nd part of the module name, in lower case.
29 1     1 0 4 sub functions { qw(example_hello_world) }
30              
31             # The definition of the command. Note that $self is really a
32             # Doit::Runner object, not a DoitX::Example object. This way
33             # it's possible to use Doit commands here.
34             sub example_hello_world {
35 1     1 1 3 my($self, $arg) = @_;
36 1         5 info "example_hello_world called with arg=$arg";
37 1         269 $self->system($^X, '-e', q{print "hello, world\n"});
38 1         95 42;
39             }
40              
41             1;
42              
43             __END__