| 1 | package Test::Inline::Content::Default; | ||||||||||
| 2 | # ABSTRACT: est::Inline 2 fallback/default Content Handler | ||||||||||
| 3 | |||||||||||
| 4 | #pod =pod | ||||||||||
| 5 | #pod | ||||||||||
| 6 | #pod =head1 DESCRIPTION | ||||||||||
| 7 | #pod | ||||||||||
| 8 | #pod This class implements the default generator for script content. It generates | ||||||||||
| 9 | #pod test script content inteded for use in a standard CPAN dist. | ||||||||||
| 10 | #pod | ||||||||||
| 11 | #pod This module contains no user servicable parts. | ||||||||||
| 12 | #pod | ||||||||||
| 13 | #pod =cut | ||||||||||
| 14 | |||||||||||
| 15 | 12 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | 12 | ▶ | use Params::Util qw{_INSTANCE}; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | 12 | ▶ | use Test::Inline::Content (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | |||||||||||
| 19 | 12 | our $VERSION = '2.214'; | |||||||||
| 20 | 12 | our @ISA = 'Test::Inline::Content'; | |||||||||
| 21 | |||||||||||
| 22 | 16 | ▶ | sub process { | ||||||||
|
Subroutine
process: called CC=5 SCAR=16.4
Pod
documented
| |||||||||||
| 23 | 16 | my $self = shift; | |||||||||
| 24 | 16 | ▶ | my $Inline = _INSTANCE(shift, 'Test::Inline') or return undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | 16 | ▶ | my $Script = _INSTANCE(shift, 'Test::Inline::Script') or return undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | |||||||||||
| 27 | # Get the merged content | ||||||||||
| 28 | 16 | my $content = $Script->merged_content; | |||||||||
| 29 | 16 | ▶ | return undef unless defined $content; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | |||||||||||
| 31 | # Determine a plan | ||||||||||
| 32 | 16 | my $tests = $Script->tests; | |||||||||
| 33 | 16 | ▶ | my $plan = defined $tests | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | ? "tests => $tests" | ||||||||||
| 35 | : "'no_plan'"; | ||||||||||
| 36 | |||||||||||
| 37 | # Wrap the merged contents with the rest of the test | ||||||||||
| 38 | # file infrastructure. | ||||||||||
| 39 | 16 | my $file = <<"END_TEST"; | |||||||||
| 40 | #!/usr/bin/perl -w | ||||||||||
| 41 | |||||||||||
| 42 | use strict; | ||||||||||
| 43 | use Test::More $plan; | ||||||||||
| 44 | \$| = 1; | ||||||||||
| 45 | |||||||||||
| 46 | |||||||||||
| 47 | |||||||||||
| 48 | $content | ||||||||||
| 49 | |||||||||||
| 50 | |||||||||||
| 51 | |||||||||||
| 52 | 1; | ||||||||||
| 53 | END_TEST | ||||||||||
| 54 | |||||||||||
| 55 | 16 | $file; | |||||||||
| 56 | } | ||||||||||
| 57 | |||||||||||
| 58 | 12 | 1; | |||||||||
| 59 | |||||||||||
| 60 | __END__ | ||||||||||