| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
310
|
use strict; |
|
|
1
|
|
|
|
|
6
|
|
|
|
1
|
|
|
|
|
24
|
|
|
2
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
29
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Z::App; |
|
5
|
1
|
|
|
1
|
|
344
|
use parent 'Z'; |
|
|
1
|
|
|
|
|
256
|
|
|
|
1
|
|
|
|
|
4
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
|
8
|
|
|
|
|
|
|
our $VERSION = '0.001'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
169931
|
use IO::Handle (); |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
78
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub modules { |
|
13
|
1
|
|
|
1
|
0
|
30
|
my @modules = shift->SUPER::modules( @_ ); |
|
14
|
1
|
|
|
|
|
12
|
for my $mod ( @modules ) { |
|
15
|
12
|
100
|
|
|
|
18
|
next unless $mod->[0] eq 'Zydeco::Lite'; |
|
16
|
1
|
|
|
|
|
3
|
$mod->[0] .= '::App'; |
|
17
|
1
|
|
|
|
|
2
|
$mod->[1] = '0'; |
|
18
|
|
|
|
|
|
|
} |
|
19
|
1
|
|
|
|
|
4
|
return @modules; |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
1; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
__END__ |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=pod |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=encoding utf-8 |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 NAME |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Z::App - load Zydeco::Lite::App, strict, warnings, Types::Standard, etc |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
In C<< consumer.pl >>: |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
#! perl |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
use Z::App; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
app 'MyApp' => sub { |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
command 'Eat' => sub { |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
constant documentation => 'Consume some food.'; |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
arg 'foods' => ( |
|
49
|
|
|
|
|
|
|
type => ArrayRef[Str], |
|
50
|
|
|
|
|
|
|
documentation => 'A list of foods.', |
|
51
|
|
|
|
|
|
|
); |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
run { |
|
54
|
|
|
|
|
|
|
my ( $self, $foods ) = ( shift, @_ ); |
|
55
|
|
|
|
|
|
|
$self->info( "Eating $_." ) for @$foods; |
|
56
|
|
|
|
|
|
|
return 0; |
|
57
|
|
|
|
|
|
|
}; |
|
58
|
|
|
|
|
|
|
}; |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
command 'Drink' => sub { |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
constant documentation => 'Consume some drinks.'; |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
arg 'drinks' => ( |
|
65
|
|
|
|
|
|
|
type => ArrayRef[Str], |
|
66
|
|
|
|
|
|
|
documentation => 'A list of drinks.', |
|
67
|
|
|
|
|
|
|
); |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
run { |
|
70
|
|
|
|
|
|
|
my ( $self, $drinks ) = ( shift, @_ ); |
|
71
|
|
|
|
|
|
|
$self->info( "Drinking $_." ) for @$drinks; |
|
72
|
|
|
|
|
|
|
return 0; |
|
73
|
|
|
|
|
|
|
}; |
|
74
|
|
|
|
|
|
|
}; |
|
75
|
|
|
|
|
|
|
}; |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
'MyApp'->execute( @ARGV ); |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
At the command line: |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
$ ./consumer.pl help eat |
|
82
|
|
|
|
|
|
|
usage: consumer.pl eat [<foods>...] |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Consume some food. |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Flags: |
|
87
|
|
|
|
|
|
|
--help Show context-sensitive help. |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Args: |
|
90
|
|
|
|
|
|
|
[<foods>] A list of foods. |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
$ ./consumer.pl eat pizza chocolate |
|
93
|
|
|
|
|
|
|
Eating pizza. |
|
94
|
|
|
|
|
|
|
Eating chocolate. |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Z::App is like L<Z> but loads L<Zydeco::Lite::App> instead of L<Zydeco::Lite>. |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 BUGS |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Please report any bugs to |
|
103
|
|
|
|
|
|
|
L<http://rt.cpan.org/Dist/Display.html?Queue=Zydeco-Lite-App>. |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
L<Z>, L<Zydeco::Lite::App>. |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 AUTHOR |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Toby Inkster E<lt>tobyink@cpan.orgE<gt>. |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
This software is copyright (c) 2020 by Toby Inkster. |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
118
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 DISCLAIMER OF WARRANTIES |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED |
|
123
|
|
|
|
|
|
|
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF |
|
124
|
|
|
|
|
|
|
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
|
125
|
|
|
|
|
|
|
|