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
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
17
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
40
|
|
18
|
|
|
|
|
|
|
our $VERSION = '0.011'; |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
5
|
use Doit::Log; # imports info, warning, error ... |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
125
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# Provide a constructor just creating a blessed DoitX::Example |
23
|
1
|
|
|
1
|
0
|
7
|
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
|
3
|
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
|
2
|
my($self, $arg) = @_; |
36
|
1
|
|
|
|
|
5
|
info "example_hello_world called with arg=$arg"; |
37
|
1
|
|
|
|
|
241
|
$self->system($^X, '-e', q{print "hello, world\n"}); |
38
|
1
|
|
|
|
|
111
|
42; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |