File Coverage

blib/lib/Module/Faker/Module.pm
Criterion Covered Total %
statement 11 11 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 15 15 100.0


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