| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Test::Inline::Content; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=pod |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Test::Inline::Content - Test::Inline 2 Content Handlers |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
One problem with the initial versions of L 2 was the method |
|
12
|
|
|
|
|
|
|
by which it generated the script contents. |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
C provides a basic API by which more sophisticated |
|
15
|
|
|
|
|
|
|
extensions can be written to control the content of the generated scripts. |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 METHODS |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=cut |
|
20
|
|
|
|
|
|
|
|
|
21
|
12
|
|
|
12
|
|
1851
|
use strict; |
|
|
12
|
|
|
|
|
23
|
|
|
|
12
|
|
|
|
|
492
|
|
|
22
|
12
|
|
|
12
|
|
870
|
use Params::Util '_INSTANCE'; |
|
|
12
|
|
|
|
|
3115
|
|
|
|
12
|
|
|
|
|
1038
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
12
|
|
|
12
|
|
79
|
use vars qw{$VERSION}; |
|
|
12
|
|
|
|
|
20
|
|
|
|
12
|
|
|
|
|
515
|
|
|
25
|
|
|
|
|
|
|
BEGIN { |
|
26
|
12
|
|
|
12
|
|
2441
|
$VERSION = '2.213'; |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=pod |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head2 new |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
A default implementation of the C method is provided that takes no |
|
34
|
|
|
|
|
|
|
parameters and creates a default (empty) object. |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Returns a new C object. |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub new { |
|
41
|
25
|
|
33
|
25
|
1
|
4207
|
my $class = ref $_[0] || $_[0]; |
|
42
|
25
|
|
|
|
|
181
|
bless {}, $class; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=pod |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 process $Inline $Script |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
The C method does the work of generating the script content. It |
|
50
|
|
|
|
|
|
|
takes as argument the parent L object, and the completed |
|
51
|
|
|
|
|
|
|
L object for which the file is to be generated. |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
The default implementation returns only an empty script that dies with |
|
54
|
|
|
|
|
|
|
an appropriate error message. |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Returns the content of the script as a string, or C on error. |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub process { |
|
61
|
5
|
|
|
5
|
1
|
901
|
my $self = shift; |
|
62
|
5
|
100
|
|
|
|
43
|
my $Inline = _INSTANCE(shift, 'Test::Inline') or return undef; |
|
63
|
4
|
100
|
|
|
|
32
|
my $Script = _INSTANCE(shift, 'Test::Inline::Script') or return undef; |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# If used directly, create a valid script file that just dies |
|
66
|
1
|
|
|
|
|
6
|
my $class = $Script->class; |
|
67
|
1
|
|
|
|
|
3
|
my $content = <<"END_PERL"; |
|
68
|
|
|
|
|
|
|
#!/usr/bin/perl |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
use strict; |
|
71
|
|
|
|
|
|
|
use Test::More tests => 1; |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
fail('Generation of inline test script for $class failed' ); |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
exit(0); |
|
76
|
|
|
|
|
|
|
END_PERL |
|
77
|
|
|
|
|
|
|
|
|
78
|
1
|
|
|
|
|
3
|
return $content; |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=pod |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 SUPPORT |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
See the main L section. |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 AUTHOR |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Adam Kennedy Eadamk@cpan.orgE, L |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Copyright 2004 - 2013 Adam Kennedy. |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
This program is free software; you can redistribute |
|
98
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
The full text of the license can be found in the |
|
101
|
|
|
|
|
|
|
LICENSE file included with this module. |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |