| 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 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 17 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 18 | 1 | our $VERSION = '0.011'; | |
| 19 | |||
| 20 | 1 | ▶ | use Doit::Log; # imports info, warning, error ... |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 21 | |||
| 22 | # Provide a constructor just creating a blessed DoitX::Example | ||
| 23 | 1 | ▶ | sub new { bless {}, shift } |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 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 | ▶ | sub functions { qw(example_hello_world) } |
|
Subroutine
functions: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 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 | ▶ | my($self, $arg) = @_; |
|
Subroutine
example_hello_world: called CC=1 SCAR=0.0
Pod
documented
| |||
| 36 | 1 | info "example_hello_world called with arg=$arg"; | |
| 37 | 1 | $self->system($^X, '-e', q{print "hello, world\n"}); | |
| 38 | 1 | 42; | |
| 39 | } | ||
| 40 | |||
| 41 | 1 | 1; | |
| 42 | |||
| 43 | __END__ | ||