line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Inline::Content; |
2
|
|
|
|
|
|
|
# ABSTRACT: Test::Inline 2 Content Handlers |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
#pod =pod |
5
|
|
|
|
|
|
|
#pod |
6
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
7
|
|
|
|
|
|
|
#pod |
8
|
|
|
|
|
|
|
#pod One problem with the initial versions of L 2 was the method |
9
|
|
|
|
|
|
|
#pod by which it generated the script contents. |
10
|
|
|
|
|
|
|
#pod |
11
|
|
|
|
|
|
|
#pod C provides a basic API by which more sophisticated |
12
|
|
|
|
|
|
|
#pod extensions can be written to control the content of the generated scripts. |
13
|
|
|
|
|
|
|
#pod |
14
|
|
|
|
|
|
|
#pod =head1 METHODS |
15
|
|
|
|
|
|
|
#pod |
16
|
|
|
|
|
|
|
#pod =cut |
17
|
|
|
|
|
|
|
|
18
|
12
|
|
|
12
|
|
1458
|
use strict; |
|
12
|
|
|
|
|
26
|
|
|
12
|
|
|
|
|
393
|
|
19
|
12
|
|
|
12
|
|
535
|
use Params::Util '_INSTANCE'; |
|
12
|
|
|
|
|
3568
|
|
|
12
|
|
|
|
|
2500
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our $VERSION = '2.214'; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
#pod =pod |
24
|
|
|
|
|
|
|
#pod |
25
|
|
|
|
|
|
|
#pod =head2 new |
26
|
|
|
|
|
|
|
#pod |
27
|
|
|
|
|
|
|
#pod A default implementation of the C method is provided that takes no |
28
|
|
|
|
|
|
|
#pod parameters and creates a default (empty) object. |
29
|
|
|
|
|
|
|
#pod |
30
|
|
|
|
|
|
|
#pod Returns a new C object. |
31
|
|
|
|
|
|
|
#pod |
32
|
|
|
|
|
|
|
#pod =cut |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub new { |
35
|
25
|
|
33
|
25
|
1
|
2797
|
my $class = ref $_[0] || $_[0]; |
36
|
25
|
|
|
|
|
112
|
bless {}, $class; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
#pod =pod |
40
|
|
|
|
|
|
|
#pod |
41
|
|
|
|
|
|
|
#pod =head2 process $Inline $Script |
42
|
|
|
|
|
|
|
#pod |
43
|
|
|
|
|
|
|
#pod The C method does the work of generating the script content. It |
44
|
|
|
|
|
|
|
#pod takes as argument the parent L object, and the completed |
45
|
|
|
|
|
|
|
#pod L object for which the file is to be generated. |
46
|
|
|
|
|
|
|
#pod |
47
|
|
|
|
|
|
|
#pod The default implementation returns only an empty script that dies with |
48
|
|
|
|
|
|
|
#pod an appropriate error message. |
49
|
|
|
|
|
|
|
#pod |
50
|
|
|
|
|
|
|
#pod Returns the content of the script as a string, or C on error. |
51
|
|
|
|
|
|
|
#pod |
52
|
|
|
|
|
|
|
#pod =cut |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub process { |
55
|
5
|
|
|
5
|
1
|
636
|
my $self = shift; |
56
|
5
|
100
|
|
|
|
41
|
my $Inline = _INSTANCE(shift, 'Test::Inline') or return undef; |
57
|
4
|
100
|
|
|
|
27
|
my $Script = _INSTANCE(shift, 'Test::Inline::Script') or return undef; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# If used directly, create a valid script file that just dies |
60
|
1
|
|
|
|
|
5
|
my $class = $Script->class; |
61
|
1
|
|
|
|
|
4
|
my $content = <<"END_PERL"; |
62
|
|
|
|
|
|
|
#!/usr/bin/perl |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
use strict; |
65
|
|
|
|
|
|
|
use Test::More tests => 1; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
fail('Generation of inline test script for $class failed' ); |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
exit(0); |
70
|
|
|
|
|
|
|
END_PERL |
71
|
|
|
|
|
|
|
|
72
|
1
|
|
|
|
|
4
|
return $content; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
__END__ |