File Coverage

blib/lib/Module/Faker/Module.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package Module::Faker::Module 0.025;
2             # ABSTRACT: a faked module
3              
4 8     8   56 use Moose;
  8         19  
  8         77  
5             with 'Module::Faker::Appendix';
6              
7 8     8   53809 use Module::Faker::Package;
  8         17  
  8         1694  
8              
9             has filename => (
10             is => 'ro',
11             isa => 'Str',
12             required => 1,
13             );
14              
15             has packages => (
16             is => 'ro',
17             isa => 'ArrayRef[Module::Faker::Package]',
18             required => 1,
19             auto_deref => 1,
20             );
21              
22             sub as_string {
23             my ($self) = @_;
24              
25             my $string = '';
26              
27             my @packages = $self->packages;
28              
29             for ($packages[0]) {
30             $string .= sprintf "\n=head1 NAME\n\n%s - %s\n\n=cut\n\n",
31             $_->name, $_->abstract // 'a cool package';
32             }
33              
34             for my $pkg ($self->packages) {
35             $string .= $pkg->as_string . "\n";
36             }
37              
38             $string .= "1\n";
39             }
40              
41 8     8   69 no Moose;
  8         27  
  8         63  
42             1;
43              
44             __END__
45              
46             =pod
47              
48             =encoding UTF-8
49              
50             =head1 NAME
51              
52             Module::Faker::Module - a faked module
53              
54             =head1 VERSION
55              
56             version 0.025
57              
58             =head1 PERL VERSION
59              
60             This module should work on any version of perl still receiving updates from
61             the Perl 5 Porters. This means it should work on any version of perl released
62             in the last two to three years. (That is, if the most recently released
63             version is v5.40, then this module should work on both v5.40 and v5.38.)
64              
65             Although it may work on older versions of perl, no guarantee is made that the
66             minimum required version will not be increased. The version may be increased
67             for any reason, and there is no promise that patches will be accepted to lower
68             the minimum required perl.
69              
70             =head1 AUTHOR
71              
72             Ricardo Signes <cpan@semiotic.systems>
73              
74             =head1 COPYRIGHT AND LICENSE
75              
76             This software is copyright (c) 2008 by Ricardo Signes.
77              
78             This is free software; you can redistribute it and/or modify it under
79             the same terms as the Perl 5 programming language system itself.
80              
81             =cut