| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Module::Faker::Package; |
|
2
|
|
|
|
|
|
|
# ABSTRACT: a faked package in a faked module |
|
3
|
|
|
|
|
|
|
$Module::Faker::Package::VERSION = '0.022'; |
|
4
|
8
|
|
|
8
|
|
56
|
use Moose; |
|
|
8
|
|
|
|
|
22
|
|
|
|
8
|
|
|
|
|
74
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
8
|
|
|
8
|
|
53202
|
use Moose::Util::TypeConstraints; |
|
|
8
|
|
|
|
|
39
|
|
|
|
8
|
|
|
|
|
68
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has name => (is => 'ro', isa => 'Str', required => 1); |
|
9
|
|
|
|
|
|
|
has version => (is => 'ro', isa => 'Maybe[Str]'); |
|
10
|
|
|
|
|
|
|
has abstract => (is => 'ro', isa => 'Maybe[Str]'); |
|
11
|
|
|
|
|
|
|
has style => (is => 'ro', default => 'legacy'); |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has in_file => ( |
|
14
|
|
|
|
|
|
|
is => 'ro', |
|
15
|
|
|
|
|
|
|
isa => 'Str', |
|
16
|
|
|
|
|
|
|
lazy => 1, |
|
17
|
|
|
|
|
|
|
default => sub { |
|
18
|
|
|
|
|
|
|
my ($self) = @_; |
|
19
|
|
|
|
|
|
|
my $name = $self->name; |
|
20
|
|
|
|
|
|
|
$name =~ s{::}{/}g; |
|
21
|
|
|
|
|
|
|
return "lib/$name"; |
|
22
|
|
|
|
|
|
|
}, |
|
23
|
|
|
|
|
|
|
); |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _format_legacy { |
|
26
|
36
|
|
|
36
|
|
81
|
my ($self) = @_; |
|
27
|
|
|
|
|
|
|
|
|
28
|
36
|
|
|
|
|
59
|
my $string = q{}; |
|
29
|
|
|
|
|
|
|
|
|
30
|
36
|
|
|
|
|
938
|
$string .= sprintf "package %s;\n", $self->name; |
|
31
|
36
|
100
|
|
|
|
958
|
$string .= sprintf "our \$VERSION = '%s';\n", $self->version |
|
32
|
|
|
|
|
|
|
if defined $self->version; |
|
33
|
|
|
|
|
|
|
|
|
34
|
36
|
|
|
|
|
172
|
return $string; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub _format_statement { |
|
38
|
0
|
|
|
0
|
|
0
|
my ($self) = @_; |
|
39
|
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
0
|
my $string = q{}; |
|
41
|
|
|
|
|
|
|
|
|
42
|
0
|
0
|
|
|
|
0
|
$string .= sprintf "package %s%s;\n", |
|
43
|
|
|
|
|
|
|
$self->name, |
|
44
|
|
|
|
|
|
|
(defined $self->version ? (q{ } . $self->version) : ''); |
|
45
|
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
0
|
return $string; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub _format_block { |
|
50
|
0
|
|
|
0
|
|
0
|
my ($self) = @_; |
|
51
|
|
|
|
|
|
|
|
|
52
|
0
|
0
|
|
|
|
0
|
my $string = sprintf "package %s%s {\n\n # Your code here\n\n}\n", |
|
53
|
|
|
|
|
|
|
$self->name, |
|
54
|
|
|
|
|
|
|
(defined $self->version ? (q{ } . $self->version) : ''); |
|
55
|
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
0
|
return $string; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub as_string { |
|
60
|
36
|
|
|
36
|
0
|
82
|
my ($self) = @_; |
|
61
|
|
|
|
|
|
|
|
|
62
|
36
|
|
|
|
|
946
|
my $style = $self->style; |
|
63
|
|
|
|
|
|
|
|
|
64
|
36
|
50
|
|
|
|
99
|
unless (ref $style) { |
|
65
|
36
|
50
|
|
|
|
193
|
confess("unknown package style: $style") unless $self->can("_format_$style"); |
|
66
|
36
|
|
|
|
|
98
|
$style = "_format_$style"; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
36
|
|
|
|
|
120
|
return $self->$style; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
subtype 'Module::Faker::Type::Packages' |
|
73
|
|
|
|
|
|
|
=> as 'ArrayRef[Module::Faker::Package]'; |
|
74
|
|
|
|
|
|
|
|
|
75
|
8
|
|
|
8
|
|
20669
|
no Moose; |
|
|
8
|
|
|
|
|
19
|
|
|
|
8
|
|
|
|
|
48
|
|
|
76
|
|
|
|
|
|
|
1; |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
__END__ |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=pod |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=encoding UTF-8 |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 NAME |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Module::Faker::Package - a faked package in a faked module |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 VERSION |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
version 0.022 |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 AUTHOR |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Ricardo Signes <rjbs@cpan.org> |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
This software is copyright (c) 2008 by Ricardo Signes. |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
101
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |